I'm programming EFM32LG330 to communicate to external module via UART. As I already used USARTs for other purposes choosing LEUART seemed like a good idea as having high speed clock would allow high baud rates.
However, I didn't recognize that LEUART0 shares pins with High Speed External Clock. Nevertheless, I thought routing these pins to other location (#1) should have positive effect. That didn't help - as I enable LEUART0 clock whole system doesn't manage to start up.
My question is: How should I get clock up and running for LEUART0 without having to sacrifice high speed external oscillator? Is it doable at all?
I am not sure I understand your issue or not, do you mean you are checking how to configure the clock source for LEUART peripheral?
Not sure if below KB helps:
My Clock setup function looks like this:
/* Set up High Frequency Crystal Oscillator and Disable RC Oscillator */
CMU_OscillatorEnable( cmuOsc_HFXO, true, true);
CMU_OscillatorEnable( cmuOsc_HFRCO, false, false );
/* Enable clock for HF peripherals */
/* Enable clock for GPIO pins */
/* Enable clock for USART0 module - communication with modem */
/* Enable clock for USART1 module - interface with a computer */
/* Enable clock for USART2 module - I2S compatible interface */
/* Enable clock for LEUART0 module, which is interfacing GNSS module */ /* MCU doesn't work if on */
/* Enable clock for LEUART1 module - interface with a SIM card */
/* Enable clock I2C0 module */
As I run this code, microprocessor freezes. As I comment CMU_ClockEnable for LEUART0, everything other than this UART works fine. I've connected my LEUART connected to PE14 and PE15 external oscillator to PB13 and PB14 which are default pins (position #0) for LEUART0.
You haven't enabled a clock for the LEUART.
The LEUARTs use the LFBCLK source, but you haven't selected a source for the LFBCLK.
By default, the LFACLK and LFBCLK default to the LFRCO (see the CMU_LFCLKSEL register description), but you haven't enabled the LFRCO, so nothing will happen.
Furthermore, synchronization between the HF and LE clock domains is necessary, but you also haven't enabled the HFLE clock (cmuClock_HFLE), so you need to do that.
Take a look at the examples for the LEUART in app note AN0017. They'll show all of the clock enabling/selection steps you need.
I added CMU_ClockEnable(cmuClock_CORELE) and CMU_ClockSelectSet(cmuClock_LFB, cmuSelect_CORELEDIV2), enabled cmuClock_LFA and LFB, but can't find cmuClock_HFLE to sinchronise clock and therefore get slightly slower baud rate. My MCU is EFM32LG330F128
Looked into how HFLE is written and used by my Keil and got to conclusion that such thing is now handled automatically. Also, spotted that I used wrong structure name to set initial parameters of LEUART0. It works now fully as expected.