]> granicus.if.org Git - esp-idf/commitdiff
rmt: Fix LoadProhibited on RX END
authorIng. Jaroslav Šafka <devel@safka.org>
Fri, 2 Mar 2018 21:56:41 +0000 (22:56 +0100)
committerAngus Gratton <gus@projectgus.com>
Mon, 9 Apr 2018 02:29:05 +0000 (12:29 +1000)
Fixes exceptions LoadProhibited, when rmt tries read variable p_rmt on RX END which can be 0.
It happens after esp_reset()  (OTA) and the rmt is not probably stopped by it.
In other words the routine rmt_driver_isr_default was called before second rx channel was registered.

scenario:
register tx channel
register rx channel
reboot
register tx channel
-> exception (because rx channel is accessed)

Merges https://github.com/espressif/esp-idf/pull/1671

components/driver/rmt.c

index 8e7b2a1d01d3b0c40e797645ed985e2172647a8e..046b634ca93d9f51c444bc580c7acae24c7921f3 100644 (file)
@@ -540,6 +540,10 @@ static void IRAM_ATTR rmt_driver_isr_default(void* arg)
             if(intr_st & BIT(i)) {
                 channel = i / 3;
                 rmt_obj_t* p_rmt = p_rmt_obj[channel];
+                if(NULL == p_rmt) {
+                    RMT.int_clr.val = BIT(i);
+                    continue;
+                }
                 switch(i % 3) {
                     //TX END
                     case 0: