2024-04-15 05:20 PM - edited 2024-04-16 05:51 PM
Hello All,
I would like some clarification as to how I can verify if the internal clock HSI will run based on what external power input is given.
I had originally found that running the board on external 3.3 v will not allow the HSI clock to be used, and the clocks would only run if I attached USB power. If I removed USB power from the board after power it briefly the clocks would still run even at 3.3 v external power.
From this post https://community.st.com/t5/stm32-mcus-boards-and-hardware/problem-with-3-3v-external-power-delivery-to-my-board/m-p/88516/highlight/true#M14341 I understand that the ST-link needs to be able on some nucleo board to run the HSI clock.
From the NUCLEO-L031K6 board documentation I found this table:
this shows that using a 5 v in will not run the ST Link, however reading further the following section is talked about:
The section doesn't include "running clocks", but I am not sure if the document would explicitly include "running clocks" since it might be an implicit understanding.
Given the above background I have the following questions:
1. Is it indeed that the non activation of an ST-Link is the cause of of the HSI clock not running?
2. How am I able to check if the HSI clock is dependent on something else to be active?
3. Will the HSI clock be active if I power the board using 5 V or only if I use the VIN pin?
4. If usb power is needed to run certain clocks, what clocks can I use with external power?
Any guidance to understand this would be much appreciated.
Thanks
Edit: corrected references to HSI from HSE clock.
Solved! Go to Solution.
2024-04-17 02:00 AM - edited 2024-04-17 02:03 AM
@Mike_ST wrote:SB9 is the reset signal between the ST-LINK and the LSTM32L031.
^^^ This! ^^^
If the ST-Link is not powered, it will drag NRST down - thus keeping the Target in reset!
#STLinkNrst
2024-04-16 09:07 AM
Hello,
>> I would like some clarification as to how I can verify if the internal clock HSE will run based on what external power input is given.
Just to clarify, the HSE is an external clock that need to be given by an external component on PA0 for the L031.
HSI is a 16MHz internal clock that you can use instead of HSE, when the ST-Link is not powered for example.
HSI oscillator is factory trimmed, but precision is what it is.
>> 1. Is it indeed that the non activation of an ST-Link is the cause of of the HSE clock not running?
Yes, and you have to close SB17 so the clock output from the ST-Link can reach PA0 (CK_IN).
Or, if SB17 is open, you can bring an external clock on PA0 pin.
>> 2. How am I able to check if the HSE clock is dependent on something else to be active?
It is better that you check the schematic available here:
https://www.st.com/en/evaluation-tools/nucleo-l031k6.html#cad-resources
The MCO signal will be given by the ST-Link only when it is powered either from the USB connector, either from the VIN pin.
The 5V signal and its pin do not power the ST-Link chip.
>> 3. Will the HSE clock be active if I power the board using 5 V or only if I use the VIN pin?
VIN only, If I wanted to use the 5V pin as power, I would try by removing U6 and connect the pins 2 and 3 (I've never tested)
>> 4. If usb power is needed to run certain clocks, what clocks can I use with external power?
What do you mean by external power ?
If the board is powered from VIN you can use all clocks to run the L031 (HSI/HSE/MSI...).
If the board is powered from +5V or +3V3 pins on the L031, the ST-LINK won't run and you'll get no MCO clock generated, so HSE won't be usable, you be only able to use HSI/MSI.
2024-04-16 09:26 AM
@genmastermega wrote:2. How am I able to check if the HSE clock is dependent on something else to be active?
As @Mike_ST said, look at the schematics for the board.
Also this in the User Manual:
2024-04-16 10:06 AM - edited 2024-04-16 10:07 AM
@genmastermega wrote:NUCLEO-L031K6 board
The microcontroller on that is an STM32L031K6
From the datasheet:
So HSE is not available on that part.
2024-04-16 10:36 AM
You'll need to power and feed the clock from an XO, ie TCXO, not a crystal
The ST-LINK provides a CMOS clock via it's MCO pin.
If in any doubt about what's powered, and what's connected, pull the Schematic and Review It
2024-04-16 06:37 PM
Hello Mike_St,
I want to apologies because I had a "brain fart" then writing the original question. My references to HSE were wrong. I am using HSI for powering the clock signals to my system.
I have the following follow up based on your post:
Looking at the schematics I have concluded that the ST-Link is only going to turn on when the Vin or USB power is given given the below image:
where E5V the power from VIN regulated down to 5 V and where U5V is the usb power provided which is inline with your comments about when the ST-link will turn on.
However, I am having a hard time digesting the rest of your commentary.
Specifically the below comments I feel conflicts with that I saw in my testing:
>>>>>>>>>>>>>>>>>>>>>>
""4. If usb power is needed to run certain clocks, what clocks can I use with external power?
What do you mean by external power ?
If the board is powered from VIN you can use all clocks to run the L031 (HSI/HSE/MSI...).
If the board is powered from +5V or +3V3 pins on the L031, the ST-LINK won't run and you'll get no MCO clock generated, so HSE won't be usable, you be only able to use HSI/MSI."
.>>>>>>>>>>>>>>>>>>>>>
When I was running my system on 3.3 V external my code stopped working. When I plugged in the USB cable then it would work even if I removed it later. I thought this was due to the ST-LINK not running the HSI clock, but from the above it seems like the HSI clock would run and thus my code would work even if I do not have the ST-Link enabled. Am I missing anything on this point?
I understand that the ST-Link will not provide an MCO clock to the MCU but from the below section in the reference manual why would the MCU not work on another clock source such as the HSI?
The below shows my clock configuration for my program:
Is there any issue with my clock configuration?
Let me know your thoughts. Perhaps, I am not understanding the roof of my issue if my statements above are correct.
Thanks
2024-04-16 06:39 PM - edited 2024-04-16 06:41 PM
Hey Tesla DeLorean,
Thank you for your comment.
My apologies but my reference to HSE was incorrect in the original question. I am actually using HSI and receiving the issue of my code not working.
Do you have any insight into that?
Thanks
2024-04-16 07:11 PM
The edit makes us all look like we all responded to the wrong question..
Shouldn't matter how it's powered the MCU should be able to run off MSI or HSI. Although neither are likely to be suitable for USB or CAN due to lack of precision and stability.
2024-04-17 12:38 AM
@genmastermega wrote:I am actually using HSI and receiving the issue of my code not working.
So what does "not working" mean?
Have you used the debugger to see what's actually happening?
Is HSI actually anything to do with the problem at all?
If you're uncertain if HSI is running, try routing the clock to MCO and viewing on a scope:
2024-04-17 01:41 AM
Hello,
>> Is there any issue with my clock configuration?
I don't see anything wrong with the clock configuration.
>> When I was running my system on 3.3 V external my code stopped working.
Please check table 5 of the user manual:
I would try to remove SB14 and SB9.
SB14 isolates the +3V3 from the connected regulators, and SB9 is the reset signal between the ST-LINK and the LSTM32L031.