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

adc.readvdd33() on wemos d1 mini pro always gives 65535 #1826

Closed
Tuxdiver opened this issue Mar 1, 2017 · 3 comments
Closed

adc.readvdd33() on wemos d1 mini pro always gives 65535 #1826

Tuxdiver opened this issue Mar 1, 2017 · 3 comments
Labels

Comments

@Tuxdiver
Copy link

Tuxdiver commented Mar 1, 2017

Expected behavior

Calling adc.readvdd33() should return the voltage after setting adc.force_init_mode(adc.INIT_VDD33) and possibly restarting

Actual behavior

Call of adc.readvdd33() always returns 65535, adc.read(0) returns analog value around 7.

Test code

print(adc.force_init_mode(adc.INIT_VDD33))
print(adc.readvdd33())
print(adc.read(0))

gives:

false
65535
7

NodeMCU version

Current own build by docker image:
NodeMCU 2.0.0 build unspecified powered by Lua 5.1.4 on SDK 2.0.0(656edbf)

Hardware

Wemos d1 mini Pro

Possible reason

Could the changed memory layout for modules with more than 4MB flash cause the problem? Maybe the writing to memory position 107 is at the wrong position in the flash?
adc.c:
uint32 init_sector = flash_safe_get_sec_num () - 4;
It does write something, because calling adc.force_init_mode with changing mode returns true in the first call and false after that. But maybe it is not in the right block.

@devsaurus
Copy link
Member

Your analysis is most likely correct, thanks for reporting!
Seems I missed this instance - will have a look.

@devsaurus
Copy link
Member

@Tuxdiver I was able to reproduce this issue. Fix is contained in the linked PR.

@devsaurus devsaurus added the bug label Mar 1, 2017
@jmattsson
Copy link
Member

Fix merged into dev.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants