Sending executable files via python UART #1075
-
Goodmorning everyone, def send_bin_file(file_to_send): This is the code I am using to send the data. I have also tried to modify this into different ways but none of them seems to be working. So, first of all, is it impossible to send the data or did someone already tried and find a way to transmit the executable via python UART? Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
Hey @Giorgio122! I'm sorry, but I have no idea how to do that with Python... 🙈 This is what GH AI says about it: import serial
# Open the serial port
ser = serial.Serial('/dev/ttyUSB0', 19200) # Replace '/dev/ttyUSB0' with your serial port
# Read the binary file
with open('path/to/your/binary/file.bin', 'rb') as file:
binary_data = file.read()
# Send the binary data
ser.write(binary_data)
# Close the serial port
ser.close() Maybe someone else (a human) can help? |
Beta Was this translation helpful? Give feedback.
Before sending the actual executable you need to send two more characters: one arbitrary one to skip the auto-boot sequence and an
u
for starting the upload.We still have a bash script for automatic executable upload:
sw/image_gen/uart_upload.sh
Maybe you can just call that from your Python code?