Hello, I am using tm4c123g microcontroller(cortex m4) and successfully programmed led blink, created 16x2 and 128x64 library files using CMSIS standard. But when I try to write any value in UART register, it causes the cpu to jump into hard fault. Example UART0->CTL&=~1; triggers the hard fault handler. I am facing this problem with all other UART registers like baud registers.
BTW I am able to do it with direct memory addressing. But I want to use UART funcions in CMSIS. I don't know what's going wrong please help.
Have you tried debugging the Hard Fault to see what, exactly, is causing it?
www.lmgtfy.com
The TM4C is a Texas Instruments (TI) product range. For specific details of what could cause that particular product to Hard-Fault, you should be asking TI.
One thing to check would be whether the UART is properly enabled & ready to use:
- bus interface enabled?
- peripheral clock(s) enabled?
- etc...
Thanks for reply.I tried to debug that fault but still got nothing.The initialization rituals are given in the datasheet and i am following in the same manner.When i write the values using CMSIS standard it triggers the hard fault, but when i use direct memory addressing in the same manner it works fine.So in my opinion it is not something related to unlocking or clocking the IO.
BTW I am going to ask TI too.
Debugging includes verifying exactly what addresses your code tries to access using the two methods. And that should have told you what would differ between direct addressing and indirect addressing using the pointer. But it sounds like your form of debugging was to test run and deduce "works" or "fails" instead of figuring out what actually differs.
View all questions in Keil forum