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

the behavior of nrf52832 saadc when reading floating pin

Hello,

I am having trying to achieve hardware versioning via saadc.

Module model: nrf52832

Sdk: 15.2

There are two versions of the hardware:

version 1, there is no hardware versioning implemented with AIN7, the pin is floating.

version 2, there is hardware versioning implemented with AIN7, the pin is connected to a voltage divider which should read in the range from 0 to VDD for hardware different versions.

When trying to read the AIN7 pin via the saadc example, the following logs are captured:

From hardware version 1 unit 1:
<info> app: ADC event number: 0
<info> app: 94
<info> app: 88
<info> app: 89
<info> app: 89
<info> app: 88
<info> app: ADC event number: 1
<info> app: 89
<info> app: 88
<info> app: 89
<info> app: 89
<info> app: 87

From hardware version 1 unit 2:

<info> app: ADC event number: 0
<info> app: 329
<info> app: 320
<info> app: 320
<info> app: 321
<info> app: 318
<info> app: ADC event number: 1
<info> app: 318
<info> app: 318
<info> app: 317
<info> app: 317
<info> app: 317

The readings from above are from the same nrf52832 model but different modules within the same batch.

Is there a way to get the floating pin read something consistent which make it possible to use AIN7 for hardware versioning purpose?

Many thanks.

Parents
  • Hello, 

    version 1, there is no hardware versioning implemented with AIN7, the pin is floating.
    version 2, there is hardware versioning implemented with AIN7, the pin is connected to a voltage divider which should read in the range from 0 to VDD for hardware different versions.

    If the pin is floating there really is no way to guarantee or predict what value it will read. I suggest adding or enabling a pullup or pulldown on the pin, to bring it to a known state.

    If I understand your situation correctly then a pullup or pulldown should make you able to differentiate between the two hardware versions since the one that is connected to a voltage divider will still read the value of the voltage divider, while the version 1 will read a steady zero.

    Is there a way to get the floating pin read something consistent which make it possible to use AIN7 for hardware versioning purpose?

    By using a pullup or pulldown resistor you will get consistent measurements on your pin measurements.
    You can enable the pullup or down in the particular PINs CFG register directly to avoid overwriting any other settings made by the SAADC initialization.

    Best regards,
    Karl

  • Thank you Karl,

    I have tested with pulldown enable and the pin reads ~0V now, so this works :) 

    I have read the specification regarding the internal GPIO pull-down resistor, the typical resistance is 13kohm with a minimum of 11kohm and a maximum of 16kohm:

    With the above in mind, it looks like the Rladder resistance from saadc has less impact in this specific impact and easier to work with, since the Rladder resistance is typical at 160kohm:

    I think I will use the Rladder from saadc.

    Now just need to make sure the when the pulldown is enabled, the extra 160kohm in parallel needs to be taken into account

    Much appreciated, thanks!

  • EdwardC said:
    I have tested with pulldown enable and the pin reads ~0V now, so this works :) 

    I am happy to hear that this achieves the functionality you were looking for! :)

    EdwardC said:
    With the above in mind, it looks like the Rladder resistance from saadc has less impact in this specific impact and easier to work with, since the Rladder resistance is typical at 160kohm:
    EdwardC said:
    Now just need to make sure the when the pulldown is enabled, the extra 160kohm in parallel needs to be taken into account
    EdwardC said:
    I think I will use the Rladder from saadc.

    Yes, using the Rladder of the SAADC is of course easier in this case - I should have suggested it myself in the first place directly! :)

    EdwardC said:
    Thank you Karl
    EdwardC said:
    Much appreciated, thanks!

    No problem at all, I am happy to help!

    Please do not hesitate to open another ticket if you should encounter any issues or questions in the future.

    Good luck with your development!

    Best regards,
    Karl

Reply
  • EdwardC said:
    I have tested with pulldown enable and the pin reads ~0V now, so this works :) 

    I am happy to hear that this achieves the functionality you were looking for! :)

    EdwardC said:
    With the above in mind, it looks like the Rladder resistance from saadc has less impact in this specific impact and easier to work with, since the Rladder resistance is typical at 160kohm:
    EdwardC said:
    Now just need to make sure the when the pulldown is enabled, the extra 160kohm in parallel needs to be taken into account
    EdwardC said:
    I think I will use the Rladder from saadc.

    Yes, using the Rladder of the SAADC is of course easier in this case - I should have suggested it myself in the first place directly! :)

    EdwardC said:
    Thank you Karl
    EdwardC said:
    Much appreciated, thanks!

    No problem at all, I am happy to help!

    Please do not hesitate to open another ticket if you should encounter any issues or questions in the future.

    Good luck with your development!

    Best regards,
    Karl

Children
No Data
Related