cancel
Showing results for 
Search instead for 
Did you mean: 

Enabling LSE clock on PA8 from HEX code?

DRich.4
Associate II

I am unable to communicate with the MCU via UART (115200 bit/s). It looks like the program inside MCU is not running. I think the problem can be probably in not running LSE 32.768kHz crystal oscillator.

Is it possible to enable LSE clock on PA8 if I have just the hex file to check it with oscilloscope? SWD via STLINK-V3MINI and STM32CubeProgrammer works great, I was able to upgrade the firmware with easy. I have S76G chip with STM32L07 inside.

12 REPLIES 12

Write a short program which only enables LSE, and make sure it runs (output it to MCO for example and measure there).

Then, if without disconnecting power you load the firmware in question, LSE should keep running, unless that firmware explicitly resets the backup power domain.

A better solution is to load the firmware through a debugger and run it there, and then observing the LSE-related registers and/or manipulating them; but it's not something commonly used and the exact steps will be toolchain dependent.

You may also want to ask the "chip" (module) vendor for help.

JW

ACSIP STM32L073 https://www.richardsonrfpd.com/Products/Product/S76G

24 MHz HSE, would need to have HSE_VALUE defined correctly

Yes, LSE is routable

https://www.st.com/resource/en/reference_manual/dm00095744-ultralowpower-stm32l0x3-advanced-armbased-32bit-mcus-stmicroelectronics.pdf

7.2.14 Clock-out capability The microcontroller clock output (MCO) capability allows the clock to be output onto the external MCO pin using a configurable prescaler (1, 2, 4, 8, or 16). The configuration registers of the corresponding GPIO port must be programmed in alternate function mode. One of 7 clock signals can be selected as the MCO clock: • SYSCLK • HSI16 • HSI48 • MSI • HSE • PLL • LSI • LSE The selection is controlled by the MCOSEL[3:0] bits of the RCC_CFGR register (see Section 7.3.20). For code example, refer to A.4.3: MCO selection code example.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

That's a good idea to write a short program and enable LSE on MCO output and test it. The problem is that I never worked with STM MCU's, I am working with Microchip AVR MCU's ATtiny202 & SAMR34 in MPLAB X IDE and Atmel Studio. I don't know how to write a short program for STM and where. Can I use STM32CubeProgrammer? I assume the STM32L07 MCU is using it's internal HS oscillator.

Actually I don't need to program STM MCU as I am using special S76G chip which includes SX1276 Transceiver, STM32L07 MCU and SONY GPS CXD5603GF. I just need to send a few AT commands via S76G USART, which is not working now, to achieve required functionality I have tested successfully on development system already. The S76G is delivered with firmware already.

I designed my own PCB - Micro Cat Tracker (26.5 x 12 x 1.5 mm; 1 x 1/2 x 1/16 inches) sewn into cat collar. See attached picture.

There is a free license for Keil on ST CM0(+) parts. https://www2.keil.com/stmicroelectronics-stm32/mdk

You could perhaps build/debug code in RAM (0x20000000) if programming the FLASH is not desirable. Perhaps modify the peripheral / RCC registers directly. I think the current STM32 Cube Programmer can give you some register level access if you're willing to walk the chip into the mode/settings you want.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

I think I just need to set the 24 MHz internal clock for STM32L073x and enable LSE output on MCO1 pin (PA8), that's all.

SWD firmware upgrade

gregstm
Senior III

" It looks like the program inside MCU is not running" - if possible - toggle pins, flash leds etc. to check that the code progresses before you even get to enabling the LSE

DRich.4
Associate II

I created test program in STM32CubeIDE, just to enable LSE on MCO PA8 pin and found out the LSE is not running (as I assumed). When I touch crystal by a finger I get random oscillations I catched on attached oscilloscope screenshots.

I don't like to rebuild PSB so I will try to replace the crystal with two CL capacitors by MEMS oscillator and will check the output again.

0693W000004K5CwQAK.png0693W000004K5D7QAK.png 

Clock Configuration picture here

> I will try to replace the crystal with two CL capacitors by MEMS oscillator

Note, that that might require to set the bypass (LSEBYP). I am not sure what happens if you don't do that, and what is the impact on LSERDY - that all might make troubles in the original firmware.

Before you do the hardware change, you might want to play with LSEDRV, and also try to carefully wash/clean the surroundings of the crystal.

JW

DRich.4
Associate II

Maybe the PCB design (4 layers) is responsible for not working LSE. I didn't expect any problems with 32.768 kHz. U3 is TCVCXO oscillator 26 MHz running well (Vpp = 1V).

Crystal used TFX-03 (+/-20ppm, CL=5pF), capacitors 6 pF.

STM32L073x, probably STM32L073CZUx in SiP (System in Package) S76G chip.

0693W000004K6UIQA0.jpg