AnsweredAssumed Answered

Issues enabling UART1 on a KL24

Question asked by Luciano Moretti on Apr 20, 2016
Latest reply on Apr 27, 2016 by Luciano Moretti

We've got a device where we want UART1 to be initially disabled, and then selectively enabled and disabled based on another input.  Unfortunately, when I attempt to call the UART_PDD_EnableTransmitter() macro the system ends up crashing.  Tracking into the assembly, when the final store instruction is called to write the UART1_C2 register the value written is not correct and the other UART registers end up corrupted.


Attached are screen grabs from within IAR showing the CPU registers, UART1 registers, and disassembly just prior and just after the execution of the STRB R3, [R0] instruction.


This is the before image, and R0 points to the UART1_C2 register address and R3 holds the expected 0x08 to set the Transmit Enable bit.




Here is the registers after the next step.  All the UART1 registers are now reading 0x20. I also don't understand why my Link Register and Stack Pointer changed as the UART_PDD_EnableTransmitter and UART_PDD_EnableReceiver are Preprocessor macros that are inlined into the ASerialLdd2_Enable() function.



After this, if I attempt to continue to run the system crashes with a "Stopped by a vector catch" issue.