Evaluation boards arrived from STM

The official STMicroelectronics Arduino core
User avatar
RogerClark
Posts: 5470
Joined: Mon Apr 27, 2015 10:36 am
Location: Melbourne, Australia
Contact:

Re: Evaluation boards arrived from STM

Postby RogerClark » Mon Oct 03, 2016 9:50 pm

BTW.

I've posted an update to the Dhrystone thread, but the board is indeed defaulting to 64Mhz in the original library.

This makes it only marginally faster than the F103 @72Mz

I think we will need to add an errata page to the wiki, to say that the Nucleo L476 Arduino core runs at 64Mhz and not the published frequency (on the packaging of 80Mhz)

I guess I could build 2 different libs and allow the user to select between 64 and 80mhz but I think we have more important things to spend our time on.

User avatar
GrumpyOldPizza
Posts: 170
Joined: Fri Apr 15, 2016 4:15 pm
Location: Denver, CO

Re: Evaluation boards arrived from STM

Postby GrumpyOldPizza » Mon Oct 03, 2016 9:50 pm

RogerClark wrote:Why wont I2C work at 80MHz?

does it end up going to fast ?


Because the I2C timings are hardcoded in that case to 64MHz (or APB1/APB2 clock, like a few select other things).

User avatar
RogerClark
Posts: 5470
Joined: Mon Apr 27, 2015 10:36 am
Location: Melbourne, Australia
Contact:

Re: Evaluation boards arrived from STM

Postby RogerClark » Mon Oct 03, 2016 10:02 pm

Ah

OK

So if the ENABLE_HIGH_SPEED macro was use in the I2C code, to adjust the settings, it could be made to work ?

User avatar
martinayotte
Posts: 1163
Joined: Mon Apr 27, 2015 1:45 pm

Re: Evaluation boards arrived from STM

Postby martinayotte » Mon Oct 03, 2016 10:34 pm

Would that means it can still be running, but instead of 100KHz, it would be 125KHz ?
Same thing for 400KHz, it will becomes 500KHz ?
For most devices, it should be a problem.

User avatar
RogerClark
Posts: 5470
Joined: Mon Apr 27, 2015 10:36 am
Location: Melbourne, Australia
Contact:

Re: Evaluation boards arrived from STM

Postby RogerClark » Mon Oct 03, 2016 10:40 pm

Wi6Labs seem to have defaulted the SPI to 1Mhz (for 64Mhz clock) but I"m not sure what I2C speed the chose

I'm not sure why Wi6Labs chose 1Mhz SPI when the AVR default is DIV_4 of 16Mhz = 4Mhz. I think it should probably be defaulted to the same as AVR for compatibility, but thats something for the SPI library not these PLL settings

Same thing with I2C really, except I've no idea what speed they chose, and I don't know (without googling) what the default AVR I2C speed is.
I presume its 100kHz

User avatar
Slammer
Posts: 241
Joined: Tue Mar 01, 2016 10:35 pm
Location: Athens, Greece

Re: Evaluation boards arrived from STM

Postby Slammer » Tue Oct 04, 2016 1:10 am

In this case the definition of ENABLE_HIGH_SPEED must alter the initialization of the I2C.... This is strange because HALMX is supposed to read the current clock frequency and make the proper adjustments in initialization of I2C and other peripherals....

User avatar
RogerClark
Posts: 5470
Joined: Mon Apr 27, 2015 10:36 am
Location: Melbourne, Australia
Contact:

Re: Evaluation boards arrived from STM

Postby RogerClark » Tue Oct 04, 2016 1:18 am

Slammer wrote:In this case the definition of ENABLE_HIGH_SPEED must alter the initialization of the I2C.... This is strange because HALMX is supposed to read the current clock frequency and make the proper adjustments in initialization of I2C and other peripherals....


I have not looked at their I2C implementation.

But I agree, ideally it should check the clock frequency and adjust the speed to suit the clock.

User avatar
GrumpyOldPizza
Posts: 170
Joined: Fri Apr 15, 2016 4:15 pm
Location: Denver, CO

Re: Evaluation boards arrived from STM

Postby GrumpyOldPizza » Tue Oct 04, 2016 12:13 pm

Slammer wrote:In this case the definition of ENABLE_HIGH_SPEED must alter the initialization of the I2C.... This is strange because HALMX is supposed to read the current clock frequency and make the proper adjustments in initialization of I2C and other peripherals....


Actually no. The HAL is not that abstract there. For some device it seems that you can just pass in the speed that you want (and it calculates stuff behind your back for the right setup). For some how that are derived from the newer FMP+ I2C core, you need to pass in explicit timing parameters to make it work. Just as a fun side note, the values in the databook are highly questionable, and I found quite a bunch of I2C devices that would refuse to work. Perhaps that's just a problem with higher APB clocks.

User avatar
GrumpyOldPizza
Posts: 170
Joined: Fri Apr 15, 2016 4:15 pm
Location: Denver, CO

Re: Evaluation boards arrived from STM

Postby GrumpyOldPizza » Tue Oct 04, 2016 12:14 pm

RogerClark wrote:Wi6Labs seem to have defaulted the SPI to 1Mhz (for 64Mhz clock) but I"m not sure what I2C speed the chose

I'm not sure why Wi6Labs chose 1Mhz SPI when the AVR default is DIV_4 of 16Mhz = 4Mhz. I think it should probably be defaulted to the same as AVR for compatibility, but thats something for the SPI library not these PLL settings

Same thing with I2C really, except I've no idea what speed they chose, and I don't know (without googling) what the default AVR I2C speed is.
I presume its 100kHz


SPI default is 4MHz and I2C default is 100kHz.

User avatar
Wi6Labs
Posts: 16
Joined: Fri Sep 16, 2016 11:39 am
Location: Rennes, France
Contact:

Re: Evaluation boards arrived from STM

Postby Wi6Labs » Tue Oct 04, 2016 2:26 pm

GrumpyOldPizza wrote:
Actually no. The HAL is not that abstract there. For some device it seems that you can just pass in the speed that you want (and it calculates stuff behind your back for the right setup). For some how that are derived from the newer FMP+ I2C core, you need to pass in explicit timing parameters to make it work. Just as a fun side note, the values in the databook are highly questionable, and I found quite a bunch of I2C devices that would refuse to work. Perhaps that's just a problem with higher APB clocks.


Indeed the I2C clock configuration for L4 doesn't work like F1. You must calculated for each speed a specific parameter which depends on the system clock.
You can find more information inside the file "twi.h".
Wi6Labs team


Return to “STM Core”

Who is online

Users browsing this forum: Bing [Bot] and 1 guest