You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We will need to communicate over a UDP connection between a Python application connected to our GUI, and a C++ program running on a Teensy 4.1. The Python application is being tested in issue #11 .
We can either make the Teensy 4.1 the UDP server with the Python application the UDP client, or we could make the Teensy a UDP client with the Python application acting as the server. Previously we have used the Teensy as the UDP server.
There is also a previous issue that was opened on the old repo which links to examples for the 4.1 along with instructions: issue #59
The webserver example provided in that issue is found here: https://github.com/vjmuzik/NativeEthernet/tree/master/examples/WebServer
Also there are instructions for finding the Teeny's MAC address here: https://forum.pjrc.com/threads/62932-Teensy-4-1-MAC-Address
The webserver example is for Ethernet communication over port 80, which is used for HTTP applications. We will need to use a different port for UDP communication, and we may need to use a UDP specific library, although I am not 100% sure.
After opening a terminal on the Pi using SSH, you can check which devices are connected by typing:
"picocom -b 9600 /dev/serial/by-id/" and pressing tab a few times. Note: the actual baud rate you use is dependent on the Serial object created in the Teensy program running.
Follow the instructions in the "local development" section of the "Programming Teensies Locally and Remotely" document. When you build a Teensy project in platform io, the firmware.hex file will be located within your project directory in ".pio/build/teensy41/firmware.hex"
To upload your hex file to the Pi. Open a terminal on your computer and enter the following command:
"scp [email protected]:/tmp"
Then open a terminal of the Pi using SSH. Upload your hex file to the Teensy with the command:
"tycmd upload --board 11603020 /tmp/"
Test your program by opening a serial connection with:
"picocom -b 9600 /dev/serial/by-id/usb-Teensyduino_USB_Serial_11603020-if00"
Acceptance Criteria
Remotely upload firmware from the Raspberry Pi to the Teensy using SSH
Write a test program for sending and receiving UDP packets between the Teensy 4.1 and a Python application
Upload a test Python program to the Raspberry Pi using "scp", run the program using the python command. Try to send messages between the Python program and Teensy, and verify the messages are being received by having the Teensy program print to the serial monitor. Or you could have the Python program print to the console using print().
The text was updated successfully, but these errors were encountered:
Summary
We will need to communicate over a UDP connection between a Python application connected to our GUI, and a C++ program running on a Teensy 4.1. The Python application is being tested in issue #11 .
We can either make the Teensy 4.1 the UDP server with the Python application the UDP client, or we could make the Teensy a UDP client with the Python application acting as the server. Previously we have used the Teensy as the UDP server.
For examples of a Teensy UDP server, we can look at code from a previous member written for the Teensy 3.6:
https://github.com/albertaloop/T_SWE_2019_2020/blob/cody-obc/Firmware/obc/src/main.cpp
https://github.com/albertaloop/T_SWE_2019_2020/blob/cody-pod-telemetry-program/pod_telemetry_program/main.cpp
There is also a previous issue that was opened on the old repo which links to examples for the 4.1 along with instructions: issue #59
The webserver example provided in that issue is found here: https://github.com/vjmuzik/NativeEthernet/tree/master/examples/WebServer
Also there are instructions for finding the Teeny's MAC address here: https://forum.pjrc.com/threads/62932-Teensy-4-1-MAC-Address
The webserver example is for Ethernet communication over port 80, which is used for HTTP applications. We will need to use a different port for UDP communication, and we may need to use a UDP specific library, although I am not 100% sure.
There are examples of Teensy 4.1 UDP servers mentioned in these forum posts, which may be helpful:
https://forum.pjrc.com/threads/64253-Teensy-4-1-UDP-and-web-server-drop-packets
https://forum.pjrc.com/threads/60857-T4-1-Ethernet-Library/page4
Connecting to remote Pi server to program Teeny's remotely
The first thing that is required for remote development is to download the University Cisco AnyConnect VPN, and use SSH to access the Rasperry Pi at school by follow the instructions here: https://docs.google.com/document/d/1TL32blBIJVRt870pOVqz_mUF7cOXglUmwXIvYclUewg/edit?usp=sharing
Next, you will have to follow the instructions for remote firmware programming here: https://docs.google.com/document/d/1lr8_rNuS0BvXKBEfrXjV6XQpJPV_akC-iO6kcPvfseE/edit?usp=sharing
After opening a terminal on the Pi using SSH, you can check which devices are connected by typing:
"picocom -b 9600 /dev/serial/by-id/" and pressing tab a few times. Note: the actual baud rate you use is dependent on the Serial object created in the Teensy program running.
The two devices currently listed are:
usb-Teensyduino_USB_Serial_11602960-if00
usb-Teensyduino_USB_Serial_11603020-if00
The device connected to the Pi is usb-Teensyduino_USB_Serial_11603020-if00. You can check which hardware is connected to a device from this spreadsheet: https://docs.google.com/spreadsheets/d/1-ZlJaabliIlsx-5mY10GtOopHvoOPvqwuj2UHnMoZSU/edit?usp=sharing
Follow the instructions in the "local development" section of the "Programming Teensies Locally and Remotely" document. When you build a Teensy project in platform io, the firmware.hex file will be located within your project directory in ".pio/build/teensy41/firmware.hex"
To upload your hex file to the Pi. Open a terminal on your computer and enter the following command:
"scp [email protected]:/tmp"
Then open a terminal of the Pi using SSH. Upload your hex file to the Teensy with the command:
"tycmd upload --board 11603020 /tmp/"
Test your program by opening a serial connection with:
"picocom -b 9600 /dev/serial/by-id/usb-Teensyduino_USB_Serial_11603020-if00"
Acceptance Criteria
The text was updated successfully, but these errors were encountered: