Hello,
I need to use STM32 DMA (HAL Library) with W5500. I can’t found any example with HAL libs. I have to use HAL because our mcu hasn’t any std library. What’s problem at this code part? BR.
uint8_t readByte() {
uint8_t rxBuffer;
HAL_SPI_Receive(&hspi3, &rxBuffer, 1, 0xFFFFFFFF);
return rxBuffer;
}
void writeByte(uint8_t txBuffer) {
HAL_SPI_Transmit(&hspi3, &txBuffer, 1, 0xFFFFFFFF);
}
void spiReadBurst(uint8_t *pBuf, uint16_t len) {
HAL_SPI_TransmitReceive_DMA(&hspi3, w5500.spiRXBuffer, w5500.spiTXBuffer, len);
memcpy(pBuf, w5500.spiRXBuffer, len);
}
void spiWriteBurst(uint8_t *pBuf, uint16_t len) {
memcpy(w5500.spiTXBuffer, pBuf, len);
HAL_SPI_Transmit_DMA(&hspi3, w5500.spiTXBuffer, len);
}
void w5500Init() {
reg_wizchip_cs_cbfunc(csSelect, csDeselect);
reg_wizchip_spi_cbfunc(readByte, writeByte);
reg_wizchip_spiburst_cbfunc(spiReadBurst, spiWriteBurst);
wizchip_init(w5500.spiBuffer, w5500.spiBuffer);
wizchip_setnetinfo(&w5500);
wizchip_getnetinfo(&w5500);
w5500.result = socket(w5500.socketNumber, Sn_MR_UDP, w5500.localPort, 0); // 0 -> No flag need at UDP
}