MCUXpresso IDE v10.1.1 [Build 606] [2018-01-02]
SDK for FRDM-K28F board
I create a new project from the Quickstart Pane.
Mostly default stuff for baremetal app.
I added the ftm driver
I added the shell utility
I change the "Project Options" from Semihost to UART.
Advanced Project Settings I leave to the default setting.
Select "Finish", Build and debug and everything works.
So far so good. Get a printout hello world on the UART port.
I then go to the Project Explorer Window
Select my project
MK28FN2M0xxx15_Project
and then I select the MCUXpresso "button" and I select "Open Pins" in the drop down box.
I then go and select Under Peripheral Signals
FTM 3 ---> CH, 3 PTE8
and
FTM 4 ---> CH, 4 PTE9
And select "Update Project Code"
Then let the default run.
<x> Pins
- board/pin_mux.c
- board/pin_mux.h
Peripherals greyed out.
<x> Clocks
- board/clock_config.c
- board/clock_config.h
Select "OK"
I run the code and WHAMMO.
HardFault_Handler() at semihost_hardfault.c:72 0x174a
<signal handler called>() at 0xfffffff9
LPUART_EnableTx() at fsl_lpuart.h:571 0x5bc
IO_Init() at fsl_io.c:279 0x676
LOG_Init() at fsl_log.c:284 0x77e
DbgConsole_Init() at fsl_debug_console.c:107 0x438
BOARD_InitDebugConsole() at board.c:64 0x4b0c
main() at MK28FN2M0xxx15_Project.c:56 0x1710
Now before I try to dig into this and figure out what the heck is going on, am I doing something stupid??
Thanks.
-Steve
Solved! Go to Solution.
My first question is what project settings got updated? The semihost exception seems to be getting triggered despite the fact you’re not using semihosting - I think. The first thing I’d check is which library you’re linking in. The semihost exceptions are embedded (forgive the pun) in the semihost library version. First make sure you’re linking to a non-semihost library.
Thanks and regards,
MCUXpresso Support
My first question is what project settings got updated? The semihost exception seems to be getting triggered despite the fact you’re not using semihosting - I think. The first thing I’d check is which library you’re linking in. The semihost exceptions are embedded (forgive the pun) in the semihost library version. First make sure you’re linking to a non-semihost library.
Thanks and regards,
MCUXpresso Support
So I've tried all sorts of different clocks.
It's an actual crash I think that's caused because of the following code:
static inline void LPUART_EnableTx(LPUART_Type *base, bool enable)
{
if (enable)
{
base->CTRL |= LPUART_CTRL_TE_MASK;
}
else
{
base->CTRL &= ~LPUART_CTRL_TE_MASK;
}
}
when this line executes
base->CTRL |= LPUART_CTRL_TE_MASK;
It hits the hardfault handler, but even though it says it's the semihost_hardfault function, it realizes that's it's a true hardfault and just sits in a while loop, as you would expect.
I have no idea why the tool is not configuring everything correctly. I want the LPUART, but I never really turned it on. So I checked the clock and it wasn't turned on so I turned it on. Still nothing.. .any help would be appreciated.
And it was a "New Project..." I did not update any project.
Ugh.. sorry... I thought I also told you that I tried all sorts of different libraries to no avail. I even tried using only Semi-hosting libs and calls, still get the crash.
I figured it out... I told you it was something stupid.
I never initialized the LPUART peripheral.. doh!
Once I did that it all worked...
-stv