AnsweredAssumed Answered

NOR Write problem (hanging in busy state)

Question asked by Selso LIBERADO on Feb 5, 2018
Latest reply on Feb 5, 2018 by Clive One

We're using STMCube to integrate two types of NOR Flash : MICRON and CYPRESS.

We are using the HAL_NOR_ProgramBuffer() function, memory data with = 16 bits.

 

Some tests showed that we could not write over the first one secotr (128k) beacuse of these lines :

  NOR_WRITE(NOR_ADDR_SHIFT(deviceaddress, uwNORMemoryDataWidth, uwAddress), NOR_CMD_DATA_BUFFER_AND_PROG);
  NOR_WRITE(NOR_ADDR_SHIFT(deviceaddress, uwNORMemoryDataWidth, uwAddress), (uwBufferSize - 1U));

A collegue resolved this problem modifying these two lines as following :

  NOR_WRITE(NOR_ADDR_SHIFT(deviceaddress, uwNORMemoryDataWidth, uwAddress - deviceaddress), NOR_CMD_DATA_BUFFER_AND_PROG);
  NOR_WRITE(NOR_ADDR_SHIFT(deviceaddress, uwNORMemoryDataWidth, uwAddress - deviceaddress), (uwBufferSize - 1U));

 

We manage to write the whole NOR memory now with the MICRON Chip, whereas the Cypress hangs at the mid of à block size.

Still we don't understant the NOR_***_SHIFT marco :

#define NOR_ADDR_SHIFT(__NOR_ADDRESS__, NOR_MEMORY_WIDTH, ADDRESS)    (uint32_t)(((NOR_MEMORY_WIDTH) == NOR_MEMORY_16B)? ((uint32_t)((__NOR_ADDRESS__) + (2U * (ADDRESS)))):\
                                                                                 ((uint32_t)((__NOR_ADDRESS__) + (ADDRESS))))

 

Why do we multiply the address when using 16 bits mode ?

Shall we pass the address in word count ?

Outcomes