Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for the RADIO peripheral in the COM example #27

Open
mablem8 opened this issue Feb 25, 2023 · 4 comments
Open

Add support for the RADIO peripheral in the COM example #27

mablem8 opened this issue Feb 25, 2023 · 4 comments
Assignees
Milestone

Comments

@mablem8
Copy link
Collaborator

mablem8 commented Feb 25, 2023

  • Implement the COM init_radio function to use the radio peripheral (without BLE mode)
  • When selecting a radio configuration, favor parameters that support low (slow) bitrates and longer-distance communication
  • You will need to reference pages 81-89 of the NRF51 reference manual and the corresponding libopencm3 documentation
@mablem8 mablem8 added this to the Sprint 4 milestone Feb 25, 2023
@alexeyt7
Copy link

Code to initialize the radio, and to send and receive packets has been pushed to https://github.com/CMUAbstract/tab/tree/issue-27-exploratory

@alexeyt7
Copy link

Code works with one COM board set up as transmitter and the other set up as a receiver, bytes get recovered correctly and can be seen on UART. (I hard coded the UART transfer to test, it is currently commented out and needs to be removed later)

@alexeyt7
Copy link

Commit ccb298c adds support for sending TAB commands over radio and the forwarding functions necessary to make this useful. The main file has been adjusted to a demo where one COM board receives the command over UART, then forwards it over RADIO to the next board which again forwards to UART, emulating the progression of a command from GND to the CDH. This gives the following output:

$ python3 tx_example.py /dev/ttyUSB0 
txcmd: common_ack hw_id:0x1234 msg_id:0x0000 src:gnd dst:cdh
reply: common_ack hw_id:0x1234 msg_id:0x0000 src:gnd dst:cdh

txcmd: common_nack hw_id:0x1234 msg_id:0x0001 src:gnd dst:cdh
reply: common_nack hw_id:0x1234 msg_id:0x0001 src:gnd dst:cdh

txcmd: common_debug hw_id:0x1234 msg_id:0x0002 src:gnd dst:cdh "Hello, world!"
reply: common_debug hw_id:0x1234 msg_id:0x0002 src:gnd dst:cdh "Hello, world!"

txcmd: common_data hw_id:0x1234 msg_id:0x0003 src:gnd dst:cdh 0x01 0x02 0x03 0x04 0x05 0x06 0x07 0x08 0x09 0x0a 0x0b
reply: common_data hw_id:0x1234 msg_id:0x0003 src:gnd dst:cdh 0x01 0x02 0x03 0x04 0x05 0x06 0x07 0x08 0x09 0x0a 0x0b

txcmd: common_data hw_id:0x1234 msg_id:0x0004 src:gnd dst:cdh 0x01 0x02 0x03 0x04 0x05 0x06 0x07 0x08 0x0a 0x09 0x0b
reply: common_data hw_id:0x1234 msg_id:0x0004 src:gnd dst:cdh 0x01 0x02 0x03 0x04 0x05 0x06 0x07 0x08 0x0a 0x09 0x0b

txcmd: bootloader_ack hw_id:0x1234 msg_id:0x0005 src:gnd dst:cdh
reply: bootloader_ack hw_id:0x1234 msg_id:0x0005 src:gnd dst:cdh

txcmd: bootloader_nack hw_id:0x1234 msg_id:0x0006 src:gnd dst:cdh
reply: bootloader_nack hw_id:0x1234 msg_id:0x0006 src:gnd dst:cdh

txcmd: bootloader_ping hw_id:0x1234 msg_id:0x0007 src:gnd dst:cdh
reply: bootloader_ping hw_id:0x1234 msg_id:0x0007 src:gnd dst:cdh

txcmd: bootloader_erase hw_id:0x1234 msg_id:0x0008 src:gnd dst:cdh
reply: bootloader_erase hw_id:0x1234 msg_id:0x0008 src:gnd dst:cdh

txcmd: bootloader_write_page hw_id:0x1234 msg_id:0x0009 src:gnd dst:cdh subpage_id:0 hex_data:0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
reply: bootloader_write_page hw_id:0x1234 msg_id:0x0009 src:gnd dst:cdh subpage_id:0 hex_data:0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000

txcmd: bootloader_write_page_addr32 hw_id:0x1234 msg_id:0x000a src:gnd dst:cdh Address: 0x08008000 hex_data:0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
reply: bootloader_write_page_addr32 hw_id:0x1234 msg_id:0x000a src:gnd dst:cdh Address: 0x08008000 hex_data:0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000

txcmd: bootloader_jump hw_id:0x1234 msg_id:0x000b src:gnd dst:cdh
reply: bootloader_jump hw_id:0x1234 msg_id:0x000b src:gnd dst:cdh

@alexeyt7
Copy link

alexeyt7 commented Mar 27, 2023

I also quickly tried experimenting with routing and have a commit (f4d05d5) that appears to work, though the CDH board on the FlatSat is currently unplugged, so I tested with the COM's TX plugged back into my laptop. (So it is not clear if CDH replies get sent back correctly by COM)
However, this does show the radio code supports a command and then ack sequence, meaning the boards support communicating both ways and data does not appear to be lost.

I had the following output:
Successful GND->COM reply:

txcmd: common_ack hw_id:0x1234 msg_id:0x0000 src:gnd dst:com
reply: common_ack hw_id:0x1234 msg_id:0x0000 src:com dst:gnd

Successful GND->CDH forward:

txcmd: common_ack hw_id:0x1234 msg_id:0x0000 src:gnd dst:cdh
reply: common_ack hw_id:0x1234 msg_id:0x0000 src:gnd dst:cdh

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants