STM32F0 Discovery FreeRTOS LED blinking example not working.

aruns06 wrote on Wednesday, June 11, 2014:

Hi,
I am trying to load a freeRTOS LED blinking program in to STM32F0 discovery board using IAR. The sample project is available with FreeRTOS. I was able to build the source code and it acts like it’s uploaded and a multicolour LED is blinking as the indication of communication. I wrote a sample LED bliking program using KEIL and the code is working file. After that again I uploaded the freeRTOS blinky example and still the old code is running. While download and Debug session, I was not able to see the tasks and Queues, which is supposed to be visible. Do I have to change any configuration files???

new to RTOS :slight_smile:

Thanks,
Arun

rtel wrote on Wednesday, June 11, 2014:

I’m not sure I understand the scenario you are describing, but I think you are saying:

  1. You downloaded the IAR demo from the FreeRTOS release - which seemed to get programmed into the device but you didn’t say if it behaved as expected or not.

  2. You then switched to using Keil and created your own program.

  3. You went back to the IAR demo, but this time when you try running it you find the Keil program you were using is still running.

If that is the case then it sounds like you are not actually programming the device when you are using the IAR tools.

Open the project in IAR and go to the project’s options. In the options window select the Debugger category. In that category select the Setup tab and check that the Driver is set to the correct interface (STLink, J-Link, or whatever) and not to Simulator. Next in the same category select the Download tab and ensure Use Flash Loader is selected - if it is not selected then it won’t program the flash.

Regards,
Richard Barry

aruns06 wrote on Wednesday, June 11, 2014:

Yes that’s correct.

  1. You downloaded the IAR demo from the FreeRTOS release - which seemed to get programmed into the device but you didn’t say if it behaved as expected or not.

It’s in the debug session (don’t know how to change back to release)
Thank god the code is now uploaded after I select"Use Flash Loader" and then select overrise default.board file and then chode " flashloader\ST\FlashSTM32F051x8.board"

But the LED is not blinking. PC8 (LD4) and PC9 (LD3) are the two LED’s connected. In the program, LED1 is selected. But in the board LED1 is different. So I tried LED1,2,3,4. But still I am not getting the result.

if( ulReceivedValue == 100UL )
		{
			vParTestToggleLED( LED1 );
			ulReceivedValue = 0U;
		}

This time the code is uploaded. But still, as i said, I’m not able to see anything in the task and Que window.

rtel wrote on Wednesday, June 11, 2014:

From your post it is clear to me that the LED is not blinking, but it is not clear to me if the code is actually running or not.

If you put a break point on the if() line in the code you posted, is it ever hit.

If not then there is something else wrong, not the bit being toggled for the LED.

But still, as i said, I’m not able to see anything in the task and Que window.

I’m not sure which window you mean. Do you mean in the FreeRTOS StateViewer plug-in for IAR?

Regards.

aruns06 wrote on Thursday, June 12, 2014:

I’m not sure which window you mean. Do you mean in the FreeRTOS StateViewer plug-in for IAR?

Yes, StateViewer plug-in for IAR.

If you put a break point on the if() line in the code you posted, is it ever hit.

yes. I am able to set the break point in the function vParTestToggleLED( LED1 );

I am attaching 2 screenshots ,1 and 2. The first one I took when the code is running. Second one, when I press the break.

rtel wrote on Thursday, June 12, 2014:

So I’m not sure what you are saying is wrong.

It seems the program is running ok - if the LED is not toggling then either the port setting is not correct or the wrong pin is being toggled - and the StateViewer plug-in is showing the correct information.

Screenshot1.jpg shows the StateViewer probing the symbol table to see which features are built into the kernel (how FreeRTOSConfig.h is set) - if it can’t find a particular feature it does not look again.

Regards.

aruns06 wrote on Thursday, June 12, 2014:

It seems the program is running ok - if the LED is not toggling then either the port setting is not correct or the wrong pin is being toggled - and the StateViewer plug-in is showing the correct information.

This info corrected my doubt and now the code is working

in the stm320518_eval.h file I made the following change and now it’s working. If we use the standard STM32F051R8T board, the correct configuration is show below. Wrong port was selected.

#define LED1_PIN              GPIO_Pin_8  // previously it was GPIO_Pin_10
#define LED1_GPIO_PORT       GPIOC
#define LED1_GPIO_CLK        RCC_AHBPeriph_GPIOC
  
#define LED2_PIN              GPIO_Pin_9   //previously it was GPIO_Pin_11
#define LED2_GPIO_PORT        GPIOC
#define LED2_GPIO_CLK         RCC_AHBPeriph_GPIOC

Thank you very much for the support.

Regards,
Arun.S