Page 1 of 2

timer bug stm32f411VE

Posted: Tue Feb 04, 2020 7:22 pm
by Alkaline
Hello

I'm trying to implement a timer inside the program but when I go to compile it gives me the following error
Project LCD_2
Device STM32F411xE


Z:\>arm-none-eabi-gcc -mcpu=cortex-m4 -mthumb -mfloat-abi=hard -mfpu=fpv4-sp-d16 -Os -DSTM32 -DSTM32F4 -DSTM32F411xE -DUSE_HAL_DRIVER -DHSE_VALUE=16000000 -IC:\PROGRA~2\Flowcode\Common\COMPIL~1\starm\batch\..\stm32cubeF4\Drivers\CMSIS\Include -IC:\PROGRA~2\Flowcode\Common\COMPIL~1\starm\batch\..\stm32cubeF4\Drivers\CMSIS\Device\ST\STM32F4xx\Include -IC:\PROGRA~2\Flowcode\Common\COMPIL~1\starm\batch\..\stm32cubeF4\Drivers\STM32F4xx_HAL_Driver\Inc -IC:\PROGRA~2\Flowcode\Common\COMPIL~1\starm\batch\..\stm32cubeF4\Drivers\STM32F4xx_HAL_Driver\Inc\Legacy -IC:\PROGRA~2\Flowcode\Common\COMPIL~1\starm\batch\..\inc -fmessage-length=0 -fdata-sections -ffunction-sections -w -c "LCD_2.c" -o "LCD_2_STM32F411xE_16000000\LCD_2.o"
LCD_2.c:7350:2: error: expected '=', ',', ';', 'asm' or '__attribute__' at end of input
Error(s) in build

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

If I try to use an interrupt associated with a timer, I compile without errors but the interrupt event never occurs

any suggestions?

Regards

Re: timer bug stm32f411VE

Posted: Wed Feb 05, 2020 8:37 am
by LeighM
Hi,
Could you post the program? Or an example that gives the error?
Thanks

Re: timer bug stm32f411VE

Posted: Thu Feb 06, 2020 9:40 am
by Alkaline
Hi LeighM

Re: timer bug stm32f411VE

Posted: Thu Feb 06, 2020 10:24 am
by LeighM
Hi,
The issue is coming from the Timer component (on the Dashboard)
You can remove it, as it looks like it is not yet compatible with STM32 devices.

As a work around you could use the HAL_GetTick() function which returns the number of milliseconds elapsed since startup
So for example if you have a global ULong variable TIME_NOW you can get a snapshot of the counter with a C icon code

Code: Select all

FCV_TIME_NOW = HAL_GetTick();
 
I will have a chat with Ben sometime and see if we can do anything with the Timer component.

Re: timer bug stm32f411VE

Posted: Thu Feb 06, 2020 7:05 pm
by Alkaline
Hi LeighM

but what can you tell me about the interrupt associated with the timer?

As explained in the mail, the interrupt associated with the timer does not occur.

I also tried to change the timer but it doesn't change the result.

The compilation does not give any errors

Regards

Re: timer bug stm32f411VE

Posted: Fri Feb 07, 2020 9:26 am
by LeighM
The Timer component measures the passage of time. It uses a device timer to do that.
However, it looks like the Timer component is not currently supported by us on the STM32 devices.
I will have a chat with Ben and see if between us we can get this fixed.
I suggested that you remove it from your program because it does not yet work on STM32
and also you are not actually using any functions of the Timer component anyway.

In your program you have enabled a Timer Interrupt.
This is a separate functionality and nothing to do with the Timer component.
So, as you have it, the Timer Interrupt can be used to call your macro1 periodically.
You don’t need the Timer component.

In theory, to do something periodically, you could either do this on a timer interrupt
OR measure time and compare with an elapse period to then call the periodic process.

Hope that helps
Leigh

edit:
If you have now removed the Timer component and are just using the Timer Interrupt, then the next issue is working out the timer properties (prescale and rollover) to give you the required period. The Flowcode dialog box does not calculate these correctly for STM, for lots of reasons.
Also, I would suspect that you are unlikely to get a low enough interrupt rate for the time consuming display code in macro1. So you are likely to need a counter within macro1. Better still, just set a flag (or counter) within the interrupt, then test the flag in your main loop and call the display code from there.
If you need any more help with the timer values, let me know.

Having said all that, for slow periodic functions such as updating the display, you would likely be best reading the Systick timer value in your main and calculating elapsed time.

Re: timer bug stm32f411VE

Posted: Fri Feb 07, 2020 10:05 am
by LeighM
Oh, forgot to mention, the continuous loop in the interrupt macro1 needs removing :wink:

Here is an example of using GetTick ...

Re: timer bug stm32f411VE

Posted: Fri Feb 07, 2020 12:45 pm
by LeighM
Hi,
I've created a new STM32 Timer component, now in the update system.
Here is an example of how to use it ...

Re: timer bug stm32f411VE

Posted: Fri Feb 07, 2020 1:02 pm
by Alkaline
Thanks for the quick support.

In the coming weeks I will try to bring a project currently developed for pic32 on this new microcontroller.

If you have other problems I will let you know.

Regards

Re: timer bug stm32f411VE

