Crash on vRingbufferReturnItem

PeterA
Posts: 2
Joined: Mon Sep 25, 2017 9:54 pm

Crash on vRingbufferReturnItem

Postby PeterA » Mon Sep 25, 2017 10:02 pm

Hi all,

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);
    }
 

ESP_Sprite
Posts: 8921
Joined: Thu Nov 26, 2015 4:08 am

Re: Crash on vRingbufferReturnItem

Postby ESP_Sprite » Tue Sep 26, 2017 3:03 am

Can you see if you can get a backtrace from your code, either by running your crash to a backtrace decoder, using gdb, or re-crashing it but looking at the serial port using 'make monitor'?

WiFive
Posts: 3529
Joined: Tue Dec 01, 2015 7:35 am

Re: Crash on vRingbufferReturnItem

Postby WiFive » Tue Sep 26, 2017 4:04 am

If xRingbufferReceive returns null NumElements is not valid so you can't use it as a test ... unless you set it to 0

PeterA
Posts: 2
Joined: Mon Sep 25, 2017 9:54 pm

Re: Crash on vRingbufferReturnItem

Postby PeterA » Thu Sep 28, 2017 10:04 pm

Aha! Thank you WiFive, your are absolutely correct, that has fixed the crash.

It's now mostly working, but I'm getting a sporadic
E (28872) rmt: RMT[2] ERR
E (28872) rmt: status: 0x13080100
when it's getting a lot of toggling on the rx pin.

Are the RMT error codes documented anywhere?

Thank you
Pete

Who is online

Users browsing this forum: No registered users and 142 guests