Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
8 years, 11 months ago.
Use EXTAL0 and XTAL0 pins in UART mode
Hi, I'm using the MKL25Z128's MCG in FEI mode (internal clock source), so I'm trying to repurpose the EXTAL0 and XTAL0 pins for serial communication (UART1). The problem is that as soon as I declare the serial instance, the code stops working;
Serial serial(PTA19, PTA18);
I tried to change the pin mux directly to ALT3 but it doesn't seem to work:
PORTA->PCR[19] = PORT_PCR_MUX(3);
DigitalIn and DigitalOut do work with those pins, so I'm guessing it is something inside the Serial library that is affecting the behaviour?
Any help would be greatly appreciated.
Cheers,
Alex
After some debugging of the Serial library I realised that the PTA18 and PTA19 pins are not part of the PinMap structures (PinMap_UART_RX and PinMap_UART_TX respectively).
The solution was just to add both pins and their respective ALT mode (3 in this case) to the PeripheralsPins.c file.
Hope this helps someone else.
Regards,
Alex.
posted by Alexander Agudelo 01 Nov 2015