UART ISR not located in IRAM

fasthands
Posts: 3
Joined: Wed Jul 18, 2018 11:18 am

UART ISR not located in IRAM

Postby fasthands » Wed Jul 18, 2018 11:28 am

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

ESP_Angus
Posts: 2344
Joined: Sun May 08, 2016 4:11 am

Re: UART ISR not located in IRAM

Postby ESP_Angus » Thu Jul 19, 2018 12:28 am

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

fasthands
Posts: 3
Joined: Wed Jul 18, 2018 11:18 am

Re: UART ISR not located in IRAM

Postby fasthands » Thu Jul 19, 2018 8:48 am

Works well thanks for the quick reply.

rahul.b.patel
Posts: 62
Joined: Wed Apr 19, 2017 6:35 am

Re: UART ISR not located in IRAM

Postby rahul.b.patel » Tue Sep 18, 2018 8:07 am

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.

Ritesh
Posts: 1365
Joined: Tue Sep 06, 2016 9:37 am
Location: India
Contact:

Re: UART ISR not located in IRAM

Postby Ritesh » Tue Sep 18, 2018 1:33 pm

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.
Regards,
Ritesh Prajapati

Ritesh
Posts: 1365
Joined: Tue Sep 06, 2016 9:37 am
Location: India
Contact:

Re: UART ISR not located in IRAM

Postby Ritesh » Thu Sep 20, 2018 10:17 am

Hi Espressif Developer,

Any update for last couple of questions which we have posted into this thread?
Regards,
Ritesh Prajapati

Ritesh
Posts: 1365
Joined: Tue Sep 06, 2016 9:37 am
Location: India
Contact:

Re: UART ISR not located in IRAM

Postby Ritesh » Fri Sep 21, 2018 6:25 pm

Hi ESP_Angus,

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

Ritesh
Posts: 1365
Joined: Tue Sep 06, 2016 9:37 am
Location: India
Contact:

Re: UART ISR not located in IRAM

Postby Ritesh » Sat Sep 22, 2018 8:15 am

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
Regards,
Ritesh Prajapati

Ritesh
Posts: 1365
Joined: Tue Sep 06, 2016 9:37 am
Location: India
Contact:

Re: UART ISR not located in IRAM

Postby Ritesh » Sun Sep 23, 2018 4:19 pm

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
Regards,
Ritesh Prajapati

Shcreasey
Posts: 9
Joined: Sun Jul 02, 2017 10:37 pm

Re: UART ISR not located in IRAM

Postby Shcreasey » Mon Sep 24, 2018 12:10 pm

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,
Steve.

Who is online

Users browsing this forum: No registered users and 95 guests