Open abdullahyildiz opened 1 year ago
There is also no register defined for setting the UART baud rate (i.e., divisor) in csr.h. Is it included as a register field in one of the other CSRs?
@thesourcerer8 commented about getting uart to work here: https://github.com/thesourcerer8/mpw2-stdcell-tests/blob/main/uart_test/uart_test.c
but it would be nice to also have the caravel UART
defined in the nucleo micropython machine
environment, currently it returns:
uart = UART(0, 9600) # init with given baudrate
from machine import UART
uart = UART(0, 9600) # init with given baudrate
uart.init(9600, bits=8, parity=None, stop=1) # init with given parameters
uart.read()
Traceback (most recent call last):
File "<stdin>", line 5, in <module>
ValueError: UART(0) doesn't exist
it particular it seems that UART8
(which correspond to https://caravel-harness.readthedocs.io/en/latest/uart.html) is not plugged into the default nucleo HAL:
https://github.com/micropython/micropython/blob/05bb26010e4a466a82cfed179f8d8d0b406a78ca/ports/stm32/boards/NUCLEO_F746ZG/mpconfigboard.h#L32-L39
@proppy,
As far as I know, MicroPython is a software stack which runs on Nucleo board and UART peripheral on Caravel management SoC is not controlled by MicroPython.
@abdullahyildiz yep, but the hardware pin that export the hardware bus are physically connected to the Nucleo board, so it should be possible to surface them to the micropython environment thru the HAL.
@proppy,
UART peripheral pins on management SoC is not connected to Nucleo board. We were able to interact with it by standard UART cable.
@abdullahyildiz I think they are electrically connected, UART is on E7
and F7
, respectively mapped to mprj_io[5]
and mprj_io[6]
which onnect to CN11
PF0
and CN12
PE11
of the nucleo Morpho connector:
but don't seem to be currently surfaced in the micropython HAL UART definitions.
found out that we can actually bridge one of the existing UART port defined here: https://github.com/micropython/micropython/blob/master/ports/stm32/boards/NUCLEO_F746ZG/mpconfigboard.h#L38-L39
by setting the pin #9
to C_DISABLE
in gpio_config_io.py
and leaving its register untouched in set_registers
and then physically bridging IO[9]
(which correspond to MICROPY_HW_UART6_RX
(G9
) with IO[6]
using a jumper cable:
The data from the caravel serial port can then be read from the micropython environment using:
uart = machine.UART(6, 9600)
print(uart.read())
It seems that definitions of the function declarations in uart.h are missing in firmware_vex: