Voting resources, early voting, and poll worker information - VOTE. ... Adafruit is open and shipping.
0

UART between two Feathers STM32F405
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

UART between two Feathers STM32F405

by ramsh on Wed Sep 09, 2020 12:08 pm

Hi,

I have two Feathers STM32F405 connected via UART (crossed RX, TX) to one another and share a ground, but i cant transmit data from one to another...

both run CircuitPython:
Code: Select all | TOGGLE FULL SIZE
Adafruit CircuitPython 5.3.1 on 2020-07-13; Feather STM32F405 Express with STM32F405RG


I added the "adafruit_bus_device" folder to both feathers lib folders and have the following code for the transmit data:


Code: Select all | TOGGLE FULL SIZE
import busio
uart = busio.UART(board.TX, board.RX, baudrate=9600)
print('1\n')


and on the receiving end:
Code: Select all | TOGGLE FULL SIZE
import busio
uart = busio.UART(board.TX, board.RX, baudrate=9600)
while True:
    data = uart.readline(2)  # read up to 2 bytes
    print(f'>>>>> {data}')


the results is always:
Code: Select all | TOGGLE FULL SIZE
>>>>> None
>>>>> None
>>>>> None
>>>>> None
>>>>> None
>>>>> None
>>>>> None
.......


the wires are connected as it should, i have tripled checked it and it is not a wiring problem...

can you please help me figure this out?

many thanks in advance!!
Best,
Ram

ramsh
 
Posts: 114
Joined: Fri Apr 29, 2016 5:17 am

Re: UART between two Feathers STM32F405

by tannewt on Wed Sep 09, 2020 7:11 pm

Hi Ram, instead of `print()`ing try doing `uart.write()`. Print only outputs to the USB CDC connection, not the UART objects.

tannewt
 
Posts: 1784
Joined: Thu Oct 06, 2016 8:48 pm

Re: UART between two Feathers STM32F405

by ramsh on Thu Sep 10, 2020 4:49 am

Yay! that works, just need to send the data as byte:

send:
Code: Select all | TOGGLE FULL SIZE
uart.write(b'1')


recieve:
Code: Select all | TOGGLE FULL SIZE
while True:
    data = uart.readline(1)  # read 1 byte
    if data == b'1':
        print('Yay!')


many thanks for your support!
Best,
Ram

ramsh
 
Posts: 114
Joined: Fri Apr 29, 2016 5:17 am

Please be positive and constructive with your questions and comments.