ISR for gpio never excuted

2 posts / 0 new
Last post
kurbylee
Offline
Last seen:3 years 4 months ago
加入:2014-11-05 09:10
ISR for gpio never excuted

void ext_wakeup_enable(uint32_t port, uint32_t pin, uint8_t polarity)
{
rwip_env.ext_wakeup_enable = 2;
#if DEVELOPMENT_DEBUG
RESERVE_GPIO( EXT_WAKEUP_GPIO, (GPIO_PORT) port, (GPIO_PIN) pin, PID_GPIO );
#endif
if ( polarity == 0 ) // active low
GPIO_ConfigurePin((GPIO_PORT) port, (GPIO_PIN) pin, INPUT_PULLUP, PID_GPIO, false ); // active low. Set default to input high.
else // active high
GPIO_ConfigurePin( (GPIO_PORT) port, (GPIO_PIN) pin, INPUT_PULLDOWN, PID_GPIO, false ); // active high. Set default to input low.

wkupct_register_callback(ext_wakeup_cb);

wkupct_enable_irq(1* Arguments : port - GPIO port
* pin - pin
* mode - pin mode (input, output...)
* function - pin usage (GPIO, UART, SPI...)
* high - set to TRUE to set the pin into high else low
2>if I GPIO_GetPinStatus this pad ,I get high or low?

3>I use a customized button(port1,pin0).I have a external pullup resitor(10K) at this pad,when push the button ,then tied to GND.
in set_pad_functions:
GPIO_ConfigurePin(GPIO_BUTTON_PORT, GPIO_BUTTON_PIN, INPUT, PID_GPIO, true);
GPIO_RegisterCallback(GPIO_BUTTON_IRQn, push_button_handler);
GPIO_EnableIRQ(GPIO_BUTTON_PORT, GPIO_BUTTON_PIN, GPIO_BUTTON_IRQn, true, true, BUTTON_INTERVAL);

in push_button_handler,I toggle another GPIO pin status to high or low.
if(GPIO_GetPinStatus(LED_PORT,LED_PIN)) GPIO_SetInactive(LED_PORT,LED_PIN);
else GPIO_SetActive(LED_PORT,LED_PIN);
it seems that the push_button_handler never excuted.I sure that I can ctrl the pad for led outside the push_button_handler isr .

Is there any other step to set the gpio for button,I forget to add??
Ths。

Device:
smdzjl007
Offline
Last seen:3 years 8 months ago
加入:2015-08-04 15:07
Hi Sir/Madam,

Hi Sir/Madam,

I meet a strange problem during DA14580 custom board development. I want to use UART1 interface for external communication. After setting relevant pin mapping, I can successfully receive data from external PC HiperTerminal, but I can not send out any data from DA board to external PC. By carefully debug, I see following function never called as ISR by "system", except app_ble_push call uart_tx_callback activelly, so data never send over UART and callbackbusy never set as FALSE. Can you help me to check what the exact reason? Thanks a lot!

static void uart_tx_callback(uint8_t res)
{
//function gets called from uart transmit isr or application when its not running
if(res == UART_STATUS_OK)
{
//reset state pointer
tx_state_ptr = UART_NONE;

//get data and pointer
uint8_t size = app_uart_pull(tx_write_pointer, TX_CALLBACK_SIZE, &tx_state_ptr);

//if there is data available, send data over uart
if(size > 0)
{
uart_sps_write(tx_write_pointer, size, &tx_state_ptr, &uart_tx_callback);
return;
}

//if there is no data but only flow control just send flow control to UART
else if(tx_state_ptr == UART_XOFF || tx_state_ptr == UART_XON)
{
uart_sps_write(0, 0, &tx_state_ptr, &uart_tx_callback);
return;
}
}
else
{
while(1); //error: callback called from unknown source
}

/ /没有缓冲区中的数据所以callback is done
callbackbusy = FALSE;
}

Br,
ZHANG.