Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[HELP] ESP32-S3 Don't work ADC #14816

Open
1 task done
shizacat opened this issue Nov 16, 2024 · 4 comments
Open
1 task done

[HELP] ESP32-S3 Don't work ADC #14816

shizacat opened this issue Nov 16, 2024 · 4 comments
Assignees
Labels
Community: Question Further information is requested

Comments

@shizacat
Copy link
Contributor

Description

Hello. I trying to read value from ADC, but have something problem.

  1. Added this code, without it don't get anything. It always returns the same value, regardless of the applied voltage to the pin.
  /* Select RTC control */
  regval = getreg32(SENS_SAR_MEAS1_MUX_REG);
  regval &= ~(SENS_SAR1_DIG_FORCE_M);
  // regval |= (0 << SENS_SAR1_DIG_FORCE_S);  // 1: Select digital control; 0: Select RTC control.
  putreg32(regval, SENS_SAR_MEAS1_MUX_REG);

in here: https://github.com/apache/nuttx/blob/master/arch/xtensa/src/esp32s3/esp32s3_adc.c#L441

  1. After, I got the value from ADC, but happed something strange, the voltage on pin drop down.
    I understand what happen. Please help!

Board: ESP32-S3 dev kit

Board connect
img1
The voltage on pin before read.
img3
The voltage on pin after read.
img2

Configuration: ./tools/configure.sh -m esp32s3-devkit:adc

Console

# on pin 3V before read
nsh> adc -n 2
Sample:
1: channel: 0 value: 1727
Sample:
1: channel: 0 value: 1534
nsh>

Verification

  • I have verified before submitting the report.
@shizacat shizacat added the Community: Question Further information is requested label Nov 16, 2024
@acassis
Copy link
Contributor

acassis commented Nov 16, 2024

@shizacat thanks for finding this issue and reporting it here! @tmedicci @fdcavalcanti @eren-terzioglu

@fdcavalcanti
Copy link
Contributor

Thanks for the report. I'll look into this.

@fdcavalcanti
Copy link
Contributor

fdcavalcanti commented Nov 18, 2024

@shizacat Please share what NuttX version you are running.

  • Does the voltage issue happen on other pins?
  • It goes low only during reading or does it go back up again, after you are done sampling?

@shizacat
Copy link
Contributor Author

@fdcavalcanti
NuttX version: 12.7.0

Does the voltage issue happen on other pins?

Yes, I tested on ADC Channel 0,1,2, the voltage behavior on the pin was the same.

It goes low only during reading or does it go back up again, after you are done sampling?

It stays low while the device is open.

Steps:

  • Restart device, the voltage on pin ch0 is set to 3 V.
  • call 'adc -p /dev/adc0 -n 5', in this moment voltage drop down to 1.4V, and it remains in this state. I can slight change the voltage on pin by resistor (but don't to zero).
  • then I open the next device (old, as I think is closed). call 'adc -p /dev/adc1 -n 5', The voltage in channel 0 rises again to 3 V, and I can change it in the range from 0 to 3 V. But on channel 1 the voltage drop down to 1.4V
  • the same is true for Channel 2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Community: Question Further information is requested
Projects
None yet
Development

No branches or pull requests

4 participants