CMUAbstract / tab

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

Add support for per-command LED toggle to the COM example #18

Closed mablem8 closed 1 year ago

mablem8 commented 1 year ago

In the TAB loop, toggle the LEDs (one lit, the other dark) each time the COM board sends a reply. You will need to leverage something similar to this termination condition in the LED toggle code.

AbhishekCMU commented 1 year ago

Commit Hash: 701c81d

Fixes for Issue 18

Added L14 in com_monolithic.c

Added L30, L31, for LED initial state and L42 to L45, for LED Toggle on TAB command received at UART in com_monolithic.c

Testing Result: LED toggles on TAB command received at COM UART Rx

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

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

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

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

mablem8 commented 1 year ago

The solution compiles, and it will likely work in practice as the program is currently written. However, triggering on rx_cmd_buff.state == RX_CMD_BUFF_STATE_COMPLETE actually toggles the LED upon reception of a complete command instead of transmission of a reply.

I recommend toggling the LEDs after closing the UART TX session here.

AbhishekCMU commented 1 year ago

Commit Hash: 2ef04ef

Fixes for Issue 18 - LED toggle on UART transmit

Added L14 to include libopencm3 nrf gpio library in com_monolithic.c

Added L30, L31, for LED initial state

Added L136 to L140 for LED Toggle on TAB command transmit at UART Tx in com.c

Testing Result: LED toggles on TAB command transmit the reply at COM UART Tx

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

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

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

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

mablem8 commented 1 year ago

Is there a particular reason why you are not toggling inside of this conditional expression? That expression is designed to close a transmit session after sending all bytes in a reply.

When you include test script output in a comment, wrap the output as a code block (start and end with three ` characters). For LED toggling, the test output does not indicate whether the LED actually toggled, so there is no need to include it (instead, I'll compile and flash the code and observe the LED behavior directly). It’s more valuable to show test output if the commit has changed the output or if it’s useful to compare against for some other reason when pulling and executing the commit code.

AbhishekCMU commented 1 year ago

Commit Hash: 52761ea

Fixes for Issue 18 - LED toggle on UART transmit closed

Added L143 , L144 for LED Toggle on TAB command transmit and UART Tx closed in com.c

mablem8 commented 1 year ago

The solution compiles. Resolution accepted and issue closed.