I am using Arduino IDE for programming. Using SPI.Slave function for receiving data on ESP side
problem is that when transferring data with delay(5000 ms) than the data is received fine, but using less delay like 100 ms its only receive about 1800 bytes instead of 10kb
nrf side sending
uint32_t wifiSpiWrite(uint8_t *txBuf, uint32_t len)
{
uint32_t ret = SPI_SUCCESS;
ret = nrf_drv_spi_transfer(&spi_2, txBuf, len, NULL, 0);
return ret;
}
wifiSpiWrite(NotifyData,34);
if(imageByteCount >= 10230 ) // when sent 10kb then send this
{
imageByteCount = 0;
wifiMod.firstData[0] = 0x02;
wifiMod.firstData[1] = 0x00;
for(int i =2; i<34;i++)
{
wifiMod.firstData[i] = 0x06; // when data is complete then send this
}
wifiSpiWrite(wifiMod.firstData, 34);
for (int i = 0; i < 34; i++)
{
wifiMod.rxBuff[i] = 0;
}
nrf_delay_ms(100); // so that spi can write and send
}
}
ESP side receiving
initialize of SPI
hspi_slave_begin(0, this); // for 4M mode
SPISlave.onData([](uint8_t * data, size_t len)
{
if (data[0] == 0x02 )
{
Serial.printf("- - Value of index1 %d \n",index1);
memcpy(&Event_Data[index1],&data[1],31);
index1 += 31;
}
}
Output of above
- - Value of index1 32
- - Value of index1 63
- - Value of index1 94
- - Value of index1 125
- - Value of index1 156
- - Value of index1 187
- - Value of index1 218
- - Value of index1 249
- - Value of index1 280
- - Value of index1 311
- - Value of index1 342
- - Value of index1 373
- - Value of index1 404
- - Value of index1 435
- - Value of index1 466
- - Value of index1 497
- - Value of index1 528
- - Value of index1 559
- - Value of index1 590
- - Value of index1 621
- - Value of index1 652
- - Value of index1 683
- - Value of index1 714
- - Value of index1 745
- - Value of index1 776
- - Value of index1 807
- - Value of index1 838
- - Value of index1 869
- - Value of index1 900
- - Value of index1 931
- - Value of index1 962
- - Value of index1 993
- - Value of index1 1024
- - Value of index1 1055
- - Value of index1 1086
- - Value of index1 1117
- - Value of index1 1148
- - Value of index1 1179
- - Value of index1 1210
- - Value of index1 1241
- - Value of index1 1272
- - Value of index1 1303
- - Value of index1 1334
- - Value of index1 1365
- - Value of index1 1396
- - Value of index1 1427
- - Value of index1 1458
- - Value of index1 1489
- - Value of index1 1520
- - Value of index1 1551
- - Value of index1 1582
- - Value of index1 1613
- - Value of index1 1644
- - Value of index1 1675
- - Value of index1 1706
- - Value of index1 1737
- - Value of index1 1768
- - Value of index1 1799
- - Value of index1 1830
- - Value of index1 1861
- - Value of index1 1892
thanks in Advance