各位专家您好,我在调试CH390的时候,我的SPI接口可以读出ID号,说明接口移植没有问题。
插上网线之后ping不通,但是有一个现象如下:
在插上网线之后,串口就一直打印了Receive overflow错误,在不插上网线的时候就不会在打印了,我看了下这个错误是在中断函数中出现的。我是用的主程序如下:
请专家指导,非常感谢。
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); } }
现象如下:
热门产品 :
CH634: 4端口USB3.0 HUB控制器芯片