Example #1
0
/**
  * @brief  Main program.
  * @param  None
  * @retval None
  */
int main(void)
{
  /*!< At this stage the microcontroller clock setting is already configured to 
       144 MHz, this is done through SystemInit() function which is called from
       startup file (startup_stm32f4xx.s) before to branch to application main.
       To reconfigure the default setting of SystemInit() function, refer to
       system_stm32f4xx.c file
     */  

  /*Initialize LCD and Leds */ 
  LCD_LED_Init();
  
  /* configure ethernet (GPIOs, clocks, MAC, DMA) */ 
  ETH_BSP_Config();
    
  /* Initilaize the LwIP stack */
  LwIP_Init();
  
  /* Initialize webserver demo */
  http_server_socket_init();

#ifdef USE_DHCP
  /* Start DHCPClient */
  xTaskCreate(LwIP_DHCP_task, (const signed char *) "DHCPClient", configMINIMAL_STACK_SIZE * 2, NULL,DHCP_TASK_PRIO, NULL);
#endif
    
  /* Start toogleLed4 task : Toggle LED4  every 250ms */
  xTaskCreate(ToggleLed4, (const signed char *) "LED4", configMINIMAL_STACK_SIZE, NULL, LED_TASK_PRIO, NULL);
  
  /* Start scheduler */
  vTaskStartScheduler();

  /* We should never get here as control is now taken by the scheduler */
  for ( ;; );
}
Example #2
0
/**
  * @brief  Main program.
  * @param  None
  * @retval None
  */
int main(void)
{
  /*!< At this stage the microcontroller clock setting is already configured to 
       168 MHz, this is done through SystemInit() function which is called from
       startup file (startup_stm32f4xx.s) before to branch to application main.
       To reconfigure the default setting of SystemInit() function, refer to
       system_stm32f4xx.c file
     */
//add a long delay wait for DP83848 finish reset  
unsigned int i,j;
for(i=0;i<50;i++)
{
	for(j=0;j < 65500;j++);
}
#ifdef SERIAL_DEBUG
  DebugComPort_Init();
#endif
  
  /*Initialize LCD and Leds */ 
  LCD_LED_Init();
  
  /* configure ethernet (GPIOs, clocks, MAC, DMA) */ 
  ETH_BSP_Config();
    
  /* Initilaize the LwIP stack */
  LwIP_Init();
  
  /* Initialize tcp echo server */
  tcpecho_init();
  
  /* Initialize udp echo server */
  udpecho_init();

#ifdef USE_DHCP
  /* Start DHCPClient */
  xTaskCreate(LwIP_DHCP_task, "DHCPClient", configMINIMAL_STACK_SIZE * 2, NULL,DHCP_TASK_PRIO, NULL);
#endif
    
  /* Start toogleLed4 task : Toggle LED4  every 250ms */
  xTaskCreate(ToggleLed4, "LED4", configMINIMAL_STACK_SIZE, NULL, LED_TASK_PRIO, NULL);
  
  /* Start scheduler */
  vTaskStartScheduler();

  /* We should never get here as control is now taken by the scheduler */
  for( ;; );
}
Example #3
0
/**
  * @brief  Main program.
  * @param  None
  * @retval None
  */
int main(void)
{
  /*!< At this stage the microcontroller clock setting is already configured to 
       120 MHz, this is done through SystemInit() function which is called from
       startup file (startup_stm32f2xx.s) before to branch to application main.
       To reconfigure the default setting of SystemInit() function, refer to
       system_stm32f2xx.c file
     */  
//add a long delay wait for DP83848 finish reset  
unsigned int i,j;
for(i=0;i<36;i++)
{
	for(j=0;j < 65500;j++);
}  
#ifdef SERIAL_DEBUG
  DebugComPort_Init();
#endif

  /* Initialize LCD and Leds */ 
  LCD_LED_Init();
  
  /* Configure ethernet (GPIOs, clocks, MAC, DMA) */ 
  ETH_BSP_Config();
    
  /* Initilaize the LwIP stack */
  LwIP_Init();
      
  /* TFTP server Init */
  tftpd_init();
    
  /* Infinite loop */
  while (1)
  {  
    /* check if any packet received */
    if (ETH_CheckFrameReceived())
    { 
      /* process received ethernet packet */
      LwIP_Pkt_Handle();
    }
    /* handle periodic timers for LwIP */
    LwIP_Periodic_Handle(LocalTime);
  }   
}
Example #4
0
/**
  * @brief  Main program.
  * @param  None
  * @retval None
  */
