File tree Expand file tree Collapse file tree 1 file changed +7
-7
lines changed Expand file tree Collapse file tree 1 file changed +7
-7
lines changed Original file line number Diff line number Diff line change @@ -227,15 +227,15 @@ static void command_loop(void)
227
227
// Send ACK after handling slen (before reading)
228
228
sendbyte_blocking (S_ACK );
229
229
230
- // Handle receive operation in chunks
231
- uint32_t chunk_size = (rlen < MAX_BUFFER_SIZE ) ? rlen : MAX_BUFFER_SIZE ;
232
-
230
+ // Handle receive operation in chunks for large rlen
233
231
cs_select (SPI_CS );
234
- spi_read_blocking ( SPI_IF , 0 , rx_buffer , chunk_size );
235
- cs_deselect ( SPI_CS ) ;
232
+ while ( rlen > 0 ) {
233
+ uint32_t chunk_size = ( rlen < MAX_BUFFER_SIZE ) ? rlen : MAX_BUFFER_SIZE ;
236
234
237
- sendbytes_blocking (rx_buffer , chunk_size );
238
- rlen -= chunk_size ;
235
+ spi_read_blocking (SPI_IF , 0 , rx_buffer , chunk_size );
236
+ sendbytes_blocking (rx_buffer , chunk_size );
237
+ rlen -= chunk_size ;
238
+ }
239
239
cs_deselect (SPI_CS );
240
240
break ;
241
241
}
You can’t perform that action at this time.
0 commit comments