Posted: Sun Feb 09, 2020 10:04 pm
by Alkaline
Hi LeighM
I'm finishing the schematic of the pcb.
The peripherals that I will use are i2c master, I have seen that it works in software mode and for me it is ok.
The hardware peripherals that I will have to use are the following
PWM (PA0 port) ( to control the backlight of an LCD display)
USART1 (PA9-PA10) ( Bootloader)
USART 2 (PA2-PA3) ( to control external HW)
Do you see any problems with these pins?
From flowocode they are all selectable so theoretically I should be able to use them!
I also discovered that the STM32F411RCT6 mcu it is pintopin compatible with mcu STM32F030RCT6 also supported by flowcode.
I have tried the uart bootloader and it works perfectly.
I will implement a circuit with FT234XD-R chip to allow programming via USB!

Re: timer bug stm32f411VE

Posted: Mon Feb 10, 2020 9:13 am
by LeighM
Hi,
Yes, that should all be fine :D
The USART bootloader is a very useful feature, I’ve used this myself on several projects.
Just don’t forget to add a selection link to the BOOT0 pin :wink:

Re: timer bug stm32f411VE

Posted: Thu Mar 05, 2020 10:10 am
by Alkaline
Finally I managed to have the pcb and I am testing the new MCU.

uart bootloader ok!
I2c ok!

I'm having an anomaly regarding the display. The speed with which the clearDisplay performs is slow compared to the others macro.

Can you do anything to improve the cleardisplay speed?

Re: timer bug stm32f411VE

Posted: Thu Mar 05, 2020 10:25 am
by LeighM
The gLCD ILI9341 ClearDisplay?
Ben is the gLCD wiz, might have some thoughts on that

edit: I've checked your system clock settings and they look OK, the 411 is running near max speed

Re: timer bug stm32f411VE

Posted: Thu Mar 05, 2020 10:45 am
by Alkaline
the loading of bitmap images is fast,
the clear display instead is a little slower, just as if I have to fill the whole area with a rectangle of color.

Re: timer bug stm32f411VE

Posted: Thu Mar 05, 2020 11:55 am
by Benj
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.

Re: timer bug stm32f411VE

Posted: Thu Mar 05, 2020 3:53 pm
by Alkaline
Another question.
I2c Works at around 100Khz. Is it possible to somehow bring it to 400Khz or 1Mhz?

Re: timer bug stm32f411VE

Posted: Fri Mar 06, 2020 1:37 pm
by LeighM
For the software mode we get the state delay from an internal clock counter with a resolution of ~1uS
So around 400KHz should be achievable, but not 1MHz
Did you try the component baud selector?

Re: timer bug stm32f411VE

Posted: Fri Mar 06, 2020 2:24 pm
by Alkaline
LeighM wrote:For the software mode we get the state delay from an internal clock counter with a resolution of ~1uS
So around 400KHz should be achievable, but not 1MHz
Did you try the component baud selector?
Yes, I tried to change but it doesn't change the speed.
I am seeing that the problem is present both on the STM32f411VE chip and on the chip STM32F030RC

Re: timer bug stm32f411VE

Posted: Fri Mar 06, 2020 3:17 pm
by LeighM
Strange, I tested on a Nucleo 446 and got close to 400KHz.
I’ve had a look at the datasheet and found that the device hardware I2C does not support 1MHz either.
So even if we put the effort into writing a hardware driver it is not going to achieve much improvement.

Re: timer bug stm32f411VE

Posted: Fri Mar 06, 2020 3:40 pm
by Alkaline
I'm currently going with an stm32f030rc.
I can't go beyond 119Khz. If I could reach 400 Khz it would be great

Re: timer bug stm32f411VE

Posted: Tue Mar 10, 2020 11:57 am
by Alkaline
Hi LeighM

any updates regarding I2c?

Kind Regards

Re: timer bug stm32f411VE

Posted: Tue Mar 10, 2020 1:13 pm
by LeighM
In software mode we are limited by the resolution of the systick timer.
I will try and find some time to get more progress for hardware support

Re: timer bug stm32f411VE

Posted: Tue Mar 10, 2020 2:30 pm
by Alkaline
Thanks for the update.

Re: timer bug stm32f411VE

Posted: Wed Mar 11, 2020 10:40 am
by LeighM
I’ve now completed some code to support hardware I2C, initially for your 32F030RC
Files that have been updated are:
STARM_CAL_I2C.c (C:\ProgramData\MatrixTSL\FlowcodeV8\CAL\STARM)
32F030RC.fcdx (C:\ProgramData\MatrixTSL\FlowcodeV8\FCD\ARM)
cal_i2c.fcpx (C:\ProgramData\MatrixTSL\FlowcodeV8\Components)
I will ask Ben to push these into the auto update system.

Due to the way that ARM I2C is implemented, the interface is via transactions.
These are currently only available with the CAL I2C component, namely:
Transaction_Initialise
Transaction_Read
Transaction_Write
Transaction_Unint

Please give it a try once it is available.

Nb. Most of the Flowcode components that are built on I2C currently do not support transactions, hence are not supported for ARM hardware I2C.
One exception is the LM75B Temperature sensor.

Re: timer bug stm32f411VE

Posted: Wed Mar 11, 2020 11:54 am
by Alkaline
i2c_HW.jpg
i2c_HW.jpg (66.23 KiB) Viewed 8704 times
Hi LeighM

I make a couple of tweaks by connecting the right pins and try the i2C HW support.

Thanks for the update!

Update:
this is the screen of the i2c CAL component
I'm trying to send transactions but it doesn't seem to work.
I am using channel 1 port PB10 and PB11