SPI HAL library. Transmit 1byte at a time different to all at once.
I’m trying to port a project over to freertos on cubeIDE. I require interfaceing with a a W5500 from wizNET but I’m having trouble communicating with the chip. If I send data to the chip in one hit like this it works fine.
WIZCHIP_CRITICAL_ENTER();
WIZCHIP.CS._select();
AddrSel |= (_W5500_SPI_WRITE_ | _W5500_SPI_VDM_OP_);
uint8_t addr[4];
addr[0] = ((AddrSel & 0x00FF0000) >> 16);
addr[1] = ((AddrSel & 0x0000FF00) >> 8);
addr[2] = ((AddrSel & 0x000000FF) >> 0);
addr[3] = wb;
//wizchip_spi_write_bunch(addr, 4); -->
uint32_t res = HAL_SPI_Transmit(wiz->spi, addr, 4, wiz->spi_timeout);
WIZCHIP.CS._deselect();
WIZCHIP_CRITICAL_EXIT();
But if I try and send it in 8 bit chunks like this it doesn’t. I don’t want to rewrite a ton of drivers to fix this. Please help. I’ve looked on the scope and they different outputs.
WIZCHIP_CRITICAL_ENTER();
WIZCHIP.CS._select();
AddrSel |= (_W5500_SPI_WRITE_ | _W5500_SPI_VDM_OP_);
wizchip_spi_write_byte((AddrSel & 0x00FF0000) >> 16);
wizchip_spi_write_byte((AddrSel & 0x0000FF00) >> 8);
wizchip_spi_write_byte((AddrSel & 0x000000FF) >> 0);
wizchip_spi_write_byte(wb);
//Looks like this
// void wizchip_spi_write_byte(uint8_t wb)
// {
// wiz5500 *wiz = ð
//
// uint32_t res = HAL_SPI_Transmit(wiz->spi, (uint8_t)wb, 1, wiz->spi_timeout);
// }
WIZCHIP.CS._deselect();
WIZCHIP_CRITICAL_EXIT();
Update 1 -> you can’t send a ‘0’ with halspi has this in it
if ((pData == NULL) || (Size == 0U))
{
errorcode = HAL_ERROR;
goto error;
}
Thanks in advance.
