2025-03-28 2:27 AM
I have some strange results when reading the configuration registers on the APS6408L-3OBMx.
MCU: STM32H725IGK6
Driver from https://github.com/STMicroelectronics/stm32-aps6408
OCTOPSPI init code:
static void MX_OCTOSPI2_Init(void)
{
/* USER CODE BEGIN OCTOSPI2_Init 0 */
/* USER CODE END OCTOSPI2_Init 0 */
OSPIM_CfgTypeDef sOspiManagerCfg = {0};
/* USER CODE BEGIN OCTOSPI2_Init 1 */
/* USER CODE END OCTOSPI2_Init 1 */
/* OCTOSPI2 parameter configuration*/
hospi2.Instance = OCTOSPI2;
hospi2.Init.FifoThreshold = 4;
hospi2.Init.DualQuad = HAL_OSPI_DUALQUAD_DISABLE;
hospi2.Init.MemoryType = HAL_OSPI_MEMTYPE_APMEMORY;
hospi2.Init.DeviceSize = 23;
hospi2.Init.ChipSelectHighTime = 1;
hospi2.Init.FreeRunningClock = HAL_OSPI_FREERUNCLK_DISABLE;
hospi2.Init.ClockMode = HAL_OSPI_CLOCK_MODE_0;
hospi2.Init.WrapSize = HAL_OSPI_WRAP_NOT_SUPPORTED;
hospi2.Init.ClockPrescaler = 2;
hospi2.Init.SampleShifting = HAL_OSPI_SAMPLE_SHIFTING_NONE;
hospi2.Init.DelayHoldQuarterCycle = HAL_OSPI_DHQC_ENABLE;
hospi2.Init.ChipSelectBoundary = 5;
hospi2.Init.DelayBlockBypass = HAL_OSPI_DELAY_BLOCK_USED;
hospi2.Init.MaxTran = 0;
hospi2.Init.Refresh = 0;
if (HAL_OSPI_Init(&hospi2) != HAL_OK)
{
Error_Handler();
}
sOspiManagerCfg.ClkPort = 2;
sOspiManagerCfg.DQSPort = 2;
sOspiManagerCfg.NCSPort = 2;
sOspiManagerCfg.IOLowPort = HAL_OSPIM_IOPORT_2_LOW;
sOspiManagerCfg.IOHighPort = HAL_OSPIM_IOPORT_2_HIGH;
if (HAL_OSPIM_Config(&hospi2, &sOspiManagerCfg, HAL_OSPI_TIMEOUT_DEFAULT_VALUE) != HAL_OK)
{
Error_Handler();
}
/* USER CODE BEGIN OCTOSPI2_Init 2 */
/* USER CODE END OCTOSPI2_Init 2 */
}
Read function:
uint8_t Reg0_1[2];
uint8_t Reg1_2[2];
uint8_t Reg2_3[2];
uint8_t Reg3_4[2];
uint8_t Reg4_8[2];
uint8_t Reg8_0[2];
APS6408_ReadReg(hospi, 0, Reg0_1, 5);
APS6408_ReadReg(hospi, 1, Reg1_2, 5);
APS6408_ReadReg(hospi, 2, Reg2_3, 5);
APS6408_ReadReg(hospi, 3, Reg3_4, 5);
APS6408_ReadReg(hospi, 4, Reg4_8, 5);
APS6408_ReadReg(hospi, 8, Reg8_0, 5);
Result:
Reg0_1: 0x09 0x0D --> OK
Reg1_2: 0x09 0x0D --> same value as with address 0x00!
Reg2_3 0x93 0xE0 --> OK
Reg3_4 0x93 0xE0 --> same value as with address 0x02!
Reg4_8 0x50 0x05 --> OK
Reg8_0 0x05 0x09 -->OK
To me this seems like the odd addresses are not read as expeceted, the result is indipendent of the last Bit of Address!
The only thing I can think of is that my init code is wrong?
Can someone share the init code for the APS6408L-3OBMx on the STM32H725/735 MCU?
Martin