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

UARTE Frame error receiving

Hi

I am seing framing errors when receiving using UARTE.

It is not external hardware, I have checked with different other interfaces and measured timing, no problems there.

BUT, doing the same with UART instead of UARTE I do not get any framing errors (same hardware setup).

Actually with UARTE I only get one rx character then framing errors....

Parents
  • Hi,

    I am not sure what is going on. A typical reason for UART framing errors is if you have a baud-rate mismatch between the two UART devices, for instance, if you have not started the high-frequency crystal oscillator. Can you try doing that? If that is not the problem (which may be unlikely, since you see a difference between using UART and UARTE), then we should probably look at your code.

  • // Initialize uarte 
    
          nrfx_uarte_config_t config = NRFX_UARTE_DEFAULT_CONFIG;
    
          // Initialize uart 
          result = nrfx_uarte_init(&m_serial[id].uart, &config, SerialInterfaceEventHandler);
          APP_ERROR_CHECK(result);
          
          // Start receiving and specify buffer for double buffering
          result = nrfx_uarte_rx(&m_serial[id].uart, &m_serial[id].rxBuffer[0], 1);
          APP_ERROR_CHECK(result);
          result = nrfx_uarte_rx(&m_serial[id].uart, &m_serial[id].rxBuffer[1], 1);
          APP_ERROR_CHECK(result);
    
    // Event handler
    
    static void SerialInterfaceEventHandler(nrfx_uarte_event_t const * p_event, void* p_context)
    {
       ret_code_t ret;
       int id = (uint32_t)p_context;
       
       switch (p_event->type)
       {
          case NRFX_UARTE_EVT_TX_DONE:   //!< Chunk of data has been sent.
             SerialCallEventHandler(id, SE_TX_COMPLETE);
             break;
          
          case NRFX_UARTE_EVT_RX_DONE:   //!< New chunk of data has been received.
             rxCount++;
             if (p_event->data.rxtx.bytes > 0)
             {
                SerialReceiveInsert(id, p_event->data.rxtx.p_data[0]);
             }
    // Previous test, not sure if a new nrfx_uarte_rx call is needed when using 
    // double buffering (but it works like below for UART interface
    //         SerialReceiveInsert(id, m_serial[id].rxBuffer[m_serial[id].rxIndex]);
    //         ret = nrfx_uarte_rx(&m_serial[id].uart, &m_serial[id].rxBuffer[m_serial[id].rxIndex], 1);
    //         APP_ERROR_CHECK(ret);
    //         m_serial[id].rxIndex = 1-m_serial[id].rxIndex;
             SerialCallEventHandler(id, SE_RX_READY);
             break;
             
          case NRFX_UARTE_EVT_ERROR:
             serError++;
             error = p_event->data.error.error_mask;
             SerialCallEventHandler(id, SE_ERROR);
             break;
       }
    }
    

    I have attached the basic initialization and eventhandler code. 

  • Hi,

    I see. The device family pack version 8.27 is not available in the pack installer yet, but you can download it from here by selecting it in the dropdown on the left. If you are starting now, I recommend going for SDK 16, but the libuarte library is also available in SDK 15.3.

  • Thanks - It seems there are multible locations for download, the one I found looked different and had latest 8.26.

    I am not starting now but modifiying an existing project from using one uart to using two uarts. And that had shown to be very difficult.

    Will SDK 16 require a SoftDevice update in my targets?

  • Fixed the device family pack thing, but a little bit messy as version 8.27 is not available so I can download 8.28 and then the example project still has error and complains, so the pack selection has to be fixed in the setup….

    I will see if I can get it running with 15.3 to begin with.

  • Hi,

    You can specify 8.28 in the Keil project though Under "Manage runtime environment", and changing the options of the Device in the project tree. But it is a bit of a hassle. SDK 15.3 should be just fine, though libuarte is improved in SDK 16 (first time out of experimental).

Reply Children
Related