cancel
Showing results for 
Search instead for 
Did you mean: 

External Nor Flash Programming from Application

johnsotack9
Associate II
Posted on April 16, 2013 at 16:40

For my application I need to program external NOR flash via code executing on an STM32F4 family processor.  I see examples that read external flash but none that program it from code executing on an STM32F4 family processor.  References to any examples, drivers, or application notes would be appreciated.  I am interfacing to a SPGL032N family device.

John

#nor-flash-programming
3 REPLIES 3
Posted on April 16, 2013 at 17:00

NOR vendors typical provide algorithmic and unlocking information for their specific devices. This code is normally available as C routines, or pseudo code, in a non-architecture specific form, ie not tied to the STM32F4. Programming examples for the device should be sought from the vendor of the flash part.

You will need to adapt the addressing and accessing to your implementation's specific details.

Both Keil and IAR tool chains have examples of flashing code in the form of applets the chains can use to program the devices in the debugger. Other open implementation would surely be a Google or Bing search away.

Tips, buy me a coffee, or three.. PayPal Venmo Up vote any posts that you find helpful, it shows what's working..
Posted on April 16, 2013 at 22:22

One of the things which might help is to spell the device's name correctly.

I know of no SPGL032N NOR Flash, but if you meant Spansion's S29GL032N, then its datasheet http://www.spansion.com/Support/Datasheets/S29GL-N_01.pdf provides extensive details on its working including all writing operations, giving even flowcharts for the individual operations. I can't quite see what else would be needed to get it working, but I might be overlooking something.

JW

amar
Associate
Posted on September 10, 2016 at 08:50

Hi,

I am trying to access External NOR Flash from STM32F439Nih6microcontroller..i am using M29W128GL NOR Flash Device

Below is my NOR Flash initialization function

void MX_FMC_Init(void)

{

  FMC_NORSRAM_TimingTypeDef Timing;

  FMC_SDRAM_TimingTypeDef SdramTiming;

  /** Perform the NOR1 memoryinitialization sequence

  */

  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.WrapMode =FMC_WRAP_MODE_DISABLE;

  hnor1.Init.WaitSignalActive =FMC_WAIT_TIMING_BEFORE_WS;

  hnor1.Init.WriteOperation =FMC_WRITE_OPERATION_ENABLE;

  hnor1.Init.WaitSignal =FMC_WAIT_SIGNAL_ENABLE;

  hnor1.Init.ExtendedMode =FMC_EXTENDED_MODE_DISABLE;

  hnor1.Init.AsynchronousWait =FMC_ASYNCHRONOUS_WAIT_ENABLE;

  hnor1.Init.WriteBurst =FMC_WRITE_BURST_DISABLE;

  hnor1.Init.ContinuousClock=FMC_CONTINUOUS_CLOCK_SYNC_ONLY;// FMC_CONTINUOUS_CLOCK_SYNC_ASYNC;

  /* Timing */

  Timing.AddressSetupTime = 4;

  Timing.AddressHoldTime = 3;

  Timing.DataSetupTime = 7;

  Timing.BusTurnAroundDuration = 1;

  Timing.CLKDivision = 2;

  Timing.DataLatency = 2;

  Timing.AccessMode =FMC_ACCESS_MODE_A;

  /* ExtTiming */

}

The erasingof NOR flash chip is done by the following API’s

/****************************erase norstart****************************************************/

/*##-3- Erase NOR memory

 ###################################################*/

/* Return to read mode */

HAL_NOR_ReturnToReadMode(&hnor1);

/* Send NOR erase block operation */

HAL_NOR_Erase_Block(&hnor1,WRITE_READ_ADDR,NORSRAM_BANK_ADDR);

/* Return the NOR memory status */

if(HAL_NOR_GetStatus(&hnor1,NORSRAM_BANK_ADDR,BLOCKERASE_TIMEOUT) !=NOR_SUCCESS)

{

return NOR_ERROR;}

printf(''sln-1\n\r'');

//****************************erase NORstop****************************************************/                                                                               

//****************************write to NOR addresssstart******************************************/

Fill_Buffer_constant_data_read_write(aTxBuffernor,BUFFER_SIZE_NOR,0xAAAA);// fill the buffer                                                                                                                                                                                                                                                                                                                                                                                               

/* Write data to the NOR memory */

HAL_NOR_Program(&hnor1, (uint32_t*)norsram1address, aTxBuffernor,BUFFER_SIZE_NOR);                                                                                                                                                                                                                                                                                                                                                                                                                                            

/****************************Read to NOR addresss start******************************************************************/

HAL_NOR_Read(&hnor1, (uint32_t*)norsram1address,aRxBuffernor,BUFFER_SIZE_NOR);/* Read back data from the SDRAM memory */

/********************************************************************************************************************/

When i try to Access NOR Flash i.e, write/Read operation, After performingwrite and read ,when i compare TxBuffer and RxBuffer in RxBuffer  i am getting junk data 0xFFFF.

Kindly look at the code and suggest the way to get the output

Regards

AMAR TR     

 I would like to sharethe below post/discussion with you :

 Forum Name :Microcontrollers

 URL :

/337e7ed9