各位專家您好,我在調(diào)試CH390的時(shí)候,我的SPI接口可以讀出ID號(hào),說(shuō)明接口移植沒(méi)有問(wèn)題。
插上網(wǎng)線之后ping不通,但是有一個(gè)現(xiàn)象如下:
在插上網(wǎng)線之后,串口就一直打印了Receive overflow錯(cuò)誤,在不插上網(wǎng)線的時(shí)候就不會(huì)在打印了,我看了下這個(gè)錯(cuò)誤是在中斷函數(shù)中出現(xiàn)的。我是用的主程序如下:
請(qǐng)專家指導(dǎo),非常感謝。
void?start_net_task(void?*argument) { ????uint32_t?id=0; ??printf("start?net?task\r\n"); ????ch390_interface_register(ch390_interface); ??ch390_hardware_reset(); ?? ??HAL_Delay(10); //while(1) { id=ch390_get_vendor_id(); printf("ch390?vid=%4.4x\r\n",id); id=ch390_get_product_id(); printf("ch390?pid=%4.4x\r\n",id); } ??printf("lwip?init\r\n"); ??init_lwip_netif(); ??printf("dhcp_start\r\n"); ????dhcp_start(&ch390_netif); ??print_self_ip(&ch390_netif); ????/*?We?provide?three?examples?in?this?project. ?????*?Uncomment?one?of?them?below.*/ ????tcp_server_init(); ????while(1) ????{ ????????if(ch390_check_int_status()) ????????{ ????????????ch390_int_handler(); ????????} ????????sys_check_timeouts(); ????} } void?ch390_int_handler() { ????uint8_t?int_status?=?ch390_get_int_status(); ????//?Link?status?change ????if(int_status?&?ISR_LNKCHG) ????{ ????????HAL_Delay(100); ????????if(ch390_get_link_status()) ????????{ ????????????printf("netif_set_up\r\n"); ????????????netif_set_up(&ch390_netif); ????????????ch390_write_reg(CH390_ISR,?ISR_LNKCHG); ????????} ????????else?{ ????????????printf("netif_set_down\r\n"); ????????????netif_set_down(&ch390_netif); ????????} ????} ????//?Receive?overflow ????if(int_status?&?ISR_ROS)?printf("Receive?overflow\r\n"); ????//?Receive?overflow?counter?overflow ????if(int_status?&?ISR_ROO)?printf("Overflow?counter?overflow\r\n"); ????//?Packet?received ????if(int_status?&?ISR_PR) ????{ ????????struct?ethernetif?*ethernetif?=?ch390_netif.state; ????????do{ ????????????ethernetif_input(&ch390_netif); ????????} ????????while(ethernetif->rx_len?!=?0); ????} }
現(xiàn)象如下: