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
Thanks very much
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
SYS->PMCFG_L &= ~MASK_SYS_PMCFG_PM_PWRDN_MODE;
SYS->PMCFG_L |= MASK_SYS_PMCFG_PM_PWRDN;
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.
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();
}
}
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;