IllegalInstructionCause in system_get_os_print
IllegalInstructionCause in system_get_os_print
Postby gailu » Sat Sep 03, 2016 1:58 pm
We are using ESP12-E successfully for some time and are devices are deployed in field. We are facing random crashes when prints are enabled in the firmware. Following are the details.
Crash Logs:
Fatal exception 0(IllegalInstructionCause):
epc1=0x40201c10, epc2=0x00000000, epc3=0x00000000, excvaddr=0x00000000, depc=0x00000000
ets Jan 8 2013,rst cause:2, boot mode:(3,7)
load 0x40100000, len 1396, room 16
We checked the address epc1 address 0x40201c10 in user1.4096.new.4.S and following is the details from symbol file
40201c10 <system_get_os_print>:
40201c10: fffb21 l32r a2, 40201bfc <spi_flash_set_read_func+0x8>
40201c13: 000222 l8ui a2, a2, 0
40201c16: f00d ret.n
40201c18: feb344 excw
40201c1b: 3f .byte 0x3f
40201c1c: 1cec bnez.n a12, 40201c41 <system_get_os_print+0x31>
40201c1e: 404020 excw
40201c21: 402327 blt a3, a2, 40201c65 <system_get_os_print+0x55>
40201c24: b3ec bnez.n a3, 40201c53 <system_get_os_print+0x43>
...
Can you please suggest how to fix this crash
We are using SDK 1.4
Looking forward to your expert advice as some of our live devices are impacted by this.
Re: IllegalInstructionCause in system_get_os_print
Postby pratik » Mon Sep 05, 2016 10:03 am
Illegal Instruction error is almost always caused by data corruption in flash or glitches in power supply that affect flash read operation. So you should look at the FOTA (update) process for your product if you have implemented that. Make sure that is not the cause of the problem.
Erasing the flash completely, then reprogramming the application may also help. I have an article on that here:
http://www.pratikpanda.com/completely-f ... sh-memory/
As for power glitches - it may happen when you are printing stuff out. Make sure your device power supply is properly decoupled and there are weak pullups or pulldowns on ESP8266 pins, wherever necessary. Typically, one would not use a resistor lower than 10K for pull-up/down. You could also debug by reducing flash access speed to below 40MHz.
Personally, I have only encountered this type of exception with the above 2 causes only. Also, if your firmware writes too often to the flash memory... note that the flash write cycles are limited and the flash may not function properly around the end of its serviceable cycles.
Re: IllegalInstructionCause in system_get_os_print
Postby gailu » Mon Sep 05, 2016 1:20 pm
Re: IllegalInstructionCause in system_get_os_print
Postby gailu » Mon Sep 05, 2016 3:16 pm
I hope someone from espressif team must have an answer to it I believe crash is really a serious issue.
Re: IllegalInstructionCause in system_get_os_print
Postby pratik » Tue Sep 06, 2016 9:54 pm
Does this also occur with other SDK versions? v.1.4 is not the latest and this might have been resolved in subsequent versions. I am assuming you are using the RTOS version of the SDK?
It might be the print function then. I will inform a firmware developer to get back to you on this.
Thanks for using the ESP8266 in your design!
Re: IllegalInstructionCause in system_get_os_print
Postby gailu » Wed Sep 07, 2016 7:28 pm
It is not possible to provide complete source code of our IP otherwise I would have shared it in the first post itself. We have relays in our hardware and we see that it crashes when os_printf is called while switching relays ON/OFF probably some disturbances but not able to nail down problem.
I am wondering if system_get_os_print or other print functions uses ICACHE_FLASH_ATTR and can I implement printf without this attribute?
Re: IllegalInstructionCause in system_get_os_print
Postby pratik » Thu Sep 08, 2016 12:02 pm
If you feel relays have something to do with this, please scope the power rails of the ESP8266 module when the relay is triggered. Use AC coupling and see if relay triggering affects the power rails too much. 10% tolerance is what you should have on the power rails to the module.
Other troubleshooting steps:
- Use a separate power source for the relay temporarily to see if things work any better.
- Make sure you are using an appropriate diode to suppress freewheeling current around relay circuitry. Not having this will definitely cause problems.
You can implement your own print functions using the UART registers directly, in which case you can have the function send characters directly without APIs and completely reside in iRAM instead of iCACHE.
Attached is UART register summary in case you want to do it that way.
- Attachments
-
- 8f-esp8266_interface_uart_registers_v0.1.xls
- UART register bitmap and descriptions
- (36 KiB) Downloaded 530 times
Who is online
Users browsing this forum: No registered users and 336 guests
Login
Newbies Start Here
Are you new to ESP8266?
Unsure what to do?
Dunno where to start?
Start right here!
Latest SDK
Documentation
Complete listing of the official ESP8266 related documentation release by ESPRESSIF!
Must read here!
- All times are UTC+08:00
- Top
- Delete all board cookies
About Us
Espressif Systems is a fabless semiconductor company providing cutting-edge low power WiFi SoCs and wireless solutions for wireless communications and Internet of Things applications. We are the manufacturer of ESP8266EX.