Incompatibel STM32F407 with FreeRTOS Webserver???

kamran99kamran wrote on Wednesday, March 19, 2014:

I am using this Code with FreeRTOS!
It does work very good! Too about Task scheduling!

But there is a big Problem, that i need a Demo from FreeRTOS Webserver!
this webserver project is working only with stm32f1xx or stm32f2!!!
This is, why it will never work with stm32f4xx, what can i do??
Is there truely no solution???

regard Kamran

//Inlcude header files
include “stm32f4xx.h”
include “FreeRTOS.h”
include “task.h”
include “math.h”
include “stdio.h”
include “stdlib.h”
include “string.h”

include “stm32f4xx.h”
include “stm32f4xx_conf.h”
include “stm32f4xx_usart.h”
include “stm32f4xx_rcc.h”
include “stm32f4xx_gpio.h”
include “system_stm32f4xx.h”
include “FreeRTOSConfig.h”
include “stm32f4xx_tim.h”
include “uart.h”

//Task For Sending Data Via USART
static void UsartTask(void *pvParameters)

//Initialize GPIO and USART6
void initx(void)

//Main Function
int main(void)
//Call initx(); To Initialize USART & GPIO

//Create Task For LAN
xTaskCreate(UsartTask, (signed char*)"UsartTask", 1024, NULL, tskIDLE_PRIORITY+1, NULL);

//Call Scheduler


rtel wrote on Wednesday, March 19, 2014:

I would like to help, but I’m afraid I don’t understand your question.

You talk about a Webserver, and the comment in the code you posted mentions a LAN, but all the code you have posted is related to a USART.

Where did the code come from? What is it that is not working? Does FreeRTOS run at all on the hardware?

The FreeRTOS kernel will run on any Cortex-M devices, and switching between devices should just be a matter of having the correct linker script as far as the kernel is concerned, although of course the peripherals do vary from device to device.


kamran99kamran wrote on Wednesday, March 19, 2014:

Thanks for Reply.

– Does FreeRTOS run at all on the hardware?
FreeRTOS does run at all on the hardware!

–What is it that is not working?

I’ll try,
sorry I’m bad in english!

via the JTAG code is implemented only once.
The connection will be separated from the JTAG!

But this board has to be connected to LAN ( forever )!
Therefore, I need a web server, as I can only enter via webserver on the site, the temperature query! ( not implemented code! )

therefore I need certain files from the FreeRTOS demo!
for example: emac.h from the FreeRTOS!
But emac.h is not compatible with STM32F4xx because it always calls after this file stm32f10x_gpio.h and not stm32f4xx_gpio.h!

Or stm32_eth.h from the FreeRTOS
This file is again not compatible with STM32F4 but only with stm32f2xx!

This was my problem!

–Where did the code come from?

The code is in this function!

static void UsartTask(void *pvParameters)
GPIO_WriteBit(GPIOG , GPIO_Pin_12 , Bit_RESET);

	int int_Hilfsvariable_Zeit, int_Hilfsvariable_1, int_Hilfsvaribale_2;
	int int_Analogwert_ablesen, int_Temperatur_Abfrage, i, Wahl = 0;
	int int_Zeit_Abfrage;

    /* Programmoptionen anzeigen und Wahl des Benutzers abfragen */
    printf("Guten Tag\n\r");
    printf("Meine Damen und Herren\n\r");
    printf("0 - Programm beenden\n\r");
    printf("Wievielte Mal soll die Zeitsteuerungen erfolgen???\n\r");
    printf("(max:2) Ihre Entscheidung: \n\r");
    scanf("%i", &Wahl);

    /* nach gewählter Programmoption verzweigen */
	  	case 1:
	  		GPIO_WriteBit(GPIOG , GPIO_Pin_12 ,  Bit_SET);
	  		int_Temperatur_Abfrage = getInt("Temperatureingabe in Grad:", -60, 180);
				printf("Temperatureingabe: %i\n\r\n\r", int_Temperatur_Abfrage);
	    	int_Zeit_Abfrage = getInt("Zeitdauer in Stunde:", 0, 180);
				printf("%i\r\n", int_Zeit_Abfrage);
				int_Hilfsvariable_Zeit = int_Zeit_Abfrage * 60;

				for( i=0; i < int_Hilfsvariable_Zeit; i++ ) 
					int_Hilfsvariable_1 =  (-4095) * (int_Temperatur_Abfrage - 180) / 240  ;

					DAC_SetChannel2Data(DAC_Align_12b_R,int_Hilfsvariable_1); // 0...4095 = 3,3....0V = -60.....180
					printf("erwünschte Temperatur: %i\n\r", int_Temperatur_Abfrage);
					printf("erwünscht: %i\n\r", int_Hilfsvariable_1);
					printf("erwünscht: %lf in V\n\r",(float)(int_Hilfsvariable_1 *0.000805));
					int_Analogwert_ablesen = ADC_GetConversionValue(ADC1);
					int_Hilfsvaribale_2 = ( (-240) * int_Analogwert_ablesen / 4095 ) + 180;
					printf("Ist Zustand Temperatur: %i\n\r",int_Hilfsvaribale_2);
					printf("ist Z: %i\n\r", int_Analogwert_ablesen);
					printf("ist Z: %lf in V\n\r\n\r",(float)(int_Analogwert_ablesen *0.000805));
					printf("Noch verbleibend: %i in sec\n\r\n\r", ((int_Hilfsvariable_Zeit - i)) );
					printf("Noch verbleibend: %i in min\n\r\n\r", ((int_Hilfsvariable_Zeit - i)/60) );
      case 2:

      case 0:  /* Option Programm beenden */

    default: /* falsche Option */
      	printf("\nDas war eine falsche Eingabe!\n\r");

		GPIO_WriteBit(GPIOG , GPIO_Pin_12 ,  Bit_RESET);

	printf("Ende des Program\n\r\n\r");


rtel wrote on Wednesday, March 19, 2014:

I was meaning more from where did you get the code, rather than which function did the code come from. As the function is in German I think I’m safe in thinking the code didn’t come from us though. Therefore I would suggest one of three things:

  1. Update the code yourself to use the correct peripheral drivers for the new target hardware.

  2. Go back to wherever the code originally came from and see if they can assist you in porting to the new hardware.

  3. Search the ST website for the STM32 “Demonstration Builder” or “STM32Cube” - both of which I think include a web server that uses FreeRTOS.