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

throughput measurement NUS

Hi,

I have the following in my code to measure throughput over the Nordic Uart Service.

uint8_t data[244] = {'1'};
int64_t num = (sizeof(data) * 1000);

uint64_t start = k_uptime_get_32();
for( uint32_t i  = 0 ; i < 1000 ; )
{
	if( !bt_nus_send(NULL, data, sizeof(data)) )
	{
		i++;
	}
}
int64_t delta = k_uptime_delta(&start);

LOG_INF("sent %d bytes (%d KB) in %d ms at %d kbps", num, num / 1024, delta, (num * 8 / delta));

It works, but I was wondering if I am measuring correctly. I took this measurement principle from the throughput example, I also copied as much configuration as I thought were needed. But maybe the NUS implementation has a bit more overhead? Because I cannot reach the expected ~1327 kbps. I am stuck around 1050 kbps and cannot get it any faster.

I am connecting with my phone and use nrf toolbox uart to connect, maybe these speeds are expected? Is the phone app slowing me down a bit here? The speeds are high enough for me to think there really isn't anything wrong with my configuration.

Related