cancel
Showing results for 
Search instead for 
Did you mean: 

Is it possible to read NAND memory using a pointer remap without the HAL_NAND_Read_Page_8b functions

LEXis
Associate

Hello everybody!
I am using an STM32H750VBT6 controller and a NAND memory - MX30LF1G18AC. Initialization via CubeMX, using the development of a Keil.
I can view the id, I can record and view all the entries: HAL_NAND_Write_Page_8b, HAL_NAND_Read_Page_8b
Initializing the region:
/* Initializes and configures the area and memory that should be protected
*/
MPU_Init Struct.Number = MPU_REGION_NUMBER 2;
MPU_InitStruct.Base address = 0x80000000;
MPU_InitStruct.Size = MPU_REGION_SIZE_128 MB;
MPU_InitStruct.Enter the text field = MPU_TEX_LEVEL 0;

MPU_InitStruct.Access permission = MPU_REGION_FULL_ACCESS;
MPU_InitStruct.DisableExec = MPU_INSTRUCTION_ACCESS_ENABLE;
MPU_InitStruct.IsShareable = MPU_ACCESS_SHAREABLE;
MPU_InitStruct.IsCacheable = MPU_ACCESS_CACHEABLE;
MPU_InitStruct.IsBufferable = MPU_ACCESS_NOT_BUFFERABLE;

The HAL_MPU_Config area(&MPU_InitStruct);

 

void MX_FMC_Init(void)
{

FMC_NAND_PCC_TimingTypeDef ComSpaceTiming = {0};
FMC_NAND_PCC_TimingTypeDef AttSpaceTiming = {0};

/** Perform the NAND1 memory initialization sequence
*/
hnand1.Instance = FMC_NAND_DEVICE;
/* hnand1.Init */
hnand1.Init.NandBank = FMC_NAND_BANK3;
hnand1.Init.Waitfeature = FMC_NAND_WAIT_FEATURE_ENABLE;
hnand1.Init.MemoryDataWidth = FMC_NAND_MEM_BUS_WIDTH_8;
hnand1.Init.EccComputation = FMC_NAND_ECC_DISABLE;
hnand1.Init.ECCPageSize = FMC_NAND_ECC_PAGE_SIZE_2048BYTE;
hnand1.Init.TCLRSetupTime = 0;
hnand1.Init.TARSetupTime = 0;
/* hnand1.Config */
hnand1.Config.PageSize = 2048;
hnand1.Config.SpareAreaSize = 64;
hnand1.Config.BlockSize = 64;
hnand1.Config.BlockNbr = 1024;
hnand1.Config.PlaneNbr = 1;
hnand1.Config.PlaneSize = 1024;
hnand1.Config.ExtraCommandEnable = ENABLE;
/* ComSpaceTiming */
ComSpaceTiming.SetupTime = 4;
ComSpaceTiming.WaitSetupTime = 3;
ComSpaceTiming.HoldSetupTime = 3;
ComSpaceTiming.HiZSetupTime = 4;
/* AttSpaceTiming */
AttSpaceTiming.SetupTime = 4;
AttSpaceTiming.WaitSetupTime = 3;
AttSpaceTiming.HoldSetupTime = 3;
AttSpaceTiming.HiZSetupTime = 4;

if (HAL_NAND_Init(&hnand1, &ComSpaceTiming, &AttSpaceTiming) != HAL_OK)
{
Error_Handler( );
}

}

 

I need to work with this memory directly through the pointer.
like for example:

#define NAND_R(adr) *(uint8_t volatile *) (0x80000000 + (adr))
uint8_t buf[128];
for (uint8_t i = 0; i < 128; i++)
buf[i] = NAND_R(i);

Is this possible?

 

I am grateful in advance.

1 ACCEPTED SOLUTION

Accepted Solutions

NAND typically infers block addressable memory, not byte addressable.

It fetches a requested block from a large array, and you FIFO out the block as a whole. Other out-of-band data is used to provide error-correction code space for the data portion, allowing it to fix bits which get corrupted or read as an undefined/undetermined value. The memory has very few address bits, the address being used to identify command vs data interactions.

Good for mass-storage applications, not for random read-writes or code execution.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

View solution in original post

2 REPLIES 2
TDK
Guru

No, this won't work.

 

See the reference manual for how NAND memory must be accessed. You need to specify a page to access before you access that page.

TDK_0-1706885477519.png

 

If you feel a post has answered your question, please click "Accept as Solution".

NAND typically infers block addressable memory, not byte addressable.

It fetches a requested block from a large array, and you FIFO out the block as a whole. Other out-of-band data is used to provide error-correction code space for the data portion, allowing it to fix bits which get corrupted or read as an undefined/undetermined value. The memory has very few address bits, the address being used to identify command vs data interactions.

Good for mass-storage applications, not for random read-writes or code execution.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..