cancel
Showing results for 
Search instead for 
Did you mean: 

weird problem nand flash hal function

Arman Ilmak
Senior

Hi

My code stops after i use the HAL_NAND_Read_ID function, Also the debugger stops working and i can see no errors to solve.

Thanks for helping me.

0693W00000FCBIjQAP.png

4 REPLIES 4
Imen.D
ST Employee

Hello @Arman Ilmak​ ,

Check if you have the same conditions related to the NAND Flash as described in the STM32H743xI/G Errata sheet.

If possible to share your code if this issue is not resolved, and please provide more information to understand the cause of the error.

Which Cube example did you looked to? Which Firmware version are you using ?

Are you using CubeMX for generating the code?

Imen

When your question is answered, please close this topic by clicking "Accept as Solution".
Thanks
Imen

I use cubemx v6.3.0 as code generator and stm32h7 v1.8.0 softwarepacket.

I just config the nand timing and generated the code.

Here is the main code:

int main(void)
{
  /* USER CODE BEGIN 1 */
 
	
  /* USER CODE END 1 */
 
  /* Enable D-Cache---------------------------------------------------------*/
  SCB_EnableDCache();
 
  /* MCU Configuration--------------------------------------------------------*/
 
  /* Reset of all peripherals, Initializes the Flash interface and the Systick. */
  HAL_Init();
 
  /* USER CODE BEGIN Init */
 
  /* USER CODE END Init */
 
  /* Configure the system clock */
  SystemClock_Config();
 
  /* USER CODE BEGIN SysInit */
 
  /* USER CODE END SysInit */
 
  /* Initialize all configured peripherals */
  MX_GPIO_Init();
  MX_DMA_Init();
  MX_USART1_UART_Init();
  MX_FMC_Init();
  /* USER CODE BEGIN 2 */
	HAL_UART_Receive_DMA(&huart1,gsm_rx_buf,sizeof(gsm_rx_buf));
	if(HAL_NAND_Read_ID(&hnand1, &my_nand_flash) != HAL_OK)
	{
		Error_Handler();
	}
 
  /* USER CODE END 2 */
 
  /* Infinite loop */
  /* USER CODE BEGIN WHILE */
  while (1)
  {
    /* USER CODE END WHILE */
 
    /* USER CODE BEGIN 3 */
  }
  /* USER CODE END 3 */
}

I used this document for timing and schematics.

https://www.st.com/resource/en/application_note/dm00228015-using-stm32l476486-fsmc-peripheral-to-drive-external-memories--stmicroelectronics.pdf

Hi @Arman Ilmak​ ,

Sorry for the delayed reply on this, I missed your reply.

I think your issue is related to the known limitation with CubeMX v6.3.0 when DMA is used: that the MX_DMA_Init() shall be called BEFORE any other peripheral initialization (Please see this post for more details).

I'll be waiting for your feedback and let me know if this solved your issue.

When your question is answered, please close this topic by choosing Select as Best.

Imen

When your question is answered, please close this topic by clicking "Accept as Solution".
Thanks
Imen

Hi again Imen

I tried everything about this nand flash thing but still the problem is not solved.

Im just using fmc without any other dma or nothing else but with keil mdk arm the debugger stops after i launch the read id line. Just the erase page works. even when i try write page the debugger stops working.

I tried the same code with cube ide. The debugger does not stop but the hole code not excecuting corectly when i use read id function.