BRT Community

Please login or register.

Login with username, password and session length
Advanced search  

News:

Welcome to the Bridgetek Community!

Please read our Welcome Note

Technical Support enquires
please contact the team
@ Bridgetek Support

Please refer to our website for detailed information on all our products - Bridgetek - Bridging Technology

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Messages - A.STARR@NIWA.CO.NZ

Pages: [1]
1
Discussion - MCU / Re: GPIO interrupt wakeup from power-down mode
« on: May 10, 2021, 12:43:48 AM »
All working - superb!

Thanks very much

2
Discussion - MCU / Re: GPIO interrupt wakeup from power-down mode
« on: May 07, 2021, 05:40:44 AM »
I found that by replacing the memcpy() calls in load_config() with a loop that uses pointers to copy the data, everything is fine.

However, now UART0 is not responding to incoming characters (I am using the uartrb code). It appears that the UART0 receive interrupt is not working. The application is still running, as I can still see messages printed from UART0 (e.g. in a continuous loop), but uartrb_available(UART0) returns no available characters.

Just to be clear, the problems don't appear unless I uncomment the following two lines near the start of main():

Code: [Select]
SYS->PMCFG_L &= ~MASK_SYS_PMCFG_PM_PWRDN_MODE;
SYS->PMCFG_L |= MASK_SYS_PMCFG_PM_PWRDN;

The idea is, the system goes into power-down on entry to main, waiting for an interrupt on GPIO49. When I send a serial character, a falling edge brings it out of power-down mode, configures UART0 for interrupt-driven buffered comms (uartrb), and prints a message. This all works fine except incoming serial characters are not being placed in the ring buffer.

It looks as though power-down mode is causing some serious problems. Any advice on this (including detailed information about what power-down actually does - there is not much in the documentation) would be greatly appreciated.

3
Discussion - MCU / Re: GPIO interrupt wakeup from power-down mode
« on: May 06, 2021, 06:27:04 AM »
Actually, after further testing I've discovered that the FT908 is in fact coming out of power-down mode on receiving the falling edge of a break character on GPIO49. But I've had to put a for..next loop immediately after the power-down command, or else UART0 doesn't seem to work. Is this because the system takes some time to come out of power-down mode?

Code: [Select]
   
gpio_function(49, pad_gpio49);
gpio_dir(49, pad_dir_input);
gpio_pull(49, pad_pull_pullup);
interrupt_attach(interrupt_gpio, (uint8_t)interrupt_gpio, ISR_gpio);
gpio_interrupt_enable(49, gpio_int_edge_falling);
interrupt_enable_globally();
SYS->PMCFG_L &= ~MASK_SYS_PMCFG_PM_PWRDN_MODE;
SYS->PMCFG_L |= MASK_SYS_PMCFG_PM_PWRDN;

for(unsigned long i=0; i<3000; i++);

/* Enable the UART Device... */
sys_enable(sys_device_uart0);

/* Make GPIO48 function as UART0_TXD and GPIO49 function as UART0_RXD... */
gpio_function(48, pad_uart0_txd); /* UART0 TXD */
gpio_function(49, pad_uart0_rxd); /* UART0 RXD */
gpio_function(50, pad_uart0_rts); /* UART0 RTS */
gpio_function(51, pad_uart0_cts); /* UART0 CTS */
uart_open(UART0,                    /* Device */
1,                        /* Prescaler = 1 */
UART_DIVIDER_1200_BAUD,
uart_data_bits_8,         /* No. Data Bits */
uart_parity_none,         /* Parity */
uart_stop_bits_1);        /* No. Stop Bits */

uartrb_setup(UART0, uartrb_flow_none); //flow control handled in uartrb code

etc.

My next problem is that the power-down seems to trash my DLOG partition:

Code: [Select]
void load_config(void)
{
   int pgsz, pages;

   dlog_init( __dlog_partition, &pgsz, &pages);
   dlog_read (CONF_PAGE, (uint32_t *)confbuf);
   memcpy(&conf, confbuf, sizeof(struct Conf));
   if((conf.start != START_MARKER_VAL) || (conf.stop != END_MARKER_VAL))
   {
      memcpy(&conf, &default_conf, sizeof(struct Conf));
      save_config();
   }
}

load_config() is called straight after UART0 is initialised, and reads a page of data from the DLOG partition and uses it to populate a Conf struct. It appears to crash at the first memcpy after dlog_read(). Could the problem be power-down mode not preserving the RAM?

Note: load_config() works fine if I remove the power-down code.

Thanks again

4
Discussion - MCU / GPIO interrupt wakeup from power-down mode
« on: May 06, 2021, 04:42:37 AM »
I have successfully used the code below (at the start of main() ) to set the FT908 to wake from power-down mode with a falling edge on GPIO57:

Code: [Select]

gpio_function(57, pad_gpio57);
gpio_dir(57, pad_dir_input);
gpio_pull(57, pad_pull_pullup);
interrupt_attach(interrupt_gpio, (uint8_t)interrupt_gpio, ISR_gpio);
gpio_interrupt_enable(57, gpio_int_edge_falling);
interrupt_enable_globally();
SYS->PMCFG_L &= ~MASK_SYS_PMCFG_PM_PWRDN_MODE;
SYS->PMCFG_L |= MASK_SYS_PMCFG_PM_PWRDN;

However, when I change the GPIO pin from 57 to 49 (making the appropriate code changes), the FT908 will no longer wake up. Is it not possible to use GPIO49 for this? I'd like to wake the FT908 from power-down on receiving a break character on UART0, which is why want to use UART0_RXD/GPIO49 (I have had no luck trying to use the UART0 interrupt to wake the system).
The idea being that once the system is awake, the code then reconfigures GPIO49 to UART0_RXD and enables UART0.

Any suggestions appreciated, thanks

5
Thanks very much, this worked fine.

Just a note: I had to enable the compliation of the usbh_hw_disable_int() function in usbh.c, by changing the preceding #if 0 to #if 1

Thanks again

6
Hi all,

I'm developing a product using the FT908 that serves as a bridge between a sensor (that emulates a USB flash drive) and an SDI-12 recorder. I need to be able to deactivate the USB host port, and I see there is a function in the documentation for doing this: USBH_finalise(). It has a prototype in the ft900_usbh.h header file, but the function itself is not in usbh.c. I've tried using sys_disable(sys_device_usb_host), but this doesn't seem to have any effect.

Can anyone shed any light here?

Thanks in advance!

Pages: [1]