Reply
Highlighted
Posts: 7
Registered: ‎04-13-2017
Accepted Solution

Unresponsive LEUART0 clock

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?

Posts: 1,869
Registered: ‎10-14-2014

Re: Unresponsive LEUART0 clock

@Arturas

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:

http://community.silabs.com/t5/32-bit-MCU-Knowledge-Base/Use-of-the-HFRCO-or-HFXO-as-the-LEUART-Cloc...

WeiguoLu
Posts: 7
Registered: ‎04-13-2017

Re: Unresponsive LEUART0 clock

My Clock setup function looks like this:

void cmuSetup(void){
    /* Set up High Frequency Crystal Oscillator and Disable RC Oscillator */
    CMU_OscillatorEnable( cmuOsc_HFXO, true, true);
    CMU_ClockSelectSet(cmuClock_HF, cmuSelect_HFXO);
    CMU_OscillatorEnable( cmuOsc_HFRCO, false, false );

  /* Enable clock for HF peripherals */
    CMU_ClockEnable(cmuClock_HFPER, true);

    /* Enable clock for GPIO pins */
    CMU_ClockEnable(cmuClock_GPIO, true);
    /* Enable clock for USART0 module - communication with modem */
    CMU_ClockEnable(cmuClock_USART0, true);
  /* Enable clock for USART1 module - interface with a computer */
  CMU_ClockEnable(cmuClock_USART1, true);
    /* Enable clock for USART2 module - I2S compatible interface */
  CMU_ClockEnable(cmuClock_USART2, true);
    /* Enable clock for LEUART0 module, which is interfacing GNSS module */ /* MCU doesn't work if on */
    CMU_ClockEnable(cmuClock_LEUART0, true);
    /* Enable clock for LEUART1 module - interface with a SIM card */
    CMU_ClockEnable(cmuClock_LEUART1, true);
    /* Enable clock I2C0 module */
    CMU_ClockEnable(cmuClock_I2C0, true);
}

 

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.

Posts: 359
Registered: ‎09-18-2015

Re: Unresponsive LEUART0 clock

Hi @Arturas,

 

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.

 

John

Posts: 7
Registered: ‎04-13-2017

Re: Unresponsive LEUART0 clock

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

Posts: 7
Registered: ‎04-13-2017

Re: Unresponsive LEUART0 clock

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.