Skip to content

Commit e2db97e

Browse files
committed
ensure we are dealing with a 24 bit length
1 parent 24528dd commit e2db97e

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

main.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
#define CDC_ITF 0 // USB CDC interface no
1919

2020
#define SPI_IF spi0 // Which PL022 to use
21-
#define SPI_BAUD 4000000 // Default baudrate (4 MHz - SPI defaultt d)
21+
#define SPI_BAUD 4000000 // Default baudrate (4 MHz - SPI default)
2222
#define SPI_CS 5
2323
#define SPI_MISO 4
2424
#define SPI_MOSI 3
@@ -196,6 +196,8 @@ static void command_loop(void)
196196
uint32_t slen, rlen;
197197
readbytes_blocking(&slen, 3); // Read send length
198198
readbytes_blocking(&rlen, 3); // Read receive length
199+
slen &= 0x00FFFFFF; // Mask to zero out the upper 8 bits
200+
rlen &= 0x00FFFFFF; // Mask to zero out the upper 8 bitsgi
199201

200202
uint8_t tx_buffer[MAX_BUFFER_SIZE]; // Buffer for transmit data
201203
uint8_t rx_buffer[MAX_BUFFER_SIZE]; // Buffer for receive data

0 commit comments

Comments
 (0)