Getting hardfault error while writing data to internal EEPROM of LPC54606

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Getting hardfault error while writing data to internal EEPROM of LPC54606

5,345 Views
emb02
Contributor IV

Hi,

I'm testing internal EEPROM of LPC54606 in which I want to write 64 bytes using EEPROM_Write() function. But after calling EEPROM_Write() function, I'm getting hardfault error.

In Chapter 47: LPC546xx EEPROM memory (UM10912) AUTOPROG mode is mentioned.

I'm using AUTOPROG = 01: Writing a single word to the page starts the erase/program cycle
automatically. This mode is useful store small data items (word) on random locations.

But I'm not able to get steps to do the same.

Can you provide example code for this configuration (AUTOPROG = 01) using EEPROM_Write().

I have also attached my test project please guide me with this.

0 Kudos
Reply
21 Replies

5,223 Views
emb02
Contributor IV

Hi, @Alex_Wang 

After using this configuration config.autoProgram = kEEPROM_AutoProgramLastWord,

I'm able to write EEPROM data successfully.

But after that I'm not able to connect controller via SWD, J-Link says it Could not establish a connection to target.

 Jlink error.PNG

I'm able to erase and program same controller via ISP using Flash magic and it works fine. 

ECRP settings are also ok (CRP is disabled). But not able to debug it using J-Link.

This is our second board in which we are facing this same problem. For few days it works fine but after that I'm not able to connect it using J-Link.

After downloading EEPROM test project this problem has occurred. But my pin settings seem to be okay and previously I was able to download same code with same settings without any problem.

I've gone through this thread https://community.nxp.com/t5/LPC-Microcontrollers/LPC546XX-SWD-Locked/m-p/1454331/page/2 but still not getting what to do next. Please guide me further.

0 Kudos
Reply

5,191 Views
Alex_Wang
NXP Employee
NXP Employee

Hi, @emb02 

        According to your description, I have carried out the same configuration on LPC54628, EEPROM read and write successfully, and JLink SWD debugging has no problem.

       I want to know if SWD and J-Link cannot be used only when the configuration "config.autoProgram = kEEPROM_AutoProgramLastWord" is downloaded. Is it normal to download other programs?

       I suggest that you can delete the.metadata file in the IDE workspace and then open the IDE import project to download. Save all projects in your workspace before doing this, and all projects need to be imported back into the IDE.

.metadata folder path: C:\Users\nxg04589\Documents\MCUXpressoIDE_11.9.0_2144\workspace1

Best regards, Alex

0 Kudos
Reply

5,188 Views
emb02
Contributor IV

Hi, @Alex_Wang 

 

I want to know if SWD and J-Link cannot be used only when the configuration "config.autoProgram = kEEPROM_AutoProgramLastWord" is downloaded. Is it normal to download other programs?

-> No, not able to download other programs using J-Link. I'm also not able to connect controller via SWD/J-Link using J-Flash even after erasing controller using Flash magic (via ISP).

Jlink error.PNG

 

0 Kudos
Reply

5,182 Views
Alex_Wang
NXP Employee
NXP Employee

Hi, @emb02 

        Can't the chip target be detected under ISP mode erase? Is it possible to download and debug other chips using mcuxpresso IDE? Can you download and debug normally with other boards?

       In my opinion, I think the problem is the IDE. Have you tried again as I did above? (Delete the.metedata folder)

Best regards, Alex

 

0 Kudos
Reply

5,180 Views
emb02
Contributor IV

Hi, @Alex_Wang 

Is it possible to download and debug other chips using mcuxpresso IDE? Can you download and debug normally with other boards?

-> I don't have another board.

Have you tried again as I did above? (Delete the.metedata folder)

-> Yes, but getting same problem.

Jlink error 1.PNG

 

0 Kudos
Reply

5,178 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello @emb02 

After erased, recommend program a simple project like LED to test.

BTW, what debugger do you used? J-link or  MCU-link with Jlink probe? 

There is no relationship with EEPROM.

 

BR

Alice

0 Kudos
Reply

5,172 Views
emb02
Contributor IV

Hi, @Alice_Yang 

After erased, recommend program a simple project like LED to test.
-> I'm not able to program or connect the controller using J-link.

Jlink error 2.PNG

And if I program using Flash magic in ISP mode then it's working fine.

BTW, what debugger do you used? J-link or MCU-link with Jlink probe?
-> I'm using J-link debugger.

There is no relationship with EEPROM.

-> Yes, but after downloading EEPROM Test code I'm not able to establish J-Link connection. And this same problem occurred in two controllers.

If I want to know SWD access is enabled or disabled is there any way to check this?

0 Kudos
Reply

5,114 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello @emb02 

Checking ECRP configuration can know SWD access is enabled or disabled. But, if you use LED demo, did not change ECRP setting, the default configuration is enabled. 

Detail you can check "Table 1022.ECRP feature controls" of UM1-912.

How about use J-link commander to connect your board? 

How about use your j-link connect other boards? 

 

BR

Alice

0 Kudos
Reply

5,078 Views
emb02
Contributor IV

Hi, @Alice_Yang 

Checking ECRP configuration can know SWD access is enabled or disabled. But, if you use LED demo, did not change ECRP setting, the default configuration is enabled. 

-> I have downloaded LED demo code using flash magic but still not able to access the controller through SWD.

Also after reading device memory using flash magic, data at location 0x20h indicates default configuration of ECRP bits.

memory.PNG

How about use J-link commander to connect your board? 

-> Getting same result - Cannot connect to target.

Jlink commander.PNG

How about use your j-link connect other boards? 

-> Yes, J-link easily connects to other boards.

 

Why I'm not able to connect my both controllers using J-Link if SWD access is enabled?

 

 

0 Kudos
Reply

5,038 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello @emb02 

Check SWD port design: 

https://community.nxp.com/thread/388998 

 

BR

Alice

0 Kudos
Reply

5,032 Views
emb02
Contributor IV

Hi, @Alice_Yang 

There is no problem with hardware. I've configured SWD pins as GPIO and it's working fine.

Previously both boards were working fine and I was able to erase, program and debug using SWD for multiple times. But after few days both boards were not able to connect to J-Link.

 

 

0 Kudos
Reply

4,856 Views
emb02
Contributor IV

Hi, @Alice_Yang

Please guide me further. I'm not able to use my boards for debugging purpose.

0 Kudos
Reply

4,795 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello @emb02 

I still recommend you check hardware, or change anther debugger to test.

Erase full flash, then debug a simple led project to test.

 

BR

Alice

0 Kudos
Reply

4,768 Views
emb02
Contributor IV

Hi, @Alice_Yang 

I still recommend you check hardware, or change anther debugger to test.
-> I've checked hardware, its all connections and it is ok.
I can easily erase/download any code using Flash magic in ISP mode(UART).
All other peripherals i.e. CAN, UART, GPIO are working properly.
I am able to toggle SWD pins if configured as GPIO and it is also working fine.

I've used two different debuggers J-link and PE-Micro but not able to connect. I can connect other boards using this debugger but not LPC54606 boards.

Erase full flash, then debug a simple led project to test.
-> Even after erasing full flash I am not able to debug led project in MCUXpresso.
I've erased flash and then downloaded led code using flash magic but still not able to connect to J-Link.

Previously I was using one board which was working well until I've downloaded EEPROM code. Then that board didn't connected to J-Link yet.
I've tried connecting it using different tools like J-Flash, J-Flash Lite, J-Link Commander but failed.
I've checked security bits setting but that is also ok. I can read security using flash magic which says CRP is disabled.

After that I've used 2nd board and it was also working fine but after downloading EEPROM code same problem arrived in second board too.

Now I'm not able to debug any board and not able to test anything.
But I've noticed that after downloading EEPROM code I'm experiencing this problem.

0 Kudos
Reply

4,704 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello @emb02 

While I'm sure this has nothing to do with EEPROM.

1) How about entering ISP mode without exit, then use j-link connect. If still can't work, take a video show your detail steps.

2)Share your schematic.

 

BR

Alice

 

0 Kudos
Reply

4,690 Views
emb02
Contributor IV

Hi @Alice_Yang
I have sent video and schematics as a private message. Please guide me further.

0 Kudos
Reply

4,535 Views
emb02
Contributor IV

Hi @Alice_Yang
Did you received the video and schematics which I have sent as private message?
If yes please guide me further. 

0 Kudos
Reply

4,483 Views
emb02
Contributor IV

Hi @Alice_Yang@Alex_Wang 

 

Link of video (includes steps performed while testing): 

https://mega.nz/file/7FUQnY4K#pnEcDmd6nyGrlJK_hpGwvBSKaGxSAnk2Z5qE-6Ws4ws  

Steps:

1. Interval 00:00 - Entering into ISP mode by shorting ISP pin to ground. Then erasing flash and downloading hex file using flash magic. (code is to toggle GPIO)
2. Interval 30:00 - Resetting unit and verifying GPIO toggle.
First checking voltage at SWCLK pin which toggles in 2 sec.
Then checking voltage at SWDIO pin which also toggles in 2 sec.
3. Interval 01:05 - Resetting unit, Entering into ISP mode, reading device signature (to check device is in ISP mode).
Then connecting to J-Link (debugging project) but getting error as Could not connect to target.
4. Interval 01:45 - Resetting unit, Entering into ISP mode and erasing flash.
Then connecting to J-Link (debugging project) but still getting same error as Could not connect to target.

emb02_0-1712729055658.png

 

My both boards are working well (including all peripherals GPIO, UART, CAN) except SWD access. Previously I was able to debug the code using J-link but after downloading EEPROM_Test project (find in attachment) I'm not able to connect to J-Link. Can you check the project and guide me if project is not configured properly.

Please find attached project and schematics.

 

Regards,

EMB02

 

0 Kudos
Reply

4,071 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello @emb02 

After erase flash, still can not connect. So it is not he issue with your project code.

1) Check your hardware design refer to thread I send you before. Also can refer to LPCxpresso54628-evk board.

2) Where did you buy the chips?

 

BR

Alice

0 Kudos
Reply

4,057 Views
emb02
Contributor IV

Hi @Alice_Yang 

1) Check your hardware design refer to thread I send you before. Also can refer to LPCxpresso54628-evk board.

-> I've attached circuit schematic please verify. Previously I was able to debug using SWD pins for 1-2 months that indicates hardware design is ok. We have tested all peripherals and they are working fine. Only EEPROM testing was pending but after downloading EEPROM project I'm not able debug further. We already not able to use two controllers for debugging so we can't take risk with another controllers.

Please check and verify EEPROM example project and guide me further.

2) Where did you buy the chips?

-> We have purchased sample chips from NXP.

Please guide me with this.

0 Kudos
Reply