RMT in loop mode results in crash, and no looping for 64+ items

meowsqueak
Posts: 42
Joined: Thu Jun 15, 2017 4:54 am

RMT in loop mode results in crash, and no looping for 64+ items

Postby meowsqueak » Wed Sep 20, 2017 8:52 am

I've noticed a crash when using the RMT to generate repeating sequences. In particular I want the RMT to re-execute all the items over and over again, to produce a square wave with known frequency.

However I've noticed that setting the tx_config.loop_en field can cause the application to crash, but only if the number of items in the RMT list is 63 or fewer. Adding a debug function call in a subsequent loop can also cause a crash. Setting the number of items to 64 results in a one-shot of the sequence but with no looping.

I've filed a bug with details here:

https://github.com/espressif/esp-idf/issues/1019

Any idea what's happening?

meowsqueak
Posts: 42
Joined: Thu Jun 15, 2017 4:54 am

Re: RMT in loop mode results in crash, and no looping for 64+ items

Postby meowsqueak » Thu Sep 21, 2017 9:21 am

I think I was getting a stack overflow, which led to the random crashes. Allocating the items memory on the heap made that problem go away (except for 1 item, that seems unstable).

The remaining issue is that for 64 or more items, the loop doesn't occur. It just one-shots the sequence and then goes idle.

Bmillier
Posts: 2
Joined: Sun Aug 13, 2017 12:52 am

Re: RMT in loop mode results in crash, and no looping for 64+ ite

Postby Bmillier » Mon Sep 25, 2017 6:32 pm

I experienced same issue when using RMT transmit , but from Arduino IDE code. The NECSend example from Espressif, I was following used malloc to allocate the item array, but did not include a free(Item) after the call to rmt_write_items. After I added this, the crashing stopped. You have to use the "wait til done" blocking option in the write items call, or the wait til done function call itself, before calling free, of course. In my case, the number of loops X the size of items always equaled a constant value ( around 41000 I believe), so it was obviously a memory leak that eventually started writing to somewhere it shouldn't.

I have no experience programming under the IDF, so pardon me if my post doesn't fit your situation.

Who is online

Users browsing this forum: Bing [Bot], johanan and 12 guests