Question
HAL_OSPI_Transmit does not transmit (always HAL_ERROR)
Hi!
I'm trying to send this information: ADDRESS (3 bytes), Dummy Byte (1 byte), DATA (2 bytes), and the result of HAL_OSPI_Transmit is always--> HAL ERROR.
What do you think could be the issue? Below you have my code:
Thank you!
void FT813_memWrite16_QUAD(u32 ftAddress, u16 ftData16) {
s32 i;
u8 cTempAddr[3], cTempData[2];
cTempAddr[2] = (u8)(ftAddress >> 16) | MEM_WRITE; // Compose the command and address to send
cTempAddr[1] = (u8)(ftAddress >> 8); // middle byte
cTempAddr[0] = (u8)(ftAddress); // low byte
cTempData[1] = (u8) (ftData16 >> 8); // Compose data to be sent - high byte
cTempData[0] = (u8) (ftData16); // low byte
ftAddress=Array_u32(cTempAddr);
FT813_CS_ON
sCommand.OperationType = HAL_OSPI_OPTYPE_COMMON_CFG;
sCommand.InstructionMode=HAL_OSPI_INSTRUCTION_NONE;
sCommand.Instruction=0x00;
sCommand.AddressMode=HAL_OSPI_ADDRESS_1_LINE;
sCommand.AddressSize=HAL_OSPI_ADDRESS_24_BITS;
sCommand.Address=ftAddress;
sCommand.AlternateBytesMode=HAL_OSPI_ALTERNATE_BYTES_NONE;
sCommand.AlternateBytes=0;
sCommand.AlternateBytesSize=0;
sCommand.DataMode=HAL_OSPI_DATA_1_LINE;
sCommand.DataDtrMode=HAL_OSPI_DATA_DTR_DISABLE;
sCommand.NbData=2; //2 bytes to send
sCommand.DummyCycles= 8; //1 Byte dummy
if (HAL_OSPI_Command(&hospi1, &sCommand, HAL_OSPI_TIMEOUT_DEFAULT_VALUE) != HAL_OK)
{
Error_Handler();
}
if(HAL_OSPI_Transmit(&hospi1,&cTempData[0],HAL_OSPI_TIMEOUT_DEFAULT_VALUE)!=HAL_OK)
{
Error_Handler();
}
FT813_CS_OFF
}