You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@nuttx.apache.org by James Dougherty <ja...@gmail.com> on 2022/08/23 06:09:52 UTC

STM32F103RET6 and HSI

Anyone ever use the HSI on STM32F103, how about RET6? I know the code is
set up for HSE. I got it working, at least UART1.
But now, the other usart devices ... Wondering if anyone has ever run into
UART baud rate mismatches on using HSI? I have a few
radios that work great with an existing driver and a diff design, but not
joy on the F103RET6. I am using internal PLL, x8 (64Mhz)
and 32Mhz (APB1, APB2) if anyone has any debug pointers that would be
great. Its weird, the UART1 uses APB2, and others
use APB1. I know I need the external crystal but I got these boards and no
clock stuffed... (sigh)

thanks!
-james

Re: STM32F103RET6 and HSI

Posted by James Dougherty <ja...@gmail.com>.
HI Alan,

Yes, that is true, some are really good - SAME70 will work that way but no
USB. And yes, MEMS is not there yet.
In this case, my BOM was wrong  - X1 DNP - so I got enough running to make
progress anyhow (tested a lot of HW).

The most interesting aspect of this F103 finding for me is that the system
works, and then suddenly it does not!
Most likely after some burn-in on the device. I noticed this on two systems
which ran overnight  and then suddenly, whammo, they all failed (no NSH).
Then I changed the baud rate ever so slightly and it worked again! Crazy! I
change the code back to 921600, hit it with cold spray - working!
Let it heat up, lock up.

So yes, 50 cents and the problem is solved.

Thank you!
-James









On Tue, Aug 23, 2022 at 5:15 PM Alan Carvalho de Assis <ac...@gmail.com>
wrote:

> I don't know how ST internal oscillator is implemented in silicon, but
> some MCUs have good internal oscillator.
>
> For example the SAMD21 used on Arduino M0 board works fine with NSH
> running at 115200 and it even supports USB console, but I didn't test
> your freezing spray, maybe it could fail too. :-)
>
> This article compares crystal oscillator vs MEMS oscillator:
>
>
> https://www.avnet.com/wps/wcm/connect/onesite/9be4733b-3e9a-4880-8887-7d19ecf34a0e/quartz-crystal-vs-mems-oscillator.pdf
>
> The crystal oscillators are "crystal clear winner" (pun intended).
>
> I agree it is better to pay some cents to include a crystal in the
> board, but unfortunately the capitalism's pressure forces people to
> make mistakes.
>
> BR,
>
> Alan
>
> On 8/23/22, James Dougherty <ja...@gmail.com> wrote:
> > Hi David,
> >
> > Wow. That is precisely what is wrong, you can get yourself a little TRIM
> > and make one of the boards work, but
> > then you would have to hand tune them +/- 1% for every baud rate and
> worse,
> > temperatures. So better to pay the 71
> > cents and put the 8M crystal on the board. For testing I used cold spray
> > and different baud rates to see that it is much
> > worse, probably more like 2% on the megabaud rates. APB1 can't go over
> > 36Mhz or the backplane hangs.
> > PS, the other app note is on 8Mhz HSI and link is here
> >
> https://www.st.com/resource/en/application_note/an2868-stm32f10xxx-internal-rc-oscillator-hsi-calibration-stmicroelectronics.pdf
> >
> > Anyhow, the summary is one may use the HSI for bringup and get NSH on
> > /dev/ttyS0 as /dev/console but for real
> > comms and especially megabaud you need external resonator or crystal and
> > HSE enabled as per default in stmf103-minimum
> >
> > Thank you.
> > -James
> >
> >
> >
> >
> > On Mon, Aug 22, 2022 at 11:55 PM David Sidrane <da...@nscdg.com>
> > wrote:
> >
> >> HSI is not a good choice if there are external interfaces. It can vary
> >> too
> >> much part to part and over temperature to meet the 2% across the system
> >> boundary. They claim 1% @25c but that is 1/2 the budget to begin with,
> >>
> >>
> >>
> https://www.st.com/resource/en/application_note/dm00425536-how-to-optimize-stm32-mcus-internal-rc-oscillator-accuracy-stmicroelectronics.pdf
> >>
> >>
> >>
> >>
> >> On Tue, Aug 23, 2022 at 2:10 AM James Dougherty <ja...@gmail.com>
> >> wrote:
> >>
> >> > Anyone ever use the HSI on STM32F103, how about RET6? I know the code
> >> > is
> >> > set up for HSE. I got it working, at least UART1.
> >> > But now, the other usart devices ... Wondering if anyone has ever run
> >> into
> >> > UART baud rate mismatches on using HSI? I have a few
> >> > radios that work great with an existing driver and a diff design, but
> >> > not
> >> > joy on the F103RET6. I am using internal PLL, x8 (64Mhz)
> >> > and 32Mhz (APB1, APB2) if anyone has any debug pointers that would be
> >> > great. Its weird, the UART1 uses APB2, and others
> >> > use APB1. I know I need the external crystal but I got these boards
> and
> >> no
> >> > clock stuffed... (sigh)
> >> >
> >> > thanks!
> >> > -james
> >> >
> >>
> >
>

