timer bug stm32f411VE

Moderator: Benj

User avatar
LeighM
Matrix Staff
Posts: 2178
Joined: Tue Jan 17, 2012 10:07 am
Has thanked: 481 times
Been thanked: 699 times
Contact:

Re: timer bug stm32f411VE

Post by LeighM »

Sorry, only just noticed your post.
Have you tried Channel 1, as well as Channel 2?
Also, have you tried address 0x38 in the initialise?

Alkaline
Posts: 143
Joined: Mon Aug 20, 2018 11:04 am
Has thanked: 42 times
Been thanked: 41 times
Contact:

Re: timer bug stm32f411VE

Post by Alkaline »

Hi LeighM

I have tried various combinations without success.

Pins pb10 and pb11 are for both channel 1 and channel 2.

I have tried both 0x38 and 0x70.

The sda ​​pin always remains high, therefore the clock never starts.

Do you want me to try using other pins besides pb10 and pb11?

User avatar
LeighM
Matrix Staff
Posts: 2178
Joined: Tue Jan 17, 2012 10:07 am
Has thanked: 481 times
Been thanked: 699 times
Contact:

Re: timer bug stm32f411VE

Post by LeighM »

Thanks for the feedback.
Looks like I have missed something.
I will try and dig out some hardware and give it a test.

Alkaline
Posts: 143
Joined: Mon Aug 20, 2018 11:04 am
Has thanked: 42 times
Been thanked: 41 times
Contact:

Re: timer bug stm32f411VE

Post by Alkaline »

LeighM wrote:Thanks for the feedback.
Looks like I have missed something.
I will try and dig out some hardware and give it a test.
Hi LeighM

Any updates?

Regards

User avatar
LeighM
Matrix Staff
Posts: 2178
Joined: Tue Jan 17, 2012 10:07 am
Has thanked: 481 times
Been thanked: 699 times
Contact:

Re: timer bug stm32f411VE

Post by LeighM »