int main(void)
{
  /*!< At this stage the microcontroller clock setting is already configured to 
       168 MHz, this is done through SystemInit() function which is called from
       startup file (startup_stm32f4xx.s) before to branch to application main.
       To reconfigure the default setting of SystemInit() function, refer to
       system_stm32f4xx.c file
     */  
  
  armcmx_init();

  printf("Hello.\n");
  
#ifdef SERIAL_DEBUG
  DebugComPort_Init();
#endif

  /*Initialize LCD and Leds */ 
  LCD_LED_Init();
  
  /* configure ethernet (GPIOs, clocks, MAC, DMA) */ 
  ETH_BSP_Config();
 
  /* Initilaize the LwIP stack */
  LwIP_Init();
  
  /* Http webserver Init */
  httpd_init();
    
  /* Infinite loop */
  while (1)
  {  
    /* check if any packet received */
    if (ETH_CheckFrameReceived())
    { 
      /* process received ethernet packet */
      LwIP_Pkt_Handle();
    }
    /* handle periodic timers for LwIP */
    LwIP_Periodic_Handle(LocalTime);
  }   
}
Example #5
0
/**
  * @brief  Main program.
  * @param  None
  * @retval None
  */
int main(void)
{
  /*!< At this stage the microcontroller clock setting is already configured to 
       168 MHz, this is done through SystemInit() function which is called from
       startup file (startup_stm32f4xx.s) before to branch to application main.
       To reconfigure the default setting of SystemInit() function, refer to
       system_stm32f4xx.c file
     */ 
	 
	   int TestStatus; 

#ifdef SERIAL_DEBUG
  //DebugComPort_Init();
#endif
  
  Printf_Init();

    
  printf("long = %d int = %d short = %d char = %d\r\n", sizeof(long), sizeof(int), sizeof(short), sizeof(char));
  /*Initialize LCD and Leds */ 
  LCD_LED_Init();

  TestStatus = CAN1_Config();
	if(TestStatus == -1)
	{
		printf("CAN1_Config failed\r\n"); 	
	}
	else
	{
		printf("CAN1_Config success\r\n");
	}
  /* configure ethernet (GPIOs, clocks, MAC, DMA) */ 
  //ETH_BSP_Config();

 // printf("\n\r\r\n ARMJISHU.COM神舟王STM32F407ZGT开发板 FreeRTOS V6.1.0 httpserver_netconn 例程\r\n"); 
    
  /* Initilaize the LwIP stack */
  //printf("\n\r LwIP_Init\r\n");
 // LwIP_Init();
  
  /* Initialize webserver demo */
  //http_server_socket_init();
  //printf("\n\r FreeRTOS V6.1.0 http_server_socket_init: sys_thread_new HTTP\r\n");

#ifdef USE_DHCP
  /* Start DHCPClient */
  printf("\n\r FreeRTOS V6.1.0 xTaskCreate LwIP_DHCP_task\r\n");
  xTaskCreate(LwIP_DHCP_task, "DHCPClient", configMINIMAL_STACK_SIZE * 2, NULL,DHCP_TASK_PRIO, NULL);
#endif
    
  /* Start toogleLed4 task : Toggle LED4  every 250ms */
  printf("\n\r FreeRTOS V6.1.0 xTaskCreate ToggleLed4\r\n");
  xTaskCreate(ToggleLed4, "LED4", configMINIMAL_STACK_SIZE, NULL, LED_TASK_PRIO, NULL);

  /* Start toogleLed1 task : Toggle LED1  every 250ms */
  //printf("\n\r FreeRTOS V6.1.0 xTaskCreate ToggleLed1\r\n");
  //xTaskCreate(ToggleLed1, "SZWLED1", configMINIMAL_STACK_SIZE, NULL, LED_TASK_PRIO, NULL);
    
  /* Start toogleLed2 task : Toggle LED2  every 250ms */
  //printf("\n\r FreeRTOS V6.1.0 xTaskCreate ToggleLed2\r\n");
  //xTaskCreate(ToggleLed2, "SZWLED2", configMINIMAL_STACK_SIZE, NULL, LED_TASK_PRIO, NULL);

  /* Start toogleLed3 task : Toggle LED3  every 250ms */
  //printf("\n\r FreeRTOS V6.1.0 xTaskCreate ToggleLed3\r\n");
  //xTaskCreate(ToggleLed3, "SZWLED3", configMINIMAL_STACK_SIZE, NULL, LED_TASK_PRIO, NULL);

  /* Start scanDevices task  */
  printf("\n\r FreeRTOS V6.1.0 xTaskCreate can1Send\r\n");
  xTaskCreate(can1Send, "CAN1SEND", configMINIMAL_STACK_SIZE, NULL, CAN_TASK_PRIO, NULL);

  /* Start can1 receive task  */
  printf("\n\r FreeRTOS V6.1.0 xTaskCreate can1Rec\r\n");
  xTaskCreate(can1Rec, "CAN1REC", configMINIMAL_STACK_SIZE, NULL, CAN_TASK_PRIO+1, NULL);

  /* Start can1 do command task  */
  printf("\n\r FreeRTOS V6.1.0 xTaskCreate doCommand\r\n");
  xTaskCreate(doCommand, "DCMMD", configMINIMAL_STACK_SIZE, NULL, CAN_TASK_PRIO+2, NULL);
  
   
  /* Start scheduler */
  printf("\n\r FreeRTOS V6.1.0 Start scheduler\r\n");
  vTaskStartScheduler();

  /* We should never get here as control is now taken by the scheduler */
  for( ;   ; );
}