2023-08-11 06:32 AM - last edited on 2023-08-11 07:28 AM by KDJEM.1
I want to read and write to w25q128jv with stm32l5 octo spi insted of quad spi.. is there anybody help me. ı could not write correctly.. and ı could not erase. correctly. first problem is when ı was write whiel start addres 0 my code write start to the 2. I added my write code.
/***************************************************************************************************************/
bool OSPIL552::transmitWith0Dummy1LineInstruction1Line3ByteAddress(uint8_t *data_buffer, const uint32_t instruction, const uint32_t address, const uint16_t buffer_size)
{
if(data_buffer == NULL)
{
return false;
}
OSPI_RegularCmdTypeDef cmd = {0};
cmd.InstructionMode = HAL_OSPI_INSTRUCTION_1_LINE;
cmd.Instruction = instruction;
cmd.AddressMode = HAL_OSPI_ADDRESS_1_LINE;
cmd.AddressSize = HAL_OSPI_ADDRESS_24_BITS;
cmd.Address = address;
cmd.AlternateBytesMode = HAL_OSPI_ALTERNATE_BYTES_NONE;
cmd.AlternateBytes = HAL_OSPI_ALTERNATE_BYTES_NONE;
cmd.AlternateBytesSize = HAL_OSPI_ALTERNATE_BYTES_NONE;
cmd.DummyCycles = 0;
cmd.DataMode = HAL_OSPI_DATA_1_LINE;
cmd.DataDtrMode = HAL_OSPI_DATA_DTR_DISABLE;
cmd.SIOOMode = HAL_OSPI_SIOO_INST_EVERY_CMD;
cmd.OperationType = HAL_OSPI_OPTYPE_COMMON_CFG;
cmd.NbData = buffer_size;
if (HAL_OSPI_Command(ospi_handle, &cmd, HAL_OSPI_TIMEOUT_DEFAULT_VALUE))
{
return false;
}
if (HAL_OSPI_Transmit(ospi_handle, reinterpret_cast<uint8_t *>(data_buffer), HAL_OSPI_TIMEOUT_DEFAULT_VALUE))
{
return false;
}
return true;
}
hospi1.Instance = OCTOSPI1;
hospi1.Init.FifoThreshold = 1;
hospi1.Init.DualQuad = HAL_OSPI_DUALQUAD_DISABLE;
hospi1.Init.MemoryType = HAL_OSPI_MEMTYPE_MICRON;
hospi1.Init.DeviceSize = 32;
hospi1.Init.ChipSelectHighTime = 1;
hospi1.Init.FreeRunningClock = HAL_OSPI_FREERUNCLK_DISABLE;
hospi1.Init.ClockMode = HAL_OSPI_CLOCK_MODE_0;
hospi1.Init.WrapSize = HAL_OSPI_WRAP_NOT_SUPPORTED;
hospi1.Init.ClockPrescaler = 1;
hospi1.Init.SampleShifting = HAL_OSPI_SAMPLE_SHIFTING_NONE;
hospi1.Init.DelayHoldQuarterCycle = HAL_OSPI_DHQC_DISABLE;
hospi1.Init.ChipSelectBoundary = 0;
hospi1.Init.DelayBlockBypass = HAL_OSPI_DELAY_BLOCK_BYPASSED;
hospi1.Init.Refresh = 0;
if (HAL_OSPI_Init(&hospi1) != HAL_OK)
{
Error_Handler();
}
}
2023-08-24 05:14 AM
I didnt find file for W25Q128JVSIQ, can you add direct link file please