Re: STM32F103RET6 and HSI

Posted by Alan Carvalho de Assis <ac...@gmail.com>.
I don't know how ST internal oscillator is implemented in silicon, but
some MCUs have good internal oscillator.

For example the SAMD21 used on Arduino M0 board works fine with NSH
running at 115200 and it even supports USB console, but I didn't test
your freezing spray, maybe it could fail too. :-)

This article compares crystal oscillator vs MEMS oscillator:

https://www.avnet.com/wps/wcm/connect/onesite/9be4733b-3e9a-4880-8887-7d19ecf34a0e/quartz-crystal-vs-mems-oscillator.pdf

The crystal oscillators are "crystal clear winner" (pun intended).

I agree it is better to pay some cents to include a crystal in the
board, but unfortunately the capitalism's pressure forces people to
make mistakes.

BR,

Alan

On 8/23/22, James Dougherty <ja...@gmail.com> wrote:
> Hi David,
>
> Wow. That is precisely what is wrong, you can get yourself a little TRIM
> and make one of the boards work, but
> then you would have to hand tune them +/- 1% for every baud rate and worse,
> temperatures. So better to pay the 71
> cents and put the 8M crystal on the board. For testing I used cold spray
> and different baud rates to see that it is much
> worse, probably more like 2% on the megabaud rates. APB1 can't go over
> 36Mhz or the backplane hangs.
> PS, the other app note is on 8Mhz HSI and link is here
> https://www.st.com/resource/en/application_note/an2868-stm32f10xxx-internal-rc-oscillator-hsi-calibration-stmicroelectronics.pdf
>
> Anyhow, the summary is one may use the HSI for bringup and get NSH on
> /dev/ttyS0 as /dev/console but for real
> comms and especially megabaud you need external resonator or crystal and
> HSE enabled as per default in stmf103-minimum
>
> Thank you.
> -James
>
>
>
>
> On Mon, Aug 22, 2022 at 11:55 PM David Sidrane <da...@nscdg.com>
> wrote:
>
>> HSI is not a good choice if there are external interfaces. It can vary
>> too
>> much part to part and over temperature to meet the 2% across the system
>> boundary. They claim 1% @25c but that is 1/2 the budget to begin with,
>>
>>
>> https://www.st.com/resource/en/application_note/dm00425536-how-to-optimize-stm32-mcus-internal-rc-oscillator-accuracy-stmicroelectronics.pdf
>>
>>
>>
>>
>> On Tue, Aug 23, 2022 at 2:10 AM James Dougherty <ja...@gmail.com>
>> wrote:
>>
>> > Anyone ever use the HSI on STM32F103, how about RET6? I know the code
>> > is
>> > set up for HSE. I got it working, at least UART1.
>> > But now, the other usart devices ... Wondering if anyone has ever run
>> into
>> > UART baud rate mismatches on using HSI? I have a few
>> > radios that work great with an existing driver and a diff design, but
>> > not
>> > joy on the F103RET6. I am using internal PLL, x8 (64Mhz)
>> > and 32Mhz (APB1, APB2) if anyone has any debug pointers that would be
>> > great. Its weird, the UART1 uses APB2, and others
>> > use APB1. I know I need the external crystal but I got these boards and
>> no
>> > clock stuffed... (sigh)
>> >
>> > thanks!
>> > -james
>> >
>>
>

