QUERY · ISSUE
[STM32H743] ADC fail
port-stm32
Using the latest version of the main branch and run the script.
>>> import pyb
>>> adc = pyb.ADC(pyb.Pin.board.PA4)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ValueError: pin A4 does not have ADC capabilities
https://github.com/micropython/micropython/blob/9ac9aa989c89a1d6310160dd408820d1164d4dd7/ports/stm32/adc.c#L396-L399
Because H7 uses ADC3
https://github.com/micropython/micropython/blob/9ac9aa989c89a1d6310160dd408820d1164d4dd7/ports/stm32/adc.c#L53-L58
CANDIDATE · ISSUE
[STM32] ADCAll and rtc.wakeup() not working on H743, probably related
Using the latest version of the main branch and run the script on various boards yield into different results:
PYBV11 works
STM32F429DISC works
STM32L496DISC works
NUCLEO_H743 fails on ADCAll and rtc.wakeup()
When using the script you have to press the user button after reset during 5 seconds in order to start the main().
import pyb
import micropython
import sys
# run clock
rtc=pyb.RTC()
rtc.init()
adc=pyb.ADCAll(12, 0x70000)
def gmv(tim):
rtc.wakeup(tim)
pyb.delay(10)
pyb.LED(2).on()
pyb.stop()
rtc.wakeup(None)
def main():
# test one
print(" Platform:", sys.platform)
print("RTC running: ", rtc.datetime())
# test two
print("ADC")
print("Core TEMP", adc.read_core_temp())
print("Core VBAT", adc.read_core_vbat())
print("Core VREF", adc.read_core_vref())
print(" VREF", adc.read_vref())
# test three
print("Here we test the wakeup function together with the pyb.sleep()")
print("Program in endless loop, UART doesn't work anymore, LED3 blinks")
while True:
gmv(1000)
pyb.LED(2).off()
pyb.delay(500)
if __name__ == "__main__":
print("Micropython")
print("delay for 5 seconds")
pyb.delay(5000)
if pyb.Switch().value():
pyb.delay(100)
while pyb.Switch().value():
pass
main()
else:
pyb.LED(1).on()
pyb.delay(100)
pyb.LED(1).off()
# exit of script