If Pin0 on the NHS3152 is programed then it gets bricked?

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

If Pin0 on the NHS3152 is programed then it gets bricked?

Jump to solution
2,828 Views
WhyNotWork
Contributor I

I was playing around with the GPIOs of the NHS3152. Everything worked fine when I was working with pin 3 and 5. However, When I tried to program pin0, it just got detached (not physically but in the software, I hard my computer make the detachment voice.) Now when I go to flashmagic and select the NHS board. it doesn't get selected and I hear detached voice again. I don't see it in the device manager. However, the Blinky Program (that is attached below) keeps on running constantly. So, I am assuming its not in the deep power down mode.

My theory:

The chip is some sort of Semi- Deep sleep mode where only the the bit that is needed for flashing the chip isn't on.

Then I came across this:

2021-09-15 16_48_39-NHS31xx SW API_ SW Debug Considerations — Mozilla Firefox.png

Now I don't know what is wrong with my board.

I feel like I have tried everything.

Is there a way to fix it? Please take a look at the code below.

This is my second board.

0 Kudos
1 Solution
2,613 Views
driesmoors
NXP Employee
NXP Employee

Hi,

The suggestions from @Kan_Li are very much worth a try. Looking at the code you posted, they are unlikely to revive your IC.

As @Kan_Li said, the SWD debugger is unable to connect with the IC due to the reconfiguration of PIO 11.

What happens:

  • The IC gets a reset signal and starts.
  • After a little less than 3 ms, the bootloader has finished loading. Its last actions are to open up SWD access (I assume no CRP is in use) and to transfer control to your main function.
  • A few instructions later SWD access is blocked again by calling 
    Chip_IOCON_SetPinConfig(NSS_IOCON, IOCON_PIO0_11, IOCON_FUNC_0 | IOCON_RMODE_INACT);

This means that a debugger has about a tenth of a millisecond to make the connection and halt the ARM core. In practice, this is impossible to time. The IC is effectively bricked and cannot be recovered.

After replacing the IC, I highly suggest to add a wait line as the first action in main:

Chip_Clock_System_BusyWait_ms(1000);

or similar. This will give you a break-in window of 1 second after a reset, regardless of your experiments later on.

Kind regards,
Dries.

 

View solution in original post

13 Replies
2,814 Views
Kan_Li
NXP TechSupport
NXP TechSupport

Hi @WhyNotWork ,

 

Have you got a LPC-LINK 2 board to work with flash magic? Indeed if the LPC-LINK 2 board works well , it can be detected by flash magic even it is not connected with the NHS board.

 

Hope that helps,

 

Have a great day,
Kan


-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!
- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 Kudos
2,804 Views
WhyNotWork
Contributor I

Hi Ken,

Thanks for the response.

Yes, I am using the LPC-Link-2

WhyNotWork_0-1631841400936.png

The above is the setup.

When I connect the LPC-link-2, it gets connects. But when I switch the board (in Flash Magic) to NHS3152 the board gets disconnected.

Everything worked well until the code (attached in the last post) was uploaded.

Is there anyway I can physically do a hard reset?

Thanks!

 

0 Kudos
2,614 Views
driesmoors
NXP Employee
NXP Employee

Hi,

The suggestions from @Kan_Li are very much worth a try. Looking at the code you posted, they are unlikely to revive your IC.

As @Kan_Li said, the SWD debugger is unable to connect with the IC due to the reconfiguration of PIO 11.

What happens:

  • The IC gets a reset signal and starts.
  • After a little less than 3 ms, the bootloader has finished loading. Its last actions are to open up SWD access (I assume no CRP is in use) and to transfer control to your main function.
  • A few instructions later SWD access is blocked again by calling 
    Chip_IOCON_SetPinConfig(NSS_IOCON, IOCON_PIO0_11, IOCON_FUNC_0 | IOCON_RMODE_INACT);

This means that a debugger has about a tenth of a millisecond to make the connection and halt the ARM core. In practice, this is impossible to time. The IC is effectively bricked and cannot be recovered.

After replacing the IC, I highly suggest to add a wait line as the first action in main:

Chip_Clock_System_BusyWait_ms(1000);

or similar. This will give you a break-in window of 1 second after a reset, regardless of your experiments later on.

Kind regards,
Dries.

 

2,608 Views
WhyNotWork
Contributor I

Hey Dries,

Yup, this makes sense!

I will make sure to add the following line to the main function so that I don't brick another one!

Chip_Clock_System_BusyWait_ms(1000);

Thanks for the response, I really appreciate it..

I hope you have a great day

0 Kudos
2,799 Views
Kan_Li
NXP TechSupport
NXP TechSupport

Hi @WhyNotWork ,

 

The button on the board can be used to reset the device, please kindly refer to the following for details.

Kan_Li_0-1631859521469.png

 

Have a great day,
Kan


-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!
- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

 

0 Kudos
2,786 Views
WhyNotWork
Contributor I

Hello,

So, I tried to do that but it doesn't reset the chip.  Is it supposed to delete the code that is already present on the chip?

Because it keeps the code intact (as it mentioned before, I am running a basic blinky code. it just keeps on doing that. it should ideally not do anything after I press the reset button, right?)

0 Kudos
2,754 Views
Kan_Li
NXP TechSupport
NXP TechSupport

Hi @WhyNotWork ,

 

No, Reset is just used to reset the device, and the device starts to run the application once out of reset. If you want to delete the code inside, you have to perform mass erase on this device.

 

Have a great day,
Kan


-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!
- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 Kudos
2,746 Views
WhyNotWork
Contributor I

How do I perform mass erase on the device?

I am not able to program the chip at all right now. 

0 Kudos
2,681 Views
Kan_Li
NXP TechSupport
NXP TechSupport

Hello @WhyNotWork ,

 

From the code you shared in SFDC, you changed SWDIO to GPIO function, that is the root cause why you can not program the device any more, therefore Flash Magic can not be connected with the device since the SWD interface lack the IO pin. The easiest way is replacing the IC on your board, alternatively you may press the reset button before Flash Magic perform mass erase operation, and release the reset button right after mass erase operation is issued, there might be chance for Flash Magic to take charge of your device before your code changes SWDIO to GPIO pin.

 

Hope that makes sense,

 

Have a great day,
Kan


-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!
- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 Kudos
2,674 Views
WhyNotWork
Contributor I

WhyNotWork_0-1632686909138.png

This is the error I get. Its the same error I get when I don't press the reset button.

I really don't want to buy another chip as I have already have multiple boards

I hope there is a way to fix this

0 Kudos
2,659 Views
Kan_Li
NXP TechSupport
NXP TechSupport

Hi @WhyNotWork ,

If that fails: using a Segger J-Link base debug probe with a J-Link Adapter CortexM can reset the core, and halt it before the reprogramming of the SWDIO pin takes place. The LPCXpresso IDE is not fast enough to do this, but a J_link may be.
Using the cli interface:
si 1 (select SWD as interface)
device NHS3100
r (try to connect, reset and halt)
If that succeeds:
erase

 

Hope that helps,

 

Have a great day,
Kan


-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!
- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 Kudos
2,610 Views
WhyNotWork
Contributor I

So, you are suggesting to buy something like this to debug the problem?

https://shop-us.segger.com/J_Link_p/8.08.00.htm

0 Kudos
2,542 Views
driesmoors
NXP Employee
NXP Employee

The Segger J-Link BASE works very well together with the NHS31xx ICs. Its interface works fast and reliably. When timing is critical, you have a much bigger chance to be abel to halt the core using the cli of the J-Link BASE (or using Flashmagic). Trying this through the LPC/MCUXpresso IDE is always a much slower process.

Note that you can also use LPCSrypt to flash Segger debugger firmware on the LPC-Link2 debugger (afterwards, fit JP1 and reset). More information can be found here.

/D

0 Kudos