This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Uart sending process was interrupted

void uart_init(void){
uint32_t err_code;

const app_uart_comm_params_t comm_params =
  {
    .rx_pin_no    = RX_PIN_NUMBER,
    .tx_pin_no    = TX_PIN_NUMBER,
    .rts_pin_no   = RTS_PIN_NUMBER,
    .cts_pin_no   = CTS_PIN_NUMBER,
    .flow_control = APP_UART_FLOW_CONTROL_DISABLED,
    .use_parity   = false,
    .baud_rate    = UART_BAUDRATE_BAUDRATE_Baud9600
  };

APP_UART_FIFO_INIT(&comm_params,
                    UART_BUF_SIZE,
                    UART_BUF_SIZE,
                    uart_event_handler,
                    APP_IRQ_PRIORITY_LOW,
                    err_code);


APP_ERROR_CHECK(err_code);}

This is my uart initial function. When I send some data via uart, the process was interrupted by other process, I don't know which one could cause this issue?( I have 3 timers, 100ms, 1.5s and 60s, and BLE service)image description

After I set the priority level to APP_IRQ_PRIORITY_HIGH, the code works ok.

So which one could cause this problem?

Parents
  • FormerMember
    0 FormerMember

    When using the softdevice, the radio handling has the priority APP_IRQ_PRIORITY_HIGHEST, but the application level events have priority APP_IRQ_PRIORITY_MID. It means that if the UART has priority APP_IRQ_PRIORITY_LOW and if there are some BLE application events, the UART will be interrupted.

    The only problem I can think of, if having UART priority higher than BLE application events, is if there is a BLE application event that require the application to send a reply (for example during a bonding process) and it is not able to interrupt a UART interrupt.

Reply
  • FormerMember
    0 FormerMember

    When using the softdevice, the radio handling has the priority APP_IRQ_PRIORITY_HIGHEST, but the application level events have priority APP_IRQ_PRIORITY_MID. It means that if the UART has priority APP_IRQ_PRIORITY_LOW and if there are some BLE application events, the UART will be interrupted.

    The only problem I can think of, if having UART priority higher than BLE application events, is if there is a BLE application event that require the application to send a reply (for example during a bonding process) and it is not able to interrupt a UART interrupt.

Children
Related