新手上路
- 积分
- 21
- 金钱
- 21
- 注册时间
- 2018-3-8
- 在线时间
- 7 小时
|
1金钱
int main(void)
{
u8 key;
Stm32_Clock_Init(360,25,2,8); //éèÖÃê±Öó,180Mhz
HAL_Init(); //3õê¼»ˉHAL¿a
delay_init(180); //3õê¼»ˉÑóê±oˉêy
uart_init(115200); //3õê¼»ˉUSART
usmart_dev.init(90); //3õê¼»ˉUSMART
LED_Init(); //3õê¼»ˉLED
KEY_Init(); //3õê¼»ˉ°′¼ü
SDRAM_Init(); //3õê¼»ˉSDRAM
LCD_Init(); //3õê¼»ˉLCD
PCF8574_Init(); //3õê¼»ˉPCF8574
my_mem_init(SRAMIN); //3õê¼»ˉÄú2¿Äú′æ3Ø
my_mem_init(SRAMEX); //3õê¼»ˉía2¿Äú′æ3Ø
my_mem_init(SRAMCCM); //3õê¼»ˉCCMÄú′æ3Ø
MX_GPIO_Init();
MX_DMA_Init();
MX_ADC1_Init();
delay_ms(100);
HAL_ADC_Start_DMA(&hadc1, (uint32_t*)&uhADCxConvertedValue,20); //¿aÆôdma′«êä,′«Ëí20¸ö×ÖμÄêy¾Yμ½uhADCxConvertedValueÕa¸ö±äá¿àïÃæ
delay_ms(500);
LCD_ShowString(30,110,200,16,16,"lwIP Init Successed");
POINT_COLOR = RED;
lwip_test_ui(1); //¼óÔØÇ°°ë2¿·ÖUI
TIM3_Init(1000-1,900-1); //¶¨ê±Æ÷33õê¼»ˉ£¬¶¨ê±Æ÷ê±ÖóÎa90M£¬·ÖÆμÏμêyÎa900-1£¬
//ËùòÔ¶¨ê±Æ÷3μÄÆμÂêÎa90M/900=100K£¬×Ô¶ˉÖØ×°ÔØÎa1000-1£¬ÄÇÃ′¶¨ê±Æ÷ÖüÆú¾íêÇ10ms
while(lwip_comm_init()) //lwip3õê¼»ˉ
{
LCD_ShowString(30,110,200,20,16,"LWIP Init Falied! ");
delay_ms(500);
LCD_ShowString(30,110,200,16,16,"Retrying... ");
delay_ms(500);
}
LCD_ShowString(30,110,200,20,16,"LWIP Init Success!");
LCD_ShowString(30,130,200,16,16,"DHCP IP configing..."); //μè′yDHCP»ñè¡
#if LWIP_DHCP //ê1óÃDHCP
while((lwipdev.dhcpstatus!=2)&&(lwipdev.dhcpstatus!=0XFF))//μè′yDHCP»ñè¡3é1|/3¬ê±òç3ö
{
lwip_periodic_handle(); //LWIPÄúoËDèòa¶¨ê±′|àíμÄoˉêy
}
#endif
lwip_test_ui(2); //¼óÔØoó°ë2¿·ÖUI
delay_ms(1000); //Ñóê±1s
tcp_server_test(); //TCP ServerÄ£ê½
while(1)
{
lwip_periodic_handle(); //LWIPÄúoËDèòa¶¨ê±′|àíμÄoˉêy
key = KEY_Scan(0);
if(key == KEY1_PRES) //°′KEY1¼ü½¨á¢ᬽó
{
if((tcp_server_flag & 1<<6)) printf("TCPᬽóòѾ-½¨á¢,2»ÄüÖظ′ᬽó\r\n"); //èç1ûᬽó3é1|,2»×öèÎoÎ′|àí
else tcp_server_test(); //μ±¶Ï¿aᬽóoó,μ÷óÃtcp_server_test()oˉêy
}
delay_ms(10);
}
}
我在429开发板上LWIP例程上面增加了ADC数据传输,
在LWIP主函数中添加 HAL_ADC_Start_DMA(&hadc1, (uint32_t*)&uhADCxConvertedValue,20); 这条语句程序就不能正常运行,去掉这条语句LWIP就能正常运行,这条语句单独测试可以ADC传输数据
|
|