cancel
Showing results for 
Search instead for 
Did you mean: 

Strange behavior when reading Registers of APS6408L-3OBMx

MHoll.2
Senior III

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

 

1 ACCEPTED SOLUTION

Accepted Solutions
NesrynELMK
ST Employee

Hello @MHoll.2 

 

The behavior you’re seeing—where reads from odd addresses return the same data as the previous even address—is a known limitation of the OCTOSPI interface. As detailed in the errata sheet (ES0491, section 2.8.4), odd address alignment and odd byte counts are not supported under specific conditions.

NesrynELMK_0-1752158270694.png

Br,

 

 

View solution in original post

2 REPLIES 2
KDJEM.1
ST Employee

Hello @MHoll.2;

 

>Can someone share the init code for the APS6408L-3OBMx on the STM32H725/735 MCU?

May the init code for APS6408L-3OB-BA on STM32U5 can help you: STM32CubeU5/Projects/B-U585I-IOT02A/Examples/OCTOSPI/OSPI_PSRAM_MemoryMapped/Src/main.c at main · STMicroelectronics/STM32CubeU5 · GitHub 

 

Thank you.

Kaouthar

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

NesrynELMK
ST Employee

Hello @MHoll.2 

 

The behavior you’re seeing—where reads from odd addresses return the same data as the previous even address—is a known limitation of the OCTOSPI interface. As detailed in the errata sheet (ES0491, section 2.8.4), odd address alignment and odd byte counts are not supported under specific conditions.

NesrynELMK_0-1752158270694.png

Br,