summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--can.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/can.c b/can.c
index 16b66a0..5cc879a 100644
--- a/can.c
+++ b/can.c
@@ -191,13 +191,22 @@ static void can_int(void)
if (canintf & 0x80 || canintf & 0x04) {
uint8_t txb0ctrl;
spi_ss(0);
- spi_wrrd(0x03);
- spi_wrrd(0x30);
+ spi_wrrd(MCP2515_READ);
+ spi_wrrd(A_TXB0CTRL);
txb0ctrl = spi_wrrd(0xff);
spi_ss(1);
uart_puts("can: TXB0CTRL ");
uart_puthex(txb0ctrl);
uart_puts("\n");
+
+ /* clear RTS */
+ if (txb0ctrl & 0x08) {
+ spi_ss(0);
+ spi_wrrd(MCP2515_WRITE);
+ spi_wrrd(A_TXB0CTRL);
+ spi_wrrd(0x00);
+ spi_ss(1);
+ }
}
if (canintf & 0x01)
can_rxh(0);