Can not initialize STM32L476 UART
Posted: Sun Nov 10, 2019 11:21 pm
Hello All,
I finally got the NUCLEO_L476RG-20191107-v1.11-563-g4be316fb0.dfu on to my Nucleo STM32L476.
using screen I can access the REPL!
I followed the tutorial and got the LED to flash and do other things.
The Nucleo-64 STM32L476RGT6 has a UART on pins PA2 PA3.
PA2 USART2_TX
PA3 USART2_RX
This is where I have hit a brick wall. I tried many of the UART examples to be returned
a rainbow of error messages like
>>> from machine import UART
>>> uart = UART(2, 9600)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ValueError: UART is static and can't be init'd
>>>
>>> import pyb
>>> uart = pyb.UART(2, 9600, timeout_char = 1000)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ValueError: UART is static and can't be init'd
>>>
I tried to import stm then tried the above replacing pyb with stm but no luck.
If I type dir(stm) from REPL there is a long list with USART2 on it.
Next tried
>>> dir(stm.USART2)
['__class__', 'from_bytes', 'to_bytes']
Not sure what this means?
I am at loss as to how to initialize USART2 or write to it?
Any info would be appreciated.
Please bear in mind that I am new to Python and best explain thing to me as you would a child.
Thanks Mike
I finally got the NUCLEO_L476RG-20191107-v1.11-563-g4be316fb0.dfu on to my Nucleo STM32L476.
using screen I can access the REPL!
I followed the tutorial and got the LED to flash and do other things.
The Nucleo-64 STM32L476RGT6 has a UART on pins PA2 PA3.
PA2 USART2_TX
PA3 USART2_RX
This is where I have hit a brick wall. I tried many of the UART examples to be returned
a rainbow of error messages like
>>> from machine import UART
>>> uart = UART(2, 9600)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ValueError: UART is static and can't be init'd
>>>
>>> import pyb
>>> uart = pyb.UART(2, 9600, timeout_char = 1000)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ValueError: UART is static and can't be init'd
>>>
I tried to import stm then tried the above replacing pyb with stm but no luck.
If I type dir(stm) from REPL there is a long list with USART2 on it.
Next tried
>>> dir(stm.USART2)
['__class__', 'from_bytes', 'to_bytes']
Not sure what this means?
I am at loss as to how to initialize USART2 or write to it?
Any info would be appreciated.
Please bear in mind that I am new to Python and best explain thing to me as you would a child.
Thanks Mike