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

nRF52832 UART with ADC data (ble_nus_data_send function)

Hello,

I am testing UART with nRF52832.

I am using the example git(https://github.com/NordicPlayground/nRF52-ADC-examples)

The function ble_nus_data_send is used for UART data sending.

This function needs 4 parameters: NUS structure pointer / String to be sent / Pointer length of the string / Connection handle

I can't understand the Pointer length of the string. Because I was tested the ADC value 0V and 3V the results like below.

The variable bytes_to_send is the return value of sprintf(nus_string, "%d", p_event->data.done.p_buffer[0]).

p_event->data.done.p_buffer[0] is the ADC value of nRF52832 DK (AIN4).

cf) nus_string is uint8_t type.

The +3V ADC value results are 4095 digital value and has bytes_to_send 4(byte).

However, The 0V ADC value results are moving(maybe noise I think) and bytes_to_send is varying 2 ~4 byte.

So I don't know how to receive this data with other processor (TMS320F28335).

The pointer length varying is normal state? or should I change some code ?

Thank you.

Best Regards.

Yclee

Related