Page 1 of 2

UART ISR not located in IRAM

Posted: Wed Jul 18, 2018 11:28 am
by fasthands
What are the reason why the ESP IDF uart handler code does not put the ISR into IRAM.

In the latest documentation (http://esp-idf.readthedocs.io/en/latest ... /uart.html) it states: "Do not set ESP_INTR_FLAG_IRAM here (the driver’s ISR handler is not located in IRAM)"

Is there any technical reason why I shouldn't modify esp-idf/components/driver/uart.c and set all functions to have IRAM_ATTR.

I want to do this as I need to still service the UART ISR when writing to flash as such need all the UART code to be located in IRAM. I'm just wondering if the code specifically doesn't use IRAM for a silicon bug work around.

Regards

Re: UART ISR not located in IRAM

Posted: Thu Jul 19, 2018 12:28 am
by ESP_Angus
Hi fasthands,

No, I think this is just a chosen tradeoff due to the amount of code which needs moving to IRAM.

We have some features coming in future IDF versions which will make it easier to configure which code is moved into IRAM, but you should be able to modify uart.c now to do this. Just take care that all functions called by the ISR are also moved to IRAM, or you may get a crash at runtime.

(One sure-fire way to get them all is to edit the linker script components/esp32/esp32.common.ld instead, and specify that all of uart.o in libdriver.a sections .text/.rodata go to IRAM/DRAM. If you look into this file then you'll see a lot of other object files are already specified in this way. Note that this will use more IRAM because all UART functions go to IRAM, but if you have free IRAM in your project then this may not be a problem.)

Angus

Re: UART ISR not located in IRAM

Posted: Thu Jul 19, 2018 8:48 am
by fasthands
Works well thanks for the quick reply.

Re: UART ISR not located in IRAM

Posted: Tue Sep 18, 2018 8:07 am
by rahul.b.patel
ESP_Angus wrote: No, I think this is just a chosen tradeoff due to the amount of code which needs moving to IRAM.

We have some features coming in future IDF versions which will make it easier to configure which code is moved into IRAM, but you should be able to modify uart.c now to do this. Just take care that all functions called by the ISR are also moved to IRAM, or you may get a crash at runtime.

(One sure-fire way to get them all is to edit the linker script components/esp32/esp32.common.ld instead, and specify that all of uart.o in libdriver.a sections .text/.rodata go to IRAM/DRAM. If you look into this file then you'll see a lot of other object files are already specified in this way. Note that this will use more IRAM because all UART functions go to IRAM, but if you have free IRAM in your project then this may not be a problem.)

Angus
Hi Angus,
I am facing issue while data communication of UART1 with every 10ms data is been received and same time my application access flash. I am getting fifo over flow at this time. Its not coming while flash is not being accessed while uart data is being read.
I did above solution and now no fifo overflow issue is reproducing.

So my concern is that, will this solution affect to any other functionalities in regression ? I have also created issue on github as below link,

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

And can you tell me when you guys are planning to add features to configures which code is moved into IRAM.?

Thanks.

Re: UART ISR not located in IRAM

Posted: Tue Sep 18, 2018 1:33 pm
by Ritesh
Hi Espressif Support Team,

I am working with Rahul for ESP32 related products and we are in critical stage for issue which he has mentioned into last post. So, Would you guys check and provide feedback for same?

Let us know if need any details regarding same from our side.

Re: UART ISR not located in IRAM

Posted: Thu Sep 20, 2018 10:17 am
by Ritesh
Hi Espressif Developer,

Any update for last couple of questions which we have posted into this thread?

Re: UART ISR not located in IRAM

Posted: Fri Sep 21, 2018 6:25 pm
by Ritesh
Hi ESP_Angus,

Would you please check and let me know if need anything else from my side?

Re: UART ISR not located in IRAM

Posted: Sat Sep 22, 2018 8:15 am
by Ritesh
Hi ESP_Angus,

Did you get chance to look into details which We have asked earlier like below?
Hi Angus,
I am facing issue while data communication of UART1 with every 10ms data is been received and same time my application access flash. I am getting fifo over flow at this time. Its not coming while flash is not being accessed while uart data is being read.
I did above solution and now no fifo overflow issue is reproducing.

So my concern is that, will this solution affect to any other functionalities in regression ? I have also created issue on github as below link,

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

And can you tell me when you guys are planning to add features to configures which code is moved into IRAM.?
Hope you have sufficient information regarding same or let me know if you need any detail for that

Re: UART ISR not located in IRAM

Posted: Sun Sep 23, 2018 4:19 pm
by Ritesh
Hi Espressif Developer,

Would you please check few couple of posts which I have Rahul Patel have sent regarding this issue? We are in critical stage in one of our product w.r.t. this issue and looking for proper solution for that.

Let me know if need any more details regarding this from our side so that we can provide you as much as possible from our side regarding this

Re: UART ISR not located in IRAM

Posted: Mon Sep 24, 2018 12:10 pm
by Shcreasey
Hi @ESP_Angus

Would it be safe to only place functions in IRAM that are called by enabled interrupts?

For example if the pattern match interrupt is disabled can these functions be excluded safely from IRAM etc?

Thanks,