Skip to main content
Visitor II
August 10, 2023
Solved

ADC regular conversion samples only the first channel when running application from QSPI FLASH

  • August 10, 2023
  • 2 replies
  • 2218 views

Hi

I have a project running for the last 2 years: STM32H7, CubeMX for setup.

I have 6 ADC channels on ADC3, running in "Regular, non-continous conversion". This works.

But now I want to run the application from the external QSPI FLASH. This works almost OK, but the ADC sampling fails: It only samples the first channel in the sequence of 6 channels. The next is never started.

I have made no changes to the GPIO setup, except some unused pins, which are configured as analog inputs pr. default in the HAL init. This does not work with the QSPI FLASH interface, because it somehow changes the memory mapping setup in the (bbot)loader. So I just remove the init of the unused pins like this in gpio.c:

/*Configure GPIO pins : PA0 PA3 PA4 PA5
PA6 PA8 */
GPIO_InitStruct.Pin = GPIO_PIN_0|GPIO_PIN_3|GPIO_PIN_4|GPIO_PIN_5
|GPIO_PIN_6|GPIO_PIN_8;
GPIO_InitStruct.Mode = GPIO_MODE_ANALOG;
GPIO_InitStruct.Pull = GPIO_NOPULL;
// HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);

/*Configure GPIO pins : PB0 PB1 PB2 PB10
PB11 PB12 */
GPIO_InitStruct.Pin = GPIO_PIN_0|GPIO_PIN_1|GPIO_PIN_2|GPIO_PIN_10
|GPIO_PIN_11|GPIO_PIN_12;
GPIO_InitStruct.Mode = GPIO_MODE_ANALOG;
GPIO_InitStruct.Pull = GPIO_NOPULL;
// HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);

I have double checked the CubeMX setup and registers during runtime, and everything looks fine, and exactly the same as when running from internal FLASH (see screenshots below).

The question is: Why does the ADC conversion suddenly not continue after sampling the first channel in the sequence, when running from external QSPI FLASH?

 

KKjel1_0-1691667816696.pngKKjel1_1-1691667931580.png

 

 

    This topic has been closed for replies.
    Best answer by KKjel.1

    I have know implemented a "manual" ADC sequence, because the Errata tells that ADC3 does not work properly with sequences.

    And this works OK. It requires more coding of course, but seems to be an easy workaround.

    Why the problem is only present when running from external FLASH is still a mystery, though.

    br, Kaare

    2 replies

    Technical Moderator
    August 10, 2023

    Hello @KKjel.1 ,

    Could you please precise :

    • Which STM32H7 device are you using?
    • Is the QUADSPI configured in Indirect mode?

    Thank you.

    Kaouthar

     

    KKjel.1Author
    Visitor II
    August 10, 2023

    Hi Kaouthar

    - STM32H730

    - We are running memory mapped QSPI

    br

    Kaare

    Technical Moderator
    August 10, 2023

    Hi @KKjel.1 ,

    Please, firstly, try to check if you are able to read/write data correctly from/on the external memory.

    Also, I advise you to take a look to the errata sheet and precisely 2.7 OCTOSPI section.

    Thank you.

    Kaouthar

     

    KKjel.1Author
    Visitor II
    August 10, 2023

    Hi Kaouthar

    I will ask the developers of the QSPI interface/External FLASH integration to look at the read/write to/from QSPI FLASH, and the Errata.

    It looks OK though, as all other software runs OK, and all ADC registers are setup correctly.

    But in the Errata I can see that the ADC3 only runs stable in continous mode if more than 1 channel in the sequence. I have 6 channels in the sequence, and runs non-continous. I just start the sequence once every 100 ms. This works when running from internal FLASH. I have no clue why this is different when running from external FLASH, but I will try to change it friday, and see if this makes any changes.

    Thanks, Kaare

    KKjel.1AuthorAnswer
    Visitor II
    August 11, 2023

    I have know implemented a "manual" ADC sequence, because the Errata tells that ADC3 does not work properly with sequences.

    And this works OK. It requires more coding of course, but seems to be an easy workaround.

    Why the problem is only present when running from external FLASH is still a mystery, though.

    br, Kaare