Hi,
Yes, I've fixed it, but haven't yet made it into the office to update the system :(
I'll dig out the files and attach them here, just a mo ...

Please try these ..
STARM_CAL_I2C.c to go into C:\ProgramData\MatrixTSL\FlowcodeV8\CAL\STARM
32F030R8.fcdx to go into C:\ProgramData\MatrixTSL\FlowcodeV8\FCD\ARM
Attachments
STARM_CAL_I2C.c
(22.5 KiB) Downloaded 153 times
32F030R8.fcdx
(31.12 KiB) Downloaded 142 times

Alkaline
Posts: 143
Joined: Mon Aug 20, 2018 11:04 am
Has thanked: 42 times
Been thanked: 41 times
Contact:

Re: timer bug stm32f411VE

Post by Alkaline »

Hi leigh

This afternoon I will try it.

I'm trying to get as much equipment out of the office as possible so I can debug at home and continue development!

User avatar
LeighM
Matrix Staff
Posts: 2178
Joined: Tue Jan 17, 2012 10:07 am
Has thanked: 481 times
Been thanked: 699 times
Contact:

Re: timer bug stm32f411VE

Post by LeighM »

OK, thanks.
I've just remembered that you are using the RC, so here's an updated FCD for that.
I recently spotted some 'gotcha' small print in the datasheet!
Attachments
32F030RC.fcdx
(35.51 KiB) Downloaded 136 times

Alkaline
Posts: 143
Joined: Mon Aug 20, 2018 11:04 am
Has thanked: 42 times
Been thanked: 41 times
Contact:

Re: timer bug stm32f411VE

Post by Alkaline »

Hi LeighM

If I select channel 2 with any pin the compiler reports this error.

No error however if I select channel 1.
Device STM32F030xC



C~1>arm-none-eabi-gcc -mcpu=cortex-m0 -mthumb -mfloat-abi=soft -D__SOFTFP__ -Os -DSTM32 -DSTM32F0 -DSTM32F030xC -DUSE_HAL_DRIVER -DHSE_VALUE=30000000 -IC:\PROGRA~2\Flowcode\Common\COMPIL~1\starm\batch\..\stm32cubeF0\Drivers\CMSIS\Include -IC:\PROGRA~2\Flowcode\Common\COMPIL~1\starm\batch\..\stm32cubeF0\Drivers\CMSIS\Device\ST\STM32F0xx\Include -IC:\PROGRA~2\Flowcode\Common\COMPIL~1\starm\batch\..\stm32cubeF0\Drivers\STM32F0xx_HAL_Driver\Inc -IC:\PROGRA~2\Flowcode\Common\COMPIL~1\starm\batch\..\stm32cubeF0\Drivers\STM32F0xx_HAL_Driver\Inc\Legacy -IC:\PROGRA~2\Flowcode\Common\COMPIL~1\starm\batch\..\inc -fmessage-length=0 -fdata-sections -ffunction-sections -w -c "Test_i2c_HW.c" -o "Test_i2c_HW_STM32F030xC_30000000\Test_i2c_HW.o"
In file included from C:\ProgramData\MatrixTSL\FlowcodeV8\CAL\includes.c:434:0,
from Test_i2c_HW.c:137:
C:\ProgramData\MatrixTSL\FlowcodeV8\CAL\STARM\STARM_CAL_I2C.c: In function 'FC_CAL_I2C_Transaction_Init_1':
C:\ProgramData\MatrixTSL\FlowcodeV8\CAL\STARM\STARM_CAL_I2C.c:503:42: error: 'RCC_PERIPHCLK_I2C2' undeclared (first use in this function)
PeriphClkInit.PeriphClockSelection = RCC_PERIPHCLK_I2C2;
^
C:\ProgramData\MatrixTSL\FlowcodeV8\CAL\STARM\STARM_CAL_I2C.c:503:42: note: each undeclared identifier is reported only once for each function it appears in
C:\ProgramData\MatrixTSL\FlowcodeV8\CAL\STARM\STARM_CAL_I2C.c:504:40: error: 'RCC_I2C2CLKSOURCE_HSI' undeclared (first use in this function)
PeriphClkInit.I2c1ClockSelection = RCC_I2C2CLKSOURCE_HSI;
^
Error(s) in build

C:\Program Files (x86)\Flowcode\Common\Compilers\starm\batch\stm32comp.bat reported error code 1

User avatar
LeighM
Matrix Staff
Posts: 2178
Joined: Tue Jan 17, 2012 10:07 am
Has thanked: 481 times
Been thanked: 699 times
Contact:

Re: timer bug stm32f411VE

Post by LeighM »

OK, thanks, I'll investigate

Alkaline
Posts: 143
Joined: Mon Aug 20, 2018 11:04 am
Has thanked: 42 times
Been thanked: 41 times
Contact:

Re: timer bug stm32f411VE

Post by Alkaline »

LeighM wrote:OK, thanks, I'll investigate
Thanks LeighM

As you know in Italy there is a complete lock-down.

At this moment I managed to bring home as much material as possible but the board I work on has the pins of the i2c2 on pb10 and pb11.

If you think it would be useful to check the other channels too, let me know that I find a way to solder two pins.

Regards

User avatar
LeighM
Matrix Staff
Posts: 2178
Joined: Tue Jan 17, 2012 10:07 am
Has thanked: 481 times
Been thanked: 699 times
Contact:

Re: timer bug stm32f411VE

Post by LeighM »

Yes, coronavirus is hitting everything, stay safe
Here's an updated file to try, to go into C:\ProgramData\MatrixTSL\FlowcodeV8\CAL\STARM
Attachments
STARM_CAL_I2C.c
(22.21 KiB) Downloaded 149 times

Alkaline
Posts: 143
Joined: Mon Aug 20, 2018 11:04 am
Has thanked: 42 times
Been thanked: 41 times
Contact:

Re: timer bug stm32f411VE

Post by Alkaline »

The errors at the time of compilation have disappeared but unfortunately it does not work.

For double chek I tried to write using the cal i2c software and it worked. ( the same pin )

User avatar
LeighM
Matrix Staff
Posts: 2178
Joined: Tue Jan 17, 2012 10:07 am
Has thanked: 481 times
Been thanked: 699 times
Contact:

Re: timer bug stm32f411VE

Post by LeighM »

Thanks for your tests.
I now have channel 2 working :D
please use attached files
Thanks,
Leigh
Attachments
STARM_CAL_I2C.c
(22.25 KiB) Downloaded 116 times
32F030RC.fcdx
(35.51 KiB) Downloaded 109 times
32F030R8.fcdx
(31.26 KiB) Downloaded 89 times
32F030Nucleo64.fcdx
(29.26 KiB) Downloaded 96 times

Alkaline
Posts: 143
Joined: Mon Aug 20, 2018 11:04 am
Has thanked: 42 times
Been thanked: 41 times
Contact:

Re: timer bug stm32f411VE

Post by Alkaline »

LeighM wrote:Thanks for your tests.
I now have channel 2 working :D
please use attached files
Thanks,
Leigh
HI Leigh

I confirm that I also have the signal. :D :D :D

Only thing is the clock pin scl. If you set 100Khz on flowocode on the oscilloscope, it displays about 500Khz!, If I set 400 Khz the signal goes to over 1 Mhz

User avatar
LeighM
Matrix Staff
Posts: 2178
Joined: Tue Jan 17, 2012 10:07 am
Has thanked: 481 times
Been thanked: 699 times
Contact:

Re: timer bug stm32f411VE

Post by LeighM »

Thanks for the info.
Yes, getting the timing correct is tricky, it depends on the clock config settings.
Can you live with that for now in your project?
I will have to have a longer term think about how we get Flowcode to understand the clock settings.
Thanks
Leigh

Alkaline
Posts: 143
Joined: Mon Aug 20, 2018 11:04 am
Has thanked: 42 times
Been thanked: 41 times
Contact:

Re: timer bug stm32f411VE

Post by Alkaline »

For sure.
500 khz is more than enough!
in the next few days I will try to program the dsp and check that everything is working properly.
I am checking the sda ​​pin and the transmission seems correct!
I'll update you as soon as I can program the dsp!

edit:
I don't know if you know this st tool, in case it might help
Attachments
en.stsw-stm32126.zip
(241.57 KiB) Downloaded 96 times

Alkaline
Posts: 143
Joined: Mon Aug 20, 2018 11:04 am
Has thanked: 42 times
Been thanked: 41 times
Contact:

Re: timer bug stm32f411VE

Post by Alkaline »

Hi Leigh

I managed to program the DSP!

Furthermore, I did some tests with the i2c timing calculation file and the starm_I2c file.

If I go to assign the value generated through the spreadsheet to MX_I2C_HANDLE_X.Init.Timing I get the correct i2c clock.

For example with my clock to generate 400 Khz I have to set this value 0x00901A53.

How can I assign this value directly via flowcode (for example with a c icon) without having to edit the STARM_I2C_c file?

User avatar
LeighM
Matrix Staff
Posts: 2178
Joined: Tue Jan 17, 2012 10:07 am
Has thanked: 481 times
Been thanked: 699 times
Contact:

Re: timer bug stm32f411VE

Post by LeighM »

Ah, well done!
Thanks for the update.
How can I assign this value directly via flowcode (for example with a c icon) without having to edit the STARM_I2C_c file?
I will have a think on that one

Alkaline
Posts: 143
Joined: Mon Aug 20, 2018 11:04 am
Has thanked: 42 times
Been thanked: 41 times
Contact:

Re: timer bug stm32f411VE

Post by Alkaline »

Benj wrote:Hello,

Turning off toggle CS property should help a little bit.

I can see another potential optimisation we could do. I'll have a crack at it for you and see how I get on.
Hi Benj

I tried to do what you suggested but the speed didn't improve.

I notice that from the moment of POWER ON to the beginning of the writing on the display almost 2 seconds pass comparable with the time it takes the macro clear.
edit:I checked the compiled c code and the display init macro contains the clear command responsible for the delay.

User avatar
LeighM
Matrix Staff
Posts: 2178
Joined: Tue Jan 17, 2012 10:07 am
Has thanked: 481 times
Been thanked: 699 times
Contact:

Re: timer bug stm32f411VE

Post by LeighM »

For example with my clock to generate 400 Khz I have to set this value 0x00901A53.
How can I assign this value directly via flowcode (for example with a c icon) without having to edit the STARM_I2C_c file?
Making this user configurable is a long term job, so I've updated our version to match your value.
This should be available at some point in the auto update system. (Ben is currently doing this when he can get access)

Post Reply