Announcements

Help us improve the Power & Sensing Selection Guide. Share feedback

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Ramesh_R
Level 1
Level 1
5 replies posted 25 sign-ins 5 questions asked

Hi,

I am working on a multiple microcontroller based project in which I have two PSoC5 microcontrollers. Currently when a WDT timeout occurs in one of the microcontroller, reset occurs only for that chip. I need to perform a system level (both the microcontrollers) need to be reset when a WDT time out occurs in either of the microcontrollers.

I came across various posts in which it mentions that if the value of CyResetStatus variable is read before bootloader exexcutes the application code this can be read. But all the time I am only getting the value of CyResetStatus as 0X80 or 0XA0.

Is there a way to read the reason for reset and save the status into the internal EEPROM location. 

CY8C5868AXI-LP035 

Can someone help me in addressing the issue?

Thanks in advance.

0 Likes
1 Solution
Len_CONSULTRON
Level 9
Level 9
Beta tester 500 solutions authored 1000 replies posted

@Ramesh_R ,

When the CPU resets, it executes its' Reset() vector.

A few lines down, the RESET Status register (32bits) is read (and then automatically cleared) an stored temporarily in another unused 32bit register.

*(reg32 *)(CYREG_PHUB_CFGMEM23_CFG1) = *(reg32 *)(CYREG_RESET_SR0);

Then the bootloader is run if it exists.   (You've indicated it exists in your project.)

Sometime before main() gets called, initialize_psoc(void) is called.  In this routine, CyResetStatus global variable gets set with the LSB of what was the RESET Status Registers at Reset.  Note:  This value is temporarily stored in CYREG_PHUB_CFGMEM23_CFG1 and now loaded into CyResetStatus.

CyResetStatus = CY_GET_REG8(CYREG_PHUB_CFGMEM23_CFG1);

As long as the bootloader leaves the CYREG_PHUB_CFGMEM23_CFG1 alone, CyResetStatus should reflect the reset reason.

Here's another observation:  You noted "But all the time I am only getting the value of CyResetStatus as 0X80 or 0XA0."   

Len_CONSULTRON_0-1695125274649.png

The bits set are the msb 2 bits of the register which are user controllable.  These are bits your application (or bootloader) can set to be preserved across soft resets.

I suggest you check your bootloader to see if it modifies the CYREG_PHUB_CFGMEM23_CFG1 register or CyResetStatus variable before it gives up control.

Len
"Engineering is an Art. The Art of Compromise."

View solution in original post

0 Likes
3 Replies
Len_CONSULTRON
Level 9
Level 9
Beta tester 500 solutions authored 1000 replies posted

@Ramesh_R ,

When the CPU resets, it executes its' Reset() vector.

A few lines down, the RESET Status register (32bits) is read (and then automatically cleared) an stored temporarily in another unused 32bit register.

*(reg32 *)(CYREG_PHUB_CFGMEM23_CFG1) = *(reg32 *)(CYREG_RESET_SR0);

Then the bootloader is run if it exists.   (You've indicated it exists in your project.)

Sometime before main() gets called, initialize_psoc(void) is called.  In this routine, CyResetStatus global variable gets set with the LSB of what was the RESET Status Registers at Reset.  Note:  This value is temporarily stored in CYREG_PHUB_CFGMEM23_CFG1 and now loaded into CyResetStatus.

CyResetStatus = CY_GET_REG8(CYREG_PHUB_CFGMEM23_CFG1);

As long as the bootloader leaves the CYREG_PHUB_CFGMEM23_CFG1 alone, CyResetStatus should reflect the reset reason.

Here's another observation:  You noted "But all the time I am only getting the value of CyResetStatus as 0X80 or 0XA0."   

Len_CONSULTRON_0-1695125274649.png

The bits set are the msb 2 bits of the register which are user controllable.  These are bits your application (or bootloader) can set to be preserved across soft resets.

I suggest you check your bootloader to see if it modifies the CYREG_PHUB_CFGMEM23_CFG1 register or CyResetStatus variable before it gives up control.

Len
"Engineering is an Art. The Art of Compromise."
0 Likes
Len_CONSULTRON
Level 9
Level 9
Beta tester 500 solutions authored 1000 replies posted

@Ramesh_R ,

Other forum users have had issues with CyResetStatus.

Here's are search results of the forum for 'similar' issues:  Search for CyResetStatus 

Len
"Engineering is an Art. The Art of Compromise."
0 Likes
Len_CONSULTRON
Level 9
Level 9
Beta tester 500 solutions authored 1000 replies posted

@Ramesh_R ,

Attached is a very simple project for the Cy8CKIT-059 that generates either a SW reset or a WDT reset (by uncommenting one line) event.

It prints out the CyResetStatus value after it enters main().  It seems to work on my system as expected.

My guess on your issue:  The bootloader you are using is changing the CyResetStatus value before it enters main().

Review your bootloader code.

Len
"Engineering is an Art. The Art of Compromise."
0 Likes