Skip to content
This repository has been archived by the owner on Jun 27, 2024. It is now read-only.

calliope dies when using p0.read_analog() #2

Open
kopp opened this issue Jul 8, 2020 · 0 comments
Open

calliope dies when using p0.read_analog() #2

kopp opened this issue Jul 8, 2020 · 0 comments

Comments

@kopp
Copy link

kopp commented Jul 8, 2020

When using p0.read_analog(), Calliope Mini (rev1.3) dies, i.e. becomes totally unresponsive until it is reset.

What happens, is, that when

p0.read_analog()

is called, the following backtrace can be produced:

#4  0x00024c0e in mbed_die ()
    at /calliope_mini/calliope-mini-micropython/yotta_modules/mbed-classic/common/board.c:57
#5  0x000248ac in _exit (return_code=<optimized out>)
    at /calliope_mini/calliope-mini-micropython/yotta_modules/mbed-classic/common/retarget.cpp:517
#6  0x0001c9ea in exit ()
    at /calliope_mini/calliope-mini-micropython/yotta_modules/mbed-classic/targets/hal/TARGET_NORDIC/TARGET_MCU_NRF51822/us_ticker.c:278
#7  0x00024c1a in error (format=0x34562 "pinmap not found for peripheral")
    at /calliope_mini/calliope-mini-micropython/yotta_modules/mbed-classic/common/error.c:32
#8  0x00017960 in pinmap_peripheral (pin=pin@entry=p0, map=map@entry=0x2b24c <PinMap_ADC>)
    at /calliope_mini/calliope-mini-micropython/yotta_modules/mbed-classic/common/pinmap_common.c:67
#9  0x00016e6c in analogin_init (obj=obj@entry=0x20003e10, pin=<optimized out>)
    at /calliope_mini/calliope-mini-micropython/yotta_modules/mbed-classic/targets/hal/TARGET_NORDIC/TARGET_MCU_NRF51822/analogin_api.c:40
#10 0x00000c1c in microbit_pin_read_analog (self_in=0x25360 <microbit_p0_obj>)
    at /calliope_mini/calliope-mini-micropython/source/microbit/microbitpin.cpp:157

In file

yotta_modules/mbed-classic/targets/hal/TARGET_NORDIC/TARGET_MCU_NRF51822/analogin_api.c

there is a PinMap_ADC which lists pins p1-p6 -- but not p0.
If p0.read_analog() is executed, this map is searched for p0 which is never found -- and thus the pinmap_periperal fails and Calliope Mini falls into exit.

So it looks like p0 should not be used (usable) as analog pin. The other editors such as open roberta do not allow to use p0 for analog reading.

The data sheet for the nRF51x22 mentions, though, that this pin can in fact be used as analog input?!?

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

No branches or pull requests

1 participant