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)
227227 // Send ACK after handling slen (before reading)
228228 sendbyte_blocking (S_ACK );
229229
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
233231 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 ;
236234
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+ }
239239 cs_deselect (SPI_CS );
240240 break ;
241241 }
You can’t perform that action at this time.
0 commit comments