how to debug illegal_bp

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

how to debug illegal_bp

833 Views
xianyu
Contributor II

146054_146054.pngpastedImage_0.png

when the file"MY_ADC.TXT"is not exist,the program run normal. but when than file is exist,illegal_bp come out and my 128 reset.

but when I only do CH376FileCreate(/*a Name*/),this program run regular,so I think there is nothing wrong with this function.

follow is the code of Openfile

146055_146055.pngpastedImage_1.png

146056_146056.pngpastedImage_2.png146057_146057.pngpastedImage_3.png146058_146058.pngpastedImage_4.png146059_146059.pngpastedImage_5.png146060_146060.pngpastedImage_6.png146061_146061.pngpastedImage_7.png

 

those functions dosent have interrupt. I dont know why do the file create after file open the program will illegal_bp.

and Can I send some commands in Command window to find where is wrong?

146062_146062.pngpastedImage_8.png

Original Attachment has been moved to: xs128_ch376s.zip

Labels (1)
0 Kudos
Reply
1 Reply

531 Views
RadekS
NXP Employee
NXP Employee

Hi 崇锐 卢,

In fact, the illegal_bp means that debugger gets lost. A typical case is unexpected interrupt or reset of MCU.

1. Please disconnect external watchdog RESET and disable internal watchdog if any used.

2. Please check voltage levels at IRQ, XIRQ pins. There should be logical 1 (e.g. 5V).

3. Use attached interrupt catcher example code for detection of unexpected interrupts.

Interrupt catcher you can use for debugging or directly in your software. Few general notes:

a) You should replace lines for expected interrupt by your interrupts routines as in an example of SCI0 interrupt routine.

b) All interrupt vectors are only 16bit addresses, therefore, all your interrupt routines must be placed in non banked memory (for example by #pragma commands)

c) Interrupt number 0 presents POR reset vector, 1 is CM reset, 2 is COP reset, … , 119 is Spurious Interrupt. Interrupt number = (0xFE-Vector Address)/2. See Table Interrupt Vector Locations at RM. For Example: Interrupt number of SCI0 = (0xFE-D6)/2 = 0x14 = 20.

4. Please check the stability of your bus clock (ECLK pin) and stability of power supply voltage(s).

5. Please check stack usage for stack overflow – this is my personal tip for a potential root cause. You could simply try increase stack (in prm file) or use watermark technique - reset MCU, fill RAM at the stack by some known pattern, let the code run and check how big part of the stack was used.


I hope it helps you.

Have a great day,
RadekS

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos
Reply