This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Difference between SLP and WBS instructions

Hello,

In PRUSS documentation at PRU Assembly Instructions I found two similar instructions: SLP and WBS. Both can be used to monitor bit change in R31 register.

What difference in these instructions?

When I need to use SLP instruction and when WBS?

How long time need PRUSS to wakeup after SLP?

  • Hi,

    Thanks for your post.

    I think, both the instructions SLP and WBS are explicitly different in their functionality. If you see WBS instruction, it polls or spins for a status bit until the bit is set where as SLP instruction would sleep the PRU which causes to disable its clock  and you could specify it for a "permanent sleep" or "wake on event"

    The format for both the instructions are as below:

    wbs     r31, r1     // Spin here while ( !(r31&(1<<r1)) )

    wbs     r31.b1, 5   // Spin here while ( !(r31.b1 & 1<<5) )

    SLP  0    // Sleep without wake events

    SLP  1    // Sleep until wake event set

    SLP pauses execution of the current program and disables the clock for the majority of the core. SLP instruction would sleep the PRU until a specified external event (un-masked status bit) is asserted to wakeup after SLP.

    The PRUSS documentation (peripheral guide) is on the external wiki: http://processors.wiki.ti.com/index.php/Programmable_Realtime_Unit

    The PRU Software Development Package (http://focus.ti.com/docs/toolsw/folders/print/sprc940.html) contains a number of PRU example codes that interact with the DSP. You could also try it out.

    Thanks & regards,

    Sivaraj K

    -------------------------------------------------------------------------------------------------------

    Please click the Verify Answer button on this post if it answers your question.

    -------------------------------------------------------------------------------------------------------

  • Sivaraj, thank you for reply.

    Yes I know that WBS is pseudo instruction and will be replaced with QBBC on compile. But WBS for R31 is equivalent to SLP 1. It will wait for bit set (event) in R31 register too.

    For example, if I have external 100kHz clock signal connected to R31 GPIO. Which instruction I must use to monitor this signal? Is it good practice to sleep PRU for several usec?