2025-01-14 05:52 AM
Hi All,
I need to design an PCB with STM32C011F6 (TSSOP20 package) that will have few inputs, few outputs and an ADC input (0V-3.3V). I have seen the hardware design guide which talks about integrated oscillators of 48MHz and 32Khz but I'm not sure about if I need an external crystal/oscillator and what should be the value of it (i.e. 32KHz or 8 MHz or any other value). I intend to program it via STM32duino Arduino library.
Any suggestion will be very helpful.
Thank you!
Solved! Go to Solution.
2025-01-14 08:01 AM - edited 2025-01-14 08:10 AM
@nitin29 wrote:It also talks about HSI and LSI RC Oscillators which have tolerances.
All oscillators have tolerances - whether external or internal.
The tolerances of external devices are, obviously, up to you - depending on what you specify, and the quality of your design.
The tolerances of the internal oscillators are specified in the datasheet; they are, indeed, "worse" that you could obtain with external devices.
@nitin29 wrote:Now at page 27th, the datasheet talks about pinout and points to PC14-OSCX_IN and PC15-OSCX_OUT. !
Those can serve as IN and OUT for either the High-speed internal oscillator (4-48MHz) or the Low-speed internal oscillator (32kHz) - hence the 'X':
Elsewhere in the document, they are referred to as OSC32_IN/OUT when used for the 32kHz oscillator, and OSC_IN/OUT when used for the 4-48MHz oscillator:
@nitin29 wrote:So, what crystal value I can use so I will not have issue? Will Arduino automatically detect what clock is used or it need a specific clock (HSI or HSE or LSI or LSE) to get it program?
I don't know what STM32Duino/Arduino requires or supports - you'd need to ask on the STM32Duino forum for that:
But, in general, for reliable UART communication you certainly should be using a crystal. Choose one which allows you to generate standard baud rates (9600, 115200, etc) within acceptable errors.
PS:
@nitin29 wrote:having programmed STM32F103C8 generic board (comes with 8 MHz and 32KHz crystal on board)
Note that the STM32F1 had separate pins for OSC_IN, OSC_OUT (4-16MHz) and OSC32_IN, OSC32_OUT (32kHz) :
The sharing of the OSCx_IN/OUT pins is quite a new feature.
2025-01-14 06:12 AM
Not quite sure what you're asking here?
Are you asking about the difference between using an external, active oscillator and just having an external crystal?
For that, see:
Or do you know the difference, but want to know the pros & cons?
Or are you just asking whether the STM32's internal oscillators are sufficient - so that you can dispense with anything external at all?
@nitin29 wrote:I have seen the hardware design guide which talks about integrated oscillators of 48MHz and 32Khz
Do you mean the Application Note AN2867, Guidelines for oscillator design on STM8AF/AL/S and STM32 MCUs/MPUs ?
2025-01-14 07:37 AM
Thank you very much for your link from which I now understand the difference between the two terms. Using the gained knowledge, I rephase my problem for better understanding. Correct me if I'm wrong from this point.
In the datasheet of STM32C011F6 at https://www.st.com/resource/en/datasheet/stm32c011f6.pdf
On 1st page, in clock says about crystal oscillators which I now understand that we need to provide crystal to use HSE and LSE. It also talks about HSI and LSI RC Oscillators which have tolerances. I assume that RC oscillators do not have tight tolerances that crystal oscillators can provide and therefore, should be included in cases where time accuracy is needed with minimum time drift.
Now at page 27th, the datasheet talks about pinout and points to PC14-OSCX_IN and PC15-OSCX_OUT. I assume it is talking about to provide a crystal or an external active oscillator for HSE and LSE as on page number 11 of AN5673: https://www.st.com/resource/en/application_note/an5673-getting-started-with-stm32c0-mcu-hardware-development-stmicroelectronics.pdf
Now having understood the difference and position of the where to provide HSE and LSE source (if I need one).
Intended Applications:
I want to use STM32C011F6 for variety of cases, some require only ADC to measure analog voltage but other need a timer circuit which should measure minutes for a timer and relay application. Do I need a crystal, or can I use the HSI or LSI for above mentioned application too?
Problem:
I want to use STM32duino via Arduino, having programmed STM32F103C8 generic board (comes with 8 MHz and 32KHz crystal on board) I don't remember if I need to care about what crystal the board had in the programming. But now I want to design the board using STM32C011F6 myself and wanted to make sure it will program without issue. I do have few Discovery boards and STM32Cube exposure too, but I want to use STM32duino to leverage Arduino libraries. Arduino does support STM32C011F6 generic board as well as Nucleo board.
So, what crystal value I can use so I will not have issue? Will Arduino automatically detect what clock is used or it need a specific clock (HSI or HSE or LSI or LSE) to get it program?
Sorry for writing that long but I hope, you'll understand the confusion.
Thank you again!
2025-01-14 08:01 AM - edited 2025-01-14 08:10 AM
@nitin29 wrote:It also talks about HSI and LSI RC Oscillators which have tolerances.
All oscillators have tolerances - whether external or internal.
The tolerances of external devices are, obviously, up to you - depending on what you specify, and the quality of your design.
The tolerances of the internal oscillators are specified in the datasheet; they are, indeed, "worse" that you could obtain with external devices.
@nitin29 wrote:Now at page 27th, the datasheet talks about pinout and points to PC14-OSCX_IN and PC15-OSCX_OUT. !
Those can serve as IN and OUT for either the High-speed internal oscillator (4-48MHz) or the Low-speed internal oscillator (32kHz) - hence the 'X':
Elsewhere in the document, they are referred to as OSC32_IN/OUT when used for the 32kHz oscillator, and OSC_IN/OUT when used for the 4-48MHz oscillator:
@nitin29 wrote:So, what crystal value I can use so I will not have issue? Will Arduino automatically detect what clock is used or it need a specific clock (HSI or HSE or LSI or LSE) to get it program?
I don't know what STM32Duino/Arduino requires or supports - you'd need to ask on the STM32Duino forum for that:
But, in general, for reliable UART communication you certainly should be using a crystal. Choose one which allows you to generate standard baud rates (9600, 115200, etc) within acceptable errors.
PS:
@nitin29 wrote:having programmed STM32F103C8 generic board (comes with 8 MHz and 32KHz crystal on board)
Note that the STM32F1 had separate pins for OSC_IN, OSC_OUT (4-16MHz) and OSC32_IN, OSC32_OUT (32kHz) :
The sharing of the OSCx_IN/OUT pins is quite a new feature.