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

why nRF52810's UART can't recevie 20+ bytes?

now ,nRF52810 's serial port receives bytes.when the bytes sent by peripheral devices are mode then 20 bytes,nRF52810  will  die.if  the bytes are less than or equal to20 bytes,there is OK

 I  can't think of   this  problem the serial port of nRF52810  can receive a lot of bytes at a time without a  protocol stack.  why ?  i  wonder ! thank you!

Parents
  • May you check the map files? If your TX & RX buffer memory define is not more than 20 bytes(not init tx buffer size), the function is also abnormal. I had used the UART TX & RX function more than 128 bytes in your items.The application is SDK17 S132.What's the SDK you apply?

    For example:

    void uart_event_handle(app_uart_evt_t * p_event)
    {
    static uint8_t data_array[128];
    static uint8_t index = 0;

    switch (p_event->evt_type)
    {
    /**@snippet [Handling data from UART] */
    case APP_UART_DATA_READY:
    //UNUSED_VARIABLE(app_uart_get(&data_array[index]));
    app_uart_get(&data_array[index]);
    index++;

    if ((data_array[index - 1] == '\n') || (index >= 127))
    {
    data_array[index]=0;
    index = 0;
    }
    break;
    /**@snippet [Handling data from UART] */
    case APP_UART_COMMUNICATION_ERROR:
    APP_ERROR_HANDLER(p_event->data.error_communication);
    break;

    case APP_UART_FIFO_ERROR:
    APP_ERROR_HANDLER(p_event->data.error_code);
    break;

    default:
    break;
    }
    }

    If the data_array define is only 20 bytes, The application will not work normal.

    However, your case is dead lock. So I suppose that the memory in your side is out of memory allocated.

  • void uart_event_handle(app_uart_evt_t * p_event)
    {

        static uint8_t data_array[244];
            static    uint8_t index = 0;
            uint8_t    cr=0;

        switch (p_event->evt_type)
        {
            case APP_UART_DATA_READY:
                 
                         while (app_uart_get(&cr) == NRF_SUCCESS)
                         {
                             data_array[index++] = cr;
                             NRF_LOG_INFO(" Rec_index:%d  cr:%x",index,cr);
                         }

    case APP_UART_COMMUNICATION_ERROR:
                          NRF_LOG_INFO("APP_UART_COMMUNICATION_ERROR ");
                APP_ERROR_HANDLER(p_event->data.error_communication);
                break;

    ab0017f5800007e40b0402142845720234364e16424e08ed

    This is how my function is used。

    We need to use nrf52810 to receive the data packets sent by nrf9160 from the serial port. The packets sent by nrf9160 are all OK,

    Only nrf52810 receives:

    ab0017f5800007e40b0402142845720234364e16424e08ed

    It's going to crash. I don't know why?

    Last tip: case app_ UART_ COMMUNICATION_ Error: error

  • Have you used the stack or  heap memory functions in your project? It's seems like the heap or stack ram is conflicted with the UART procedure memory.

  • How do you judge the serial port stack of nrf52810? How to avoid this problem? You said it was a stack problem. Only nrf52810 received ab0017f5800007e40b0402142845720234364e16424e08ed

    This packet will die. There is no problem receiving other packets.


    How do you explain that?

Reply Children
No Data
Related