2024-02-28 12:50 PM
I have modified the SBSFU for STM32G4 to use external flash. I have firmware updates working, but when i turn on SFU_MPU_PROTECT_ENABLE, I get a 'SFU_EXCPT_MEMORY_FAULT' at the following line within HAL_QSPI_Init(), where the QSPI registers are modified:
/* Configure QSPI Clock Prescaler and Sample Shift */
MODIFY_REG(hqspi->Instance->CR, (QUADSPI_CR_PRESCALER | QUADSPI_CR_SSHIFT | QUADSPI_CR_FSEL | QUADSPI_CR_DFM),
((hqspi->Init.ClockPrescaler << QUADSPI_CR_PRESCALER_Pos) |
hqspi->Init.SampleShifting | hqspi->Init.FlashID | hqspi->Init.DualFlash));
It seems like i need to update the MPU settings, but following the example projects results in different errors. Here is what I have for peripheral setting in sfu_low_level_security.h
/**
* @brief Region 0 - Enable the read/write operations for full peripheral area in unprivileged mode.
* Execution capability disabled
*/
#define SFU_PROTECT_MPU_PERIPH_1_RGNV MPU_REGION_NUMBER0
#define SFU_PROTECT_MPU_PERIPH_1_START PERIPH_BASE /*!< Peripheral memory area */
#define SFU_PROTECT_MPU_PERIPH_1_SIZE MPU_REGION_SIZE_512MB
#define SFU_PROTECT_MPU_PERIPH_1_SREG 0x00 /*!< All subregions activated */
#define SFU_PROTECT_MPU_PERIPH_1_PERM MPU_REGION_FULL_ACCESS
#define SFU_PROTECT_MPU_PERIPH_1_EXECV MPU_INSTRUCTION_ACCESS_DISABLE
#define SFU_PROTECT_MPU_PERIPH_1_TEXV MPU_TEX_LEVEL0
#define SFU_PROTECT_MPU_PERIPH_1_B MPU_ACCESS_BUFFERABLE
#define SFU_PROTECT_MPU_PERIPH_1_C MPU_ACCESS_NOT_CACHEABLE
Can you help me understand what i need to modify/add to this file to allow the QSPI registers to be modified within SBSFU? Thanks!
2024-03-01 06:55 AM
The forum moderator had marked your post as needing a little more investigation and direct support. An online support case has been created on your behalf, please stand by for just a moment and you will hear from us.
Regards,
Billy