Skip to content

Set ADC ACQTIME to 40us#2

Merged
daniel-thompson merged 1 commit intowasp-os:wasp-osfrom
fgaz:adc-acqtime
Oct 30, 2021
Merged

Set ADC ACQTIME to 40us#2
daniel-thompson merged 1 commit intowasp-os:wasp-osfrom
fgaz:adc-acqtime

Conversation

@fgaz
Copy link
Member

@fgaz fgaz commented Oct 3, 2021

In the pinetime, the battery is connected with a 1MOhm resistor, so 3us
isn't enough to measure it.
The battery is the only place where the ADC is used in the pinetime, so
it's ok to hardcode the new value, but it'd be better to make it
configurable if contributing upstream.

Fixes wasp-os/wasp-os#254

For more details see the same issue in infinitime:
InfiniTimeOrg/InfiniTime#483

In the pinetime, the battery is connected with a 1MOhm resistor, so 3us
isn't enough to measure it.
The battery is the only place where the ADC is used in the pinetime, so
it's ok to hardcode the new value, but it'd be better to make it
configurable if contributing upstream.

Fixes wasp-os/wasp-os#254

For more details see the same issue in infinitime:
InfiniTimeOrg/InfiniTime#483

Signed-off-by: Francesco Gazzetta <fgaz@fgaz.me>
@daniel-thompson daniel-thompson merged commit f46ce0d into wasp-os:wasp-os Oct 30, 2021
@fgaz fgaz deleted the adc-acqtime branch October 31, 2021 14:15
arli2001 pushed a commit to arli2001/micropython that referenced this pull request Oct 11, 2025
asan considers that memcmp(p, q, N) is permitted to access N bytes at each
of p and q, even for values of p and q that have a difference earlier.
Accessing additional values is frequently done in practice, reading 4 or
more bytes from each input at a time for efficiency, so when completing
"non_exist<TAB>" in the repl, this causes a diagnostic:

    ==16938==ERROR: AddressSanitizer: global-buffer-overflow on
    address 0x555555cd8dc8 at pc 0x7ffff726457b bp 0x7fffffffda20 sp 0x7fff
    READ of size 9 at 0x555555cd8dc8 thread T0
        #0 0x7ffff726457a  (/usr/lib/x86_64-linux-gnu/libasan.so.5+0xb857a)
        wasp-os#1 0x555555b0e82a in mp_repl_autocomplete ../../py/repl.c:301
        wasp-os#2 0x555555c89585 in readline_process_char ../../lib/mp-readline/re
        wasp-os#3 0x555555c8ac6e in readline ../../lib/mp-readline/readline.c:513
        wasp-os#4 0x555555b8dcbd in do_repl /home/jepler/src/micropython/ports/uni
        micropython#5 0x555555b90859 in main_ /home/jepler/src/micropython/ports/unix/
        micropython#6 0x555555b90a3a in main /home/jepler/src/micropython/ports/unix/m
        micropython#7 0x7ffff619a09a in __libc_start_main ../csu/libc-start.c:308
        micropython#8 0x55555595fd69 in _start (/home/jepler/src/micropython/ports/uni

    0x555555cd8dc8 is located 0 bytes to the right of global variable
    'import_str' defined in '../../py/repl.c:285:23' (0x555555cd8dc0) of
    size 8
      'import_str' is ascii string 'import '

Signed-off-by: Jeff Epler <jepler@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Misconfigured ADC?

2 participants