I started a new project with KDS with PE. I added a PE serial port(UART2) component and it worked as expected.
I start a new project without KDS with PE. In order to cofigure Port0 pin 16 and pin 17 as Uart, I used below code.
PORTE_PCR16 = (uint32_t)((PORTE_PCR16 & (uint32_t)~(uint32_t)(PORT_PCR_ISF_MASK | PORT_PCR_MUX(0x04))) | (uint32_t)(PORT_PCR_MUX(0x03))); |
PORTE_PCR17 = (uint32_t)((PORTE_PCR17 & (uint32_t)~(uint32_t)(PORT_PCR_ISF_MASK | PORT_PCR_MUX(0x04))) | (uint32_t)(PORT_PCR_MUX(0x03))); |
When I debug the code with P&E Micro debugger, within these lines the progran jumps to the "Default_Handler".
I tried "PORTE_PCR16 = 0x300;" and "PORTE_PCR17 = 0x300;" as well but the result is same.
Please any commend.
Solved! Go to Solution.
Hi
Enable the clock to the port in SIM_SCGC5 and then the hard fault will not occur.
Regards
Mark
Hi Hasan,
If you want to use UART2 and PORTE modules, you need enable their clock gates manually first.
The PE has enabled these clock gates automatically.
See below image:
Best Regards,
Robin
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Thanks Robin_Shen ,
Now it work,
Hi
Enable the clock to the port in SIM_SCGC5 and then the hard fault will not occur.
Regards
Mark
Hi Mark Butcher,
It worked when the clock is enabled,
Thanks,