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.

PRU write to configuration register failed

This is an example about CAN bus,  

it can run through the the function which contains some statements like 

```

HWREG (SOC_CM_PER_REGS + CM_PER_L3S_CLKSTCTRL) =

CM_PER_L3S_CLKSTCTRL_CLKTRCTRL_SW_WKUP;

```

if I use CLI generate the .bin file , it will runs well.

but if debug the program using .out file in CCS it will get stuck at such statements,

then can not do anything.but if it is the shared memory, it will still be OK, like: 

```

HWREG(0x00012004) = 0x1234;

```

what's wrong with it? Is it a bug in CCS  or there are something important I did not notice???

 

  • It sounds like the OCP master port may not be enabled (described here).  I see that your code is initializing the OCP port, but can you set a break point before the hang and confirm that the OCP port is truly enabled in the Memory Browser window?

    Regards,

    Melissa

  • Thanks , it works.

    This is an example of  TI pru-software-support-package, I've added OCP part, but the registers keep the same after I run the code, Could you confirm the code is correct or not?

    and also for the register access, what's the difference of HWREG() and "

    volatile far pruUart CT_UART __attribute__((cregister("PRU_UART0", near), peripheral));

    "

  • The OCP enable code snippet in the example you pointed to looks okay.  Can you clarify what registers are staying the same?   Also, I see that you are calling UARTPinMuxSetup.  Please note that the PRU cannot edit pinmux settings (see this FAQ). 

    The cregister attribute provides support for using the PRU constant registers.  The PRU constant table is described in the TRM.  In short, this table is a structure of hard-coded memory addresses for commonly used peripherals and memories. The cregister attribute is described in the PRU C-compiler user guide (available here).

    Regards,

    Melissa