This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
28379使用SPI与w5500以太网芯片通信,使用w5500官方驱动库进行移植,在使用SPI读写数据时出现问题,数据可正确发送,但不能正确读取w5500的数据
读写函数如下
uint8_t spi_process(uint8_t dat)
{
uint8_t recvData =0;
while(SpiaRegs.SPISTS.bit.BUFFULL_FLAG!=0); Sp
iaRegs.SPITXBUF=(dat<<8);
while(SpiaRegs.SPISTS.bit.INT_FLAG!=0)
{
recvData = (SpiaRegs.SPIRXBUF)&0xFF;
}
return(recvData); }
在配置w5500mac、ip等基本信息时,已将正确数据发送到w5500的地址里,但当读取时没有正确的数据,不是0就是1,认为是SPI读写函数出现了问题。
void w5500int(void)
{
uint8_t tmp;
uint8_t memsize[2][8] = {{2,2,2,2,2,2,2,2},{2,2,2,2,2,2,2,2}};
#if _WIZCHIP_IO_MODE_ == _WIZCHIP_IO_MODE_SPI_VDM_
reg_wizchip_cs_cbfunc(SPI_CS_Select, SPI_CS_Deselect);//注册SPI片选信号函数
reg_wizchip_spi_cbfunc(spi_process, spi_process); //注册读写函数
if(ctlwizchip(CW_INIT_WIZCHIP,(void*)memsize) == -1)
{
printf("WIZCHIP Initialized fail.\r\n");
while(1);
} /
do{
if(ctlwizchip(CW_GET_PHYLINK, (void*)&tmp) == -1)
{
printf("Unknown PHY Link stauts.\r\n"); }
}while(tmp == PHY_LINK_OFF);//连接失败
network_init();
}
开始时SPI读写函数分开定义,但查阅资料要求读写函数为一个函数体使用,可结果依旧读取不成功,想知道具体是什么问题,如果SPI读写函数错误,请大家帮忙纠正。
注:
SPI基本配置会影响上述问题吗?
谁能够提供好用的SPI的HAL库函数!
在stm32上可移植成功,现使用DSP28379芯片调试出现问题!