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 default)
21+ #define SPI_BAUD 10000000 // Default baudrate (4 MHz - SPI default)
2222#define SPI_CS 5
2323#define SPI_MISO 4
2424#define SPI_MOSI 3
2525#define SPI_SCK 2
26- #define MAX_BUFFER_SIZE 1024
27- #define MAX_OPBUF_SIZE 1024
28- #define SERIAL_BUFFER_SIZE 1024
26+ #define MAX_BUFFER_SIZE 256
27+ #define MAX_OPBUF_SIZE 64
28+ #define SERIAL_BUFFER_SIZE 64
2929
3030// Define a global operation buffer and a pointer to track the current position
3131uint8_t opbuf [MAX_OPBUF_SIZE ];
@@ -143,9 +143,9 @@ static void command_loop(void)
143143 sendbyte_blocking (S_ACK );
144144
145145 // Break down MAX_BUFFER_SIZE into three bytes (24 bits) in little-endian format
146- sendbyte_blocking (MAX_BUFFER_SIZE & 0xFF ); // LSB
147- sendbyte_blocking ((MAX_BUFFER_SIZE >> 8 ) & 0xFF ); // Middle byte
148- sendbyte_blocking ((MAX_BUFFER_SIZE >> 16 ) & 0xFF ); // MSB
146+ sendbyte_blocking (32 & 0xFF ); // LSB
147+ sendbyte_blocking ((32 >> 8 ) & 0xFF ); // Middle byte
148+ sendbyte_blocking ((32 >> 16 ) & 0xFF ); // MSB
149149
150150 break ;
151151 }
@@ -164,7 +164,6 @@ static void command_loop(void)
164164 (1 << S_CMD_O_SPIOP ) |
165165 (1 << S_CMD_S_BUSTYPE ) |
166166 (1 << S_CMD_S_SPI_FREQ )|
167- (1 << S_CMD_S_PIN_STATE )|
168167 (1 << S_CMD_R_BYTE )|
169168 (1 << S_CMD_O_WRITEB )|
170169 (1 << S_CMD_O_INIT )|
@@ -275,13 +274,6 @@ static void command_loop(void)
275274 }
276275 break ;
277276 }
278- case S_CMD_S_PIN_STATE :
279- if (readbyte_blocking ())
280- enable_spi (baud );
281- else
282- disable_spi ();
283- sendbyte_blocking (S_ACK );
284- break ;
285277 case S_CMD_R_BYTE :
286278 {
287279 uint32_t addr ;
0 commit comments