Skip to main content
Explorer II
January 19, 2024
Question

CommandSet Issue with STM32H7B3 + Parallel NOR Flash

  • January 19, 2024
  • 1 reply
  • 1415 views

Hi, I have a custom board using STM32H7B3 with the MT28EW128ABA1HJS-0SIT NOR Flash, and I'm getting an error trying to initialize the NOR Flash during HAL_NOR_Init. 

 

 /* Get the value of the command set */
 ...
 else // 16 Bit
 {
 NOR_WRITE(NOR_ADDR_SHIFT(deviceaddress, uwNORMemoryDataWidth, NOR_CMD_ADDRESS_FIRST_CFI), NOR_CMD_DATA_CFI);
 }
 hnor->CommandSet = *(__IO uint16_t *) NOR_ADDR_SHIFT(deviceaddress, uwNORMemoryDataWidth, NOR_ADDRESS_COMMAND_SET);
 status = HAL_NOR_ReturnToReadMode(hnor);
 }

 

where hnor->CommandSet is read as 0xFFFF, which doesn't match NOR_AMD_FUJITSU_COMMAND_SET or NOR_INTEL_SHARP_EXT_COMMAND_SET so the status becomes HAL_Error and goes to error handler.

Below is the Init & Timing for the NOR Flash:

 

 hnor1.Instance = FMC_NORSRAM_DEVICE;
 hnor1.Extended = FMC_NORSRAM_EXTENDED_DEVICE;
 /* hnor1.Init */
 hnor1.Init.NSBank = FMC_NORSRAM_BANK1;
 hnor1.Init.DataAddressMux = FMC_DATA_ADDRESS_MUX_DISABLE;
 hnor1.Init.MemoryType = FMC_MEMORY_TYPE_NOR;
 hnor1.Init.MemoryDataWidth = FMC_NORSRAM_MEM_BUS_WIDTH_16;
 hnor1.Init.BurstAccessMode = FMC_BURST_ACCESS_MODE_DISABLE;
 hnor1.Init.WaitSignalPolarity = FMC_WAIT_SIGNAL_POLARITY_LOW;
 hnor1.Init.WaitSignalActive = FMC_WAIT_TIMING_BEFORE_WS;
 hnor1.Init.WriteOperation = FMC_WRITE_OPERATION_ENABLE;
 hnor1.Init.WaitSignal = FMC_WAIT_SIGNAL_DISABLE;
 hnor1.Init.ExtendedMode = FMC_EXTENDED_MODE_DISABLE;
 hnor1.Init.AsynchronousWait = FMC_ASYNCHRONOUS_WAIT_DISABLE;
 hnor1.Init.WriteBurst = FMC_WRITE_BURST_DISABLE;
 hnor1.Init.ContinuousClock = FMC_CONTINUOUS_CLOCK_SYNC_ASYNC; 
 hnor1.Init.WriteFifo = FMC_WRITE_FIFO_DISABLE;
 hnor1.Init.PageSize = FMC_PAGE_SIZE_NONE;
 /* Timing */
 Timing.AddressSetupTime = 4;
 Timing.AddressHoldTime = 20;
 Timing.DataSetupTime = 15;
 Timing.BusTurnAroundDuration = 15;
 Timing.CLKDivision = 16;
 Timing.DataLatency = 17;
 Timing.AccessMode = FMC_ACCESS_MODE_B; 

 

How can I solve this problem? Any help is appreciated.

    This topic has been closed for replies.

    1 reply

    Technical Moderator
    January 22, 2024

    Hello @wlynn777 and welcome to the Community :),

    Could you please check NOR device configuration for MT28EW128ABA1LPC-0SIT NOR Flash, for that I advise you to take a look to stm32h7b3i_eval_nor.c file.

    I hope this help you!

    Thank you.

    Kaouthar

    wlynn777Author
    Explorer II
    January 23, 2024

    Hi Kaouthar, 

    Thanks for your reply! I have matched the device configuration & timing with the stm32h7b3i_eval_nor.c NOR driver, but the results are still the same (0xFFFF).

    I've also tried to read the manufacturer code & device code of the NOR flash as below:

     

     

     else
     {
    
    	*(uint16_t*) 0x60000555 = 0x98;
    	uint16_t containsQ = *(uint16_t*) 0x60000010 & 0xFF;
    	uint16_t containsR = *(uint16_t*) 0x60000011 & 0xFF;
    	uint16_t containsY = *(uint16_t*) 0x60000012 & 0xFF;
    
     /* Get the value of the command set */
     NOR_WRITE(NOR_ADDR_SHIFT(deviceaddress, uwNORMemoryDataWidth, NOR_CMD_ADDRESS_FIRST_CFI), NOR_CMD_DATA_CFI);
     hnor->CommandSet = *(__IO uint16_t *) NOR_ADDR_SHIFT(deviceaddress, uwNORMemoryDataWidth, NOR_ADDRESS_COMMAND_SET);
    
     status = HAL_NOR_ReturnToReadMode(hnor);

     

     

    but what should've been QRY (51h, 52h, 59h) is instead (0h, 2400h, 24Ch).

    I've also tested the hardware side; address, data, and control pins are fully functional under an oscilloscope.