Hello, Im Kiven
I'm trying to connect my KL46Z via serial port to a visual studio application. At first I tried the process using the basics components to make the connection work, and it worked! but when I started trying it in my main project this hard fault came up.
I'm using controls like AsynchroSerial, external interruptions and some timers.
The problem is when I am trying to debug it, I get a Debug Halt telling me that it has been stopped because this interruption:
PE_ISR(Cpu_ivINT_Hard_Fault)
{
/* This code can be changed using the CPU component property "Build Options / Unhandled int code" */
PE_DEBUGHALT();
}
At first
I made every interruption to work with their own handler using this tutorial Oh my! An Interrupt… | MCU on Eclipse to know what was the real problem and thats what I got.
I don't know where to look or what to change. Thanks in advance for your response!
Greetings!
Erich, I have my own design board with a KL04Z8 uC on it. It's brand new, I'm using the internal OSC.
After following your tutorial, I kept receiving this error: Cpu_ivINT_Hard_Fault.
What could go wrong if my project uses only the generated code from PE without any modification? Many thanks!!
Are you using KDS V1.1.1?
Hey Erich, I would like to use KDS indeed, but I wasn't able to configure it to work with this uC properly. I'm using CW 10.6.
I don't have a KL04, so cannot try on my side. But what would be that configuration problem in KDS?
I don't think that the IDE matters, but more probably the linker file/startup code.
Can you step through the startup code to see where it happens?
There is a error with the MEMORY map at the m_data area. This below is the correct configuration:
MEMORY {
m_interrupts (RX) : ORIGIN = 0x00000000, LENGTH = 0x000000C0
m_text (RX) : ORIGIN = 0x00000410, LENGTH = 0x00001BF0
m_data (RW) : ORIGIN = 0x1FFFFF00, LENGTH = 0x00000400
m_cfmprotrom (RX) : ORIGIN = 0x00000400, LENGTH = 0x00000010
}
This thread is related to Is there a bug or fault on Processor Expert for the Kinetis L 04 series? and indeed the linker file generated by Processor Expert/KDS is wrong with a wrong m_data size. I have filed the ticket KDS-171 about this bug.
Erich
The following two articles should help you to find the reason for the hard-fault:
http://mcuoneclipse.com/2012/11/24/debugging-hard-faults-on-arm-cortex-m/
http://mcuoneclipse.com/2012/12/28/a-processor-expert-component-to-help-with-hard-faults/
I have the Hardfault debugging component attached described in the second article.
Erich
Hello Kiven,
When you want to generate one ISR handler for each interrupt vector (to check what ISR cause the problem) select the value "Own handler for very" of "Unhandled vectors" property in the Build options tab in the Component Inspector of the CPU (you have to select the CPU component of the PEx project and open the Component Inspector). See also the screenshot below:
Best Regards,
Marek Neuzil