대기시간이라고 말씀하시는 것은 아예 무한 루틴으로 빠져버린다는 건가요??
아니면 대기시간 이후에 동작은 정상적으로 하는 건가요??
→ 대기시간후 정상 작동 합니다.
→ 컴파일러
Eclipse IDE for C/C++ Developers
Version: Kepler Service Release 2
Build id: 20140224-0627
다운로드 툴
WIZnet Configuration Tool Version 1.02
참고로 소스 코드 첨부합니다.
ProcessUDP_HOST() 함수 에서 지연시간이 발생 합니다.
/*
Name : main.c
Author : WIZnet
Version :
Copyright : WIZnet Co., Ltd. 2014
Description : main definition
*/
/*
-
@brief WIZ550WEB Firmware
-
- @note
- Copyright(C) WIZnet Co., Ltd. 2014
- All rights reserved.
-
*/
/*****************************************************************************
- Includes
****************************************************************************/
#include “stm32f10x.h”
#include “common.h”
#include “userHandler.h”
#include “uartHandler.h”
#include “rccHandler.h”
#include “gpioHandler.h”
#include “adcHandler.h”
#include “spiHandler.h”
#include “ConfigData.h”
#include “ConfigMessage.h”
#include “timerHandler.h”
#include “flashHandler.h”
#include <stdio.h>
#include <stdint.h>
#include “…/…/Ethernet/socket.h”
void ProcessUDP_HOST( void );
void delay_sec( unsigned int uiTime );
#define LOOPBACK_DEBUG
#define DATA_BUF_SIZE 2048
// WIZ550WEB-EVB 디지털 출력 포트 수량 -------------
#define MAX_OUT_PORT 8
// WIZ550WEB-EVB 디지털 입력 포트 수량 -------------
#define MAX_IN_PORT 8
// IP address -------------------------------------
unsigned char Host_IP[4] = {192,168,0,10};
uint16_t My_TX_Port = 1234;
uint16_t My_RX_Port = 1233;
// Socket number
#define DEFAULT_SOCKET 0
#define HOST_SOCKET 1
///////////////////////////////////////
// Debugging Message Printout enable //
///////////////////////////////////////
//#define MAIN_DEBUG
//#define WEB_DEBUG
#if defined (MAIN_DEBUG) || defined (WEB_DEBUG)
#include <stdio.h>
#endif
//////////////////////////////
// Shared Buffer Definition //
//////////////////////////////
#define DATA_BUF_SIZE 2048
uint8_t RX_BUF[DATA_BUF_SIZE];
uint8_t TX_BUF[DATA_BUF_SIZE];
////////////////////////////////
// W5500 HW Socket Definition //
////////////////////////////////
#define MAX_HTTPSOCK 6
uint8_t socknumlist = {2, 3, 4, 5, 6, 7};
//#define SOCK_CONFIG 0
//#define SOCK_DHCP 1
//////////////////////////////////////////
#define FALSE 0
#define TRUE 1
static unsigned char aucRxBuff[8] = {1, 2, 3, 4, 5, 6, 7, 8};
static unsigned char aucStatus[8] = {1, 2, 3, 4, 5, 6, 7, 8};
static unsigned char ucDataRxCheck = FALSE;
void ProcessUDP_HOST( void )
{
int32_t ret;
uint16_t size;
uint8_t sn = HOST_SOCKET;
switch(getSn_SR(sn))
{
case SOCK_UDP :
{
if((size = getSn_RX_RSR(sn)) > 0)
{
recvfrom(sn,aucRxBuff,size,Host_IP,&My_RX_Port); // receive data from a destination
}
if( ucDataRxCheck == FALSE )
{
sendto(sn,aucStatus,8,Host_IP,My_TX_Port);
}
}
break;
case SOCK_CLOSED:
if((ret=socket(sn,Sn_MR_UDP,My_RX_Port,0x00)) != sn)
{
return;
}
break;
default :
break;
}
}
void delay_500msec( unsigned int uiTime )
{
unsigned int i;
/*
if ( uiTime < 0)
{
uiTime = 1;
}
else if ( uiTime > 0xffff )
{
uiTime = 0xffff;
}
*/
for ( i=0; i<uiTime; i++)
{
delay_ms(100);
delay_ms(100);
delay_ms(100);
delay_ms(100);
delay_ms(100);
}
}
void delay_sec( unsigned int uiTime )
{
unsigned int i;
/*
if ( uiTime < 0)
{
uiTime = 1;
}
else if ( uiTime > 0xffff )
{
uiTime = 0xffff;
}
*/
for ( i=0; i<uiTime; i++)
{
delay_ms(100);
delay_ms(100);
delay_ms(100);
delay_ms(100);
delay_ms(100);
delay_ms(100);
delay_ms(100);
delay_ms(100);
delay_ms(100);
delay_ms(100);
}
}
int main(void)
{
uint8_t i;
//unsigned char ucBitMask;
//unsigned char *data_buf = NULL; //= (unsigned char *)0x2000; // buffer for loopack data
#if defined (_MAIN_DEBUG_) && defined (_USE_SDCARD_)
uint8_t ret;
#endif
//S2E_Packet *value = get_S2E_Packet_pointer();
// MCU Initialization
RCC_Configuration(); // rccHandler.c
NVIC_Configuration(); // boardutil.c
Timer_Configuration(); // timerHandler.c
GPIO_PinRemapConfig(GPIO_Remap_SWJ_Disable,ENABLE); // JTAG Disable
#if defined(MULTIFLASH_ENABLE)
probe_flash();
#endif
// Load the Configuration data
load_S2E_Packet_from_storage(); // ConfigData.c
// UART Initialization
USART1_Configuration(); // uartHandler.c
USART2_Configuration(); // uartHandler.c
// W5500 Initialization
W5500_SPI_LowLevel_Init();
W5500_Init();
IO_status_init();
// 포트를 출력으로 설정----------- 0 ~ 7
for (i=0; i<MAX_OUT_PORT; i++ )
{
IOdata.io[i] = Output;
IO_Init(i);
}
// 포트를 입력으로 설정----------- 8 ~ 15
for (i=0; i<MAX_IN_PORT; i++ )
{
IOdata.io[i+D8] = Input;
IO_Init(i+D8);
}
// LED Initialization
LED_Init(LED1); // boardutil.c
LED_Init(LED2); // boardutil.c
//LED_Off(LED1); // boardutil.c
//LED_Off(LED2); // boardutil.c
//LED_Off(LED1);
//Delay( 1000000 );
//LED_On(LED2);
//Delay( 1000000 );
// ADC Initialization
//adc_dmamulti_init();
/*
#ifdef _MAIN_DEBUG_
printf("\r\n=======================================\r\n");
printf(" WIZnet WIZ550WEB Revision 1.0\r\n");
printf(" Embedded Web Server Module\r\n");
printf(" Firmware Version %d.%d.%d\r\n", MAJOR_VER, MINOR_VER, MAINTENANCE_VER);
printf("=======================================\r\n");
printf(" # Device Name : %s\r\n\r\n", value->module_name);
#endif
*/
Net_Conf(); // ConfigData.c
/*
#ifdef _MAIN_DEBUG_
display_Net_Info();
#endif
*/
//atc_init();
#ifdef _USE_WATCHDOG_
// IWDG Initialization: STM32 Independent WatchDog
IWDG_Configureation();
#endif
LED_Off(LED1);
LED_Off(LED2);
while(1)
{
#ifdef _USE_WATCHDOG_
IWDG_ReloadCounter(); // Feed IWDG
#endif
do_udp_config(DEFAULT_SOCKET); // Configuration tool handler
/*
생략
*/
ProcessUDP_HOST(); // 데이터 주고 받기
} // End of main routine
}
감사합니다.