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

SAADC buffer / UART data noise problem questions

Hello,

I have one more questions while doing test with SAADC, UART.

When I was tested the SAADC pin connect with ground, the negative value occurs.

So, I changed the code like below and I can see the 0 value in LOG info.

However, in the UART RX part(microprocessor) the negative value still occurs,

and other trash value(noise I think) occur. The only hardware connection is the ground & UART pin.

1) p_event->data.done.p_buffer[0] = 0; this line code cannot be changed the pointer value?

While I am find the problem, I am not sure the buffer setting of the code is right.

The second picture, 1 buffer used, and 1 saadc channel is activated.

2) Is is right method that 1channel and 1buffer using?

I just know about buffer_convert function,: ("nrf_drv_saadc_buffer_convert" function must be a multiple of the number of channels.)

Is there any reason or the part which I should check?

The 3rd picture, Temp[18] to Temp[22] is the only right value.('\x0d' '\x0a' '-' '1' '0'   -> (start bit, right, data -10))

The other value is noise, or etc. 

cf) I am connect the UART/ ground pin as possible as narrow(under 10cm) / the UART setting double-checked(ex. baudrate, parity, stop bit, etc.)

cf) (picture 1) saadc init   (picture 2) nrf_drv_saadc_buffer_convert, ble_nus_data_send   (picture 3) UART RX part results with unwanted data

Sorry for many questions.

Thank you for reading my questions.

Best Regards,

Yclee.

Parents
  • Hi Yclee,

    So, I changed the code like below and I can see the 0 value in LOG info.

    Can you upload your code from Insert -> Code instead of screenshots? That would make it more readable. Please also note that you getting negative values indicate that the SAADC has not been calibrated. I recommend you consider using the internal reference instead of VDD/4, and that you perform calibration at startup. 

    1) p_event->data.done.p_buffer[0] = 0; this line code cannot be changed the pointer value?

    Can you clarify? What this line does is take the first element in the p_buffer array and sets the value to 0, but I am not sure what was the question?

    2) Is is right method that 1channel and 1buffer using?

    I do not see any obvious issues, but it depends on what you want. Is there an issue here?

    But you are right that there will be noise in any case. This is why you may want to consider oversampling, which is basically taking a number of samples and averaging them. As you use VDD as reference you may get noise depending on the current draw from the nRF (as it may cause voltage to drop). So seeing noise based on UART activity or other is not unexpected in this case.

Reply
  • Hi Yclee,

    So, I changed the code like below and I can see the 0 value in LOG info.

    Can you upload your code from Insert -> Code instead of screenshots? That would make it more readable. Please also note that you getting negative values indicate that the SAADC has not been calibrated. I recommend you consider using the internal reference instead of VDD/4, and that you perform calibration at startup. 

    1) p_event->data.done.p_buffer[0] = 0; this line code cannot be changed the pointer value?

    Can you clarify? What this line does is take the first element in the p_buffer array and sets the value to 0, but I am not sure what was the question?

    2) Is is right method that 1channel and 1buffer using?

    I do not see any obvious issues, but it depends on what you want. Is there an issue here?

    But you are right that there will be noise in any case. This is why you may want to consider oversampling, which is basically taking a number of samples and averaging them. As you use VDD as reference you may get noise depending on the current draw from the nRF (as it may cause voltage to drop). So seeing noise based on UART activity or other is not unexpected in this case.

Children
No Data
Related