CMUAbstract / tab

TAB reference implementations, examples, and documentation
Other
0 stars 0 forks source link

Add support for UART in the COM example #19

Closed mablem8 closed 1 year ago

mablem8 commented 1 year ago
alexeyt7 commented 1 year ago

Commit https://github.com/CMUAbstract/tab/commit/6e4028b845f65589d956cb2f685aa6a613a9ecca implements init_uart. This was tested with a basic echo program, that successfully returned a message through a serial port

alexeyt7 commented 1 year ago

Commit https://github.com/CMUAbstract/tab/commit/1c2959ae99e222b24eb4ecb4ba255018dd51af29 changes rx_usart1 and tx_usart1 to rx_uart0 and tx_uart0, respectively. reply is also adjusted as it has to start the tx transfer, as uart_start_tx automatically sends the first byte, so calling it at program initialization would cause a garbage byte to be sent. The RXDRDY and TXDRDY event registers have to be manually reset or they will remain true.

alexeyt7 commented 1 year ago

com_monolithic successfully works with https://github.com/CMUAbstract/tab/blob/sprint-3/python-examples/tx/tx_example.py, giving the following output:


alexeyt@desktop ~/code/cmu/tab/python-examples/tx (git)-[sprint-3] % 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:cdh dst:gnd

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

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:cdh dst:gnd "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_ack hw_id:0x1234 msg_id:0x0003 src:cdh dst:gnd

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_nack hw_id:0x1234 msg_id:0x0004 src:cdh dst:gnd

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

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

txcmd: bootloader_ping hw_id:0x1234 msg_id:0x0007 src:gnd dst:cdh
reply: bootloader_ack hw_id:0x1234 msg_id:0x0007 src:cdh dst:gnd reason:0x00(pong)

txcmd: bootloader_erase hw_id:0x1234 msg_id:0x0008 src:gnd dst:cdh
reply: bootloader_nack hw_id:0x1234 msg_id:0x0008 src:cdh dst:gnd``` 
alexeyt7 commented 1 year ago

Closing as UART is now supported and works in the COM example

mablem8 commented 1 year ago

The solution compiles, and the changes look good. Resolution accepted and issue closed.