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

High rate serial logging

Hi,

I'm trying to log data over a serial connection using the DK52. 

The data is coming from a sensor at about 2KHz at a size of 30 bytes per sample, so 60KBps.

I've set the Baudrate to 912600 and enabled HWFC. Using NRF_LOG_RAW_INFO to print the data into a PuTTY terminal configured the same way.

The issue is that the data printed isn't up to speed with what is expected. Between 10 and 100 characters are being printed per batch of 240.

Is there any special configuration that has to be set to log at a high rate?

Thanks

  • The same behavior appears when HWFC is disabled.

    Channel 1 for CTS, channel 2 for TX, 3 for RTS.

  • I assume that a problem may be that it is difficult in hardware to generate an accurate 912600baud from the internal clock (not easily to divide), likely the baud rate will be off (with a few %), though this should potentially corrupt bytes, not skip bytes. In any case it would be better if you could use 10000000baud, this should be accurate.

    I tried the \examples\temperature from SDKv15 by setting it to to max baudrate (1M) in sdk_config.h, and removed the nrf_delay_ms(500) in the while loop. I also manually started the HFCLK to have an accurate clock by:

        NRF_CLOCK->EVENTS_HFCLKSTARTED = 0;
        NRF_CLOCK->TASKS_HFCLKSTART = 1;
        while(NRF_CLOCK->EVENTS_HFCLKSTARTED == 0);
        NRF_CLOCK->EVENTS_HFCLKSTARTED = 0;

    This seems to print at least the following in a loop without any issue:

    Maybe you can test it for comparison?

     

     

Related