Skip to main content
Visitor II
April 20, 2021
Solved

Unable to read reset values of the STM32H730VB OCTOSPIM peripheral. Unable to reconfigure OCTOSPIM peripheral. Silcon bad?

  • April 20, 2021
  • 6 replies
  • 5008 views

TLDR:

Using a debugger to read the values of the reset values for the OCTOSPIM->PCR registers fails.

Documentation:

RM0468 Rev 2 - Table 7. Register boundary addresses

0x5200B400 - 0x5200B7FF - OCTOSPI1 control registers Section 24.7: OCTOSPI registers

CMSIS stm32h730xx.c content

#define PERIPH_BASE (0x40000000UL) /*!< Base address of : AHB/APB Peripherals */ 
#define D1_AHB1PERIPH_BASE (PERIPH_BASE + 0x12000000UL)
#define OCTOSPIM_BASE (D1_AHB1PERIPH_BASE + 0xB400UL)
#define OCTOSPIM ((OCTOSPIM_TypeDef *) OCTOSPIM_BASE)
 
 /**
 * @brief OCTO Serial Peripheral Interface IO Manager
 */
 
 
typedef struct
{ 
 __IO uint32_t CR; /*!< OCTOSPI IO Manager Control register, Address offset: 0x00 */
 
 __IO uint32_t PCR[3]; /*!< OCTOSPI IO Manager Port[1:3] Configuration register, Address offset: 0x04-0x20 */
} OCTOSPIM_TypeDef;

Connecting a debugger, halting the CPU in the Reset_Handler before any code runs and inspecting the memory at the location results in the following:

0693W00000AM2h6QAD.png0693W00000AM2h1QAD.pngExpected default values:

0693W00000AM2rpQAD.png 

I'm unable to configure the OCTOSPIM peripheral on at least two CPUs.

1) STM32H730VBH6

2) STM32H730VBT6

I have two designs, one using the STM32H730VBH6 which uses OCTOSPIM data lines 0-3. The default configuration for the OCTOSPIM device allows it to work just fine.

The second design, using an STM32H730VBT6 uses OCTOSPIM data lines 4-7 for the flash chip and thus requires non-default configuration.

I verified the problem on BOTH designs. Any attempt to write or read to the OCTOSPIM periphal has NO EFFECT on both designs. Multiple PCBs built, all silicon has the same issue.

I *am* able to read other non-zero reset values using the debugger and other code, such as the defaults for the PWR control register 1.

 0693W00000AM2jlQAD.png 

Questions:

1) Is the base address correct?

2) Is the silicon bad?

3) Why is the length of OCTOSPIM_TypeDef->PCR et to 3, in the HAL code. When there are only TWO PCR registers.

4) What's the solution/workaround?

I checked the errata but there is currently no mention of this problem.

    This topic has been closed for replies.
    Best answer by dominicc

    0693W00000AM6rKQAT.png0693W00000AM6rtQAD.png 

    Success!

    Thanks a million for point me at that register, I doubt I would ever have found it.

    The workaround/solution is:

    RCC->AHB3ENR |= RCC_AHB3ENR_IOMNGREN;
    ...
     if (HAL_OSPIM_Config(&hospi1, &sOspiManagerCfg, HAL_OSPI_TIMEOUT_DEFAULT_VALUE) != HAL_OK)

    This issue highlights that:

    • The ST MCU documentation is incomplete.
    • The HAL/CMSIS libraries are missing clock enable code.
    • The CubeMX generated code does not enable the clock which is *required* prior to any call to `HAL_OSPIM_Config`

    6 replies

    Explorer II
    April 21, 2021

    Clock for OCTOSPIM enabled? The name is somewhat misleading: IOMNGREN in RCC_AHB3ENR.

    dominiccAuthor
    Visitor II
    April 21, 2021

    Hi Andreas,

    The OCTOSPIM does not have a clock. OCTOSPI has a clock. The issue is with the OCTOSPI MANAGER peripheral, not the OCTOSPI peripheral. Regardless of clocks, reading/writing the OCTOSPIM registers should be possible, but reads/writes to the documented registers has zero effect.

    As noted, on one of my designs for which the default configuration of the OCTOSPIM periphal does not need changing, the OCTOSPI peripheral also works and I'm able to use Winbond 16MB QuadSPI flash chip via the NCS/CLK/IO0-3 GPIO lines.

    Explorer II
    April 21, 2021

    Yes, I know that you're referring to OCTOSPI*M*, not the OCTOSPI. And no, it does defintitely have a clock for register accesses, from the RM:

    "Bit 21 IOMNGREN: OCTOSPI I/O manager clock enable

    Set and reset by software.

    0: OCTOSPI I/O manager clock disabled (default after reset)

    1: OCTOSPI I/O manager clock enabled"

    dominiccAuthor
    Visitor II
    April 21, 2021

    Further to this I created a tool to scan the entire peripheral address space for known peripheral register addresses.

    https://gist.github.com/hydra/f2cffb9e590ec7a203c0ff3b6462c051

    The tool does *NOT* find the value for the OCTOSPIM_P1CR or OCTOSPIM_P2CR in the documented peripheral address space.

    0693W00000AM6hKQAT.png0693W00000AM6jkQAD.png0693W00000AM6jfQAD.pngIn these screenshots the breakpoint is at the end of the scan, the searchAddress reached the end of the peripheral address space.

    Given this, I currently conclude that the OCTOSPIM peripheral cannot be accessed in the MCU and that there's a silicon bug.

    Super User
    October 28, 2023

    @snigg Have you checked the OSPI parameters struct in  Inc/stm32h7xx_hal_ospi.h? The documentation in stm32h7xx_hal_ospi.c says this is the way to configure the delay . There is no such function: HAL_RCCEx_OCTOSPIDelayConfig.

    https://github.com/STMicroelectronics/stm32h7xx_hal_driver/blob/edc5793c876b3bfe78eb63d76d7fd77107906585/Inc/stm32h7xx_hal_ospi.h#L78

    https://github.com/STMicroelectronics/stm32h7xx_hal_driver/blob/edc5793c876b3bfe78eb63d76d7fd77107906585/Inc/stm32h7xx_hal_ospi.h#L83

     

     

    Explorer
    October 28, 2023

    @Pavel A. Indeed I have seen these parameters. My impression was that these parameters are for Bypass the Delayblock and the other to enable a fixed 1/4 cycle delay. I thought that IFF the delay block is NOT bypassed, there should be a way to configure it more granular than just 1/4 cycle... At least that seemed to be the statement in AN5050.

    For me the hyperbus interface has so far been a nightmare to implement as documentations are not matching up, examples are sparse and ST really does not help in any way.

    Super User
    October 29, 2023

    >I thought that IFF the delay block is NOT bypassed, there should be a way to configure it more granular 

    Try to ask a new question. Exactly this one ^

    Graduate II
    December 2, 2024

    Hey Guys,

    It's now 12/02/2024, and the problem still exists. I guess nobody at STM cares about the issues brought forward here.