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

Countermeasures for shortening STOP bit in UART transmission processing

Hello Nordic Support!
The stop bit of the last character is short in the Uart output part, and the other MPUy cannot receive the character.
How do I fix it until I send the STOP bit completely?
The waveform and the transmission program are described below.
void aUartInterface_SendData(uint8_t *data, uint16_t len)
{
    uint32_t timeout;
    uint32_t start_tick;
    uint32_t current_tick;
    uint8_t sleep = 0;
   
    if(len == 0)
        return;
   
    timeout = TIMEOUT_TICKS*len;
    start_tick = cnt_get();
   
    // check sleep or not
    if(mUartProcessing == 0)
    {
        uart_wakeup();
        sleep = 1;
    }
   
    NRF_GPIO->OUTSET = ((uint32_t)1 << PIN_UART_SENDING);
   
    NRF_UART0->TASKS_STARTTX = 1;
    for(uint16_t i=0; i<len; i++)
    {
        NRF_UART0->TXD = data[i];
        while(NRF_UART0->EVENTS_TXDRDY==0)
        {
            //
            current_tick = cnt_get();
            if( cnt_diff_compute(current_tick, start_tick) > timeout)
            {
                NRF_UART0->EVENTS_TXDRDY = 0;
                NRF_UART0->TASKS_STOPTX = 1;
                NRF_GPIO->OUTCLR = ((uint32_t)1 << PIN_UART_SENDING);
                return;
            }
        }
        NRF_UART0->EVENTS_TXDRDY = 0;
    }
    NRF_UART0->TASKS_STOPTX = 1;
   
    NRF_GPIO->OUTCLR = ((uint32_t)1 << PIN_UART_SENDING);
   
    if(sleep)
        uart_sleep();
}
let me know.
Best Regards
Hirotoshi NAGAO
CHINO Corporation
Parents Reply Children
Related