cancel
Showing results for 
Search instead for 
Did you mean: 

SWD lost when accessing NAND via FMC

Brian H
Senior

Hello.  I am working with a STM32H563IIKX, connected to an external Macronix MX30LF2G28AD NAND Flash chip.  I have configured the FMC for NAND operation with what I think are correct parameters (this is completely new to me).

I thought I'd try a very simple test to see if communication with the external NAND is working at all.  After all of the auto-generated MX_xxxx_Init() calls in main(), I added this:

 

NAND_IDTypeDef nandID = { 0 };
HAL_StatusTypeDef nand_rc = HAL_NAND_Read_ID(&hnand1, &nandID);

 

Once I "step over" the call to HAL_NAND_Read_ID, SWD loses connection ("Target is not responding, retrying..." until it gives up).

If I step into HAL_NAND_Read_ID, SWD is lost specifically at this line:

data = *(__IO uint32_t *)deviceaddress;

Is this expected behavior?  Is SWD somehow incompatible with FMC-NAND?  Or is this possibly just an indication that my NAND parameters (or wiring) is wrong?  What other information should I provide to help diagnose this?

1 REPLY 1

>> What other information should I provide to help diagnose this?

The address it's attempting to read, and the pins you're using for the interface.

Have a HardFault_Handler() that can output to a serial port, independently of the debug interface.

Some of the high order address pins might be involved in the Trace port, but you're not indicating that you're using that, just the SWD so probably PA13, PA14, PB3 involved there.

Is the hnand1 structure fully initialized and within scope?

 

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