I am trying to use the RMT peripheral to calculate speed from a motors hall sensor (max speed approx 350Hz).
I get plausible results if do xRingbufferReceive with ticks_to_wait=portMAX_DELAY, but obviously the latency of my speed calculations are too high.
If I change the ticks_to_wait to 10, I get a Guru Meditation Error of type LoadProhibited occurred on core 0. Exception was unhandled.
Register dump:
PC : 0x400d12e2 PS : 0x00060130 A0 : 0x800d1333 A1 : 0x3ffdeb90
A2 : 0x00000000 A3 : 0x3ffc2a6c A4 : 0x00000000 A5 : 0x00000000
A6 : 0x7fff7fff A7 : 0x00000000 A8 : 0x00000128 A9 : 0x3ffdeb70
A10 : 0x00000000 A11 : 0x3ffdeb90 A12 : 0x0000000a A13 : 0x3ffcd090
A14 : 0x3ffc1860 A15 : 0x00060020 SAR : 0x00000000 EXCCAUSE: 0x0000001c
EXCVADDR: 0x00000000 LBEG : 0x00000000 LEND : 0x00000000 LCOUNT : 0x00000000
Backtrace: 0x400d12e2:0x3ffdeb90 0x400d1333:0x3ffdebc0
CPU halted.
Code snippet of inside the calculate speed task below.
Any thoughts?
Thank you!
Pete
Code: Select all
if(NULL != HallLRMTHandle)
{
bool EndOfDat = false;
//Data = xRingbufferReceive(HallLRMTHandle, &NumElements, portMAX_DELAY);
Data = xRingbufferReceive(HallLRMTHandle, &NumElements, 10);
Dat = (rmt_item32_t *)Data;
int i = 0;
while((i < NumElements) && (false == EndOfDat))
{
/* Check if record is used */
if((0 == Dat[i].duration0) && (0 == Dat[i].duration1))
{
EndOfDat = true;
}
else
{
// Do something with our data
}
i++;
}
if(Data)
{
vRingbufferReturnItem(HallLRMTHandle, Data);
}