Re: STM32F103RET6 and HSI

Posted by James Dougherty <ja...@gmail.com>.
Hi David,

Wow. That is precisely what is wrong, you can get yourself a little TRIM
and make one of the boards work, but
then you would have to hand tune them +/- 1% for every baud rate and worse,
temperatures. So better to pay the 71
cents and put the 8M crystal on the board. For testing I used cold spray
and different baud rates to see that it is much
worse, probably more like 2% on the megabaud rates. APB1 can't go over
36Mhz or the backplane hangs.
PS, the other app note is on 8Mhz HSI and link is here
https://www.st.com/resource/en/application_note/an2868-stm32f10xxx-internal-rc-oscillator-hsi-calibration-stmicroelectronics.pdf

Anyhow, the summary is one may use the HSI for bringup and get NSH on
/dev/ttyS0 as /dev/console but for real
comms and especially megabaud you need external resonator or crystal and
HSE enabled as per default in stmf103-minimum

Thank you.
-James




On Mon, Aug 22, 2022 at 11:55 PM David Sidrane <da...@nscdg.com>
wrote:

> HSI is not a good choice if there are external interfaces. It can vary too
> much part to part and over temperature to meet the 2% across the system
> boundary. They claim 1% @25c but that is 1/2 the budget to begin with,
>
>
> https://www.st.com/resource/en/application_note/dm00425536-how-to-optimize-stm32-mcus-internal-rc-oscillator-accuracy-stmicroelectronics.pdf
>
>
>
>
> On Tue, Aug 23, 2022 at 2:10 AM James Dougherty <ja...@gmail.com> wrote:
>
> > Anyone ever use the HSI on STM32F103, how about RET6? I know the code is
> > set up for HSE. I got it working, at least UART1.
> > But now, the other usart devices ... Wondering if anyone has ever run
> into
> > UART baud rate mismatches on using HSI? I have a few
> > radios that work great with an existing driver and a diff design, but not
> > joy on the F103RET6. I am using internal PLL, x8 (64Mhz)
> > and 32Mhz (APB1, APB2) if anyone has any debug pointers that would be
> > great. Its weird, the UART1 uses APB2, and others
> > use APB1. I know I need the external crystal but I got these boards and
> no
> > clock stuffed... (sigh)
> >
> > thanks!
> > -james
> >
>

Re: STM32F103RET6 and HSI

Posted by David Sidrane <da...@nscdg.com>.
HSI is not a good choice if there are external interfaces. It can vary too
much part to part and over temperature to meet the 2% across the system
boundary. They claim 1% @25c but that is 1/2 the budget to begin with,

https://www.st.com/resource/en/application_note/dm00425536-how-to-optimize-stm32-mcus-internal-rc-oscillator-accuracy-stmicroelectronics.pdf




On Tue, Aug 23, 2022 at 2:10 AM James Dougherty <ja...@gmail.com> wrote:

> Anyone ever use the HSI on STM32F103, how about RET6? I know the code is
> set up for HSE. I got it working, at least UART1.
> But now, the other usart devices ... Wondering if anyone has ever run into
> UART baud rate mismatches on using HSI? I have a few
> radios that work great with an existing driver and a diff design, but not
> joy on the F103RET6. I am using internal PLL, x8 (64Mhz)
> and 32Mhz (APB1, APB2) if anyone has any debug pointers that would be
> great. Its weird, the UART1 uses APB2, and others
> use APB1. I know I need the external crystal but I got these boards and no
> clock stuffed... (sigh)
>
> thanks!
> -james
>