How to use external clock with STM32L011
I am trying to use an external 8MHz clock with the STM32L011. I generate the clock using the MCO output on a STM32Nucleo-L476 board, and connect it to a STM32Nucleo-L011 board on its PA0 pi (A0 on the Nucleo's CN4 connector). I used STM32CubeMX to generate the code for the L476 to generate the clock. The clock works fine, providing a very good 3.3 volt, 8 MHz square wave as seen on my 200 MHz oscilloscope.
The code for the Nucleo L011 was generated by STM32CubeMX as well. The clock configuration has the HSE clock selected to provide SYSCLK, and the MCO output has SYSCLK selected for output with a divider of 1.
The inner "while(1)" loop contains a simple bit toggle with a 1-second period. That works fine as long as the external clock is not connected or the L476 board is in RESET so that its MCO output is disabled. The output frequency on the L011 MCO pin is 2.102 MHz; presumably this is the LSI oscillator providing the clock.
However, when the external clock is present on the Nucleo L011, the bit toggle loop does not run. I see the 8 MHz external clock on the PA0 pin of the MPU chip, but the the toggling does not work and the L011 MCO output shows a ground level only.
I have confirmed this action many times with different software each time. I have read the examples, adapted some of them to test this, read the reference manual and read the data sheet. I am at my wit's end.
Can someone help, please? My project requires the two processors to be synchronized.
Best regards,
Peter