cancel
Showing results for 
Search instead for 
Did you mean: 

PSoC 4 MCU

JoWi_3984961
New Contributor II

Is there a direct way to reset the entire PSOC 4 from SW? Using no external components?

Apart from the WDT, if that even does it?

0 Likes
16 Replies
JoMe_264151
Expert II

Call the CySoftwareReset() API. Look intothe "System Reference Guide" from Creator Help menu.

Happy coding

Bob

0 Likes
JoWi_3984961
New Contributor II

I may have to reset all the DMA parts and pieces?

What is the fastest way to totally make it happy for a new initialization?

I basically need to initialize all the things I initialized.

Of course, they are in worse shape than when I started!

0 Likes
himam_31
Employee

In case of DMA, you should free the already allocated channels using API CyDmaChFree() before re initializing. Can you try using this API and not reset the system. If you use this API then DMA channel will get freed and you can allocate it again.

Thanks,

Hima

0 Likes
JoWi_3984961
New Contributor II

Uh oh.

Stepped into

CyDmaChFree

Got there just fine.

Then I read the sign

If sw allocated it is fine.

Schematic instances NOT

>

0 Likes
himam_31
Employee

Can you give more details on the issue you are facing currently.

Thanks,

Hima

0 Likes
JoWi_3984961
New Contributor II

An example of running a dma, letting the dma run out of descriptors it can use in simple ping pong mode due to halting the system with the debugger, then the system recovering the dma operation after resuming program running would suffice for me. I can grok examples. Thanks! You know some debuggers do that FOR you.

Ideally without reseting EVERYTHING. I don’t like tower of Hanoi.

0 Likes
JoWi_3984961
New Contributor II

I'm still waiting for your example of recovering a DMA that has run out of descriptors.  Here is how you can make it happen.

Set up a DMA that runs ping pong back and forth without stopping, forever, at a 100000 Hertz rate, driven by a clock at that speed.

Insert a breakpoint using the debugger.  The debugger will stop the DMA as soon as you try to set it.

Now, try to recover the DMA action.

How is that going?

0 Likes
JoWi_3984961
New Contributor II

The softreset does not reset the peripherals and the logic.

How do you do that, apart from invoking the WDT?

0 Likes
BiBi_1928986
Contributor II

If you are using a bootloader, you can call the function:

Bootloader_Start()

See AN73854, Calling the Bootloader.  It will perform a reset of registers and presumably, all logic blocks.  When the bootloader times out, it will perform another reset and then call the bootloadable application.

Hope this works for you.
Bill

0 Likes
JoWi_3984961
New Contributor II

Hi Bill,

I’m not using a bootloader, yet. However, it sounds as if the functions I need may be derived at least in part, from the source code used to produce that to which you refer.

Where might I find such existential source code?

0 Likes
BiBi_1928986
Contributor II

Hello John.

I use KIT-049-42xx that uses a UART (SCB) bootloader.  You would need to load the KIT files in order to see the UART bootloader source code.  To save you the trouble, I did some digging into Bootloader code.

main.c calls bootloader_start (located in bootloader.c)

bootloader_start, after checking for a valid load in FLASH and other house keeping, calls..., believe it or not, CySoftwareReset() (located in CyLib.c)

void CySoftwareReset(void)

{

    /***************************************************************************

    * Setting the system reset request bit. The vector key value must be written

    * to the register, otherwise the register write is unpredictable.

    ***************************************************************************/

    CY_SYS_CM0_AIRCR_REG = (CY_SYS_CM0_AIRCR_REG & (uint32)(~CY_SYS_CM0_AIRCR_VECTKEY_MASK)) |

                            CY_SYS_CM0_AIRCR_VECTKEY | CY_SYS_CM0_AIRCR_SYSRESETREQ;

}

Sorry to say, but you might be right back to where you started.  It makes me wonder if WDT would do anything different (albeit, invoked by H/W).

Bill

0 Likes
JoWi_3984961
New Contributor II

Thank you! Perhaps the application engineers can

Get this information out of the PSOC engineers?

0 Likes
BiBi_1928986
Contributor II

Hello John.

Another possible path to test.  It's not a true h/w reset, but maybe as close as it gets invoked via s/w.

How about jumping through the SROM Reset vector?

It's documented in PSoc 4200 Architecture TRM (I've assumed you're using a 42xx family device).

https://www.cypress.com/file/126171/download

The details are in section 5.3.3 Exception Vector Table and section 5.4.1 Reset Exception.

You'll need to read details of register CPUSS_CONFIG and CPUSS_SYSREQ to clear VECT_IN_RAM and clear NO_RST_OVR, respectively.

Let us know the results (good or bad).

Bill

0 Likes
JoWi_3984961
New Contributor II

I’d rather not experiment. I have limited hw resources. Just tell me if I can reset it or not.

0 Likes