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.

CCS/CCSTUDIO: Understanding bbb_pru_startup.js

Part Number: CCSTUDIO
Other Parts Discussed in Thread: AM3359, AM3358,

Tool/software: Code Composer Studio

Hi,

In order to use the Beagle Black Bone with Code Composer Studio ( that is : without Linux), a startup script 

bbb_pru_startup.js

seems to be required.

I find it difficult to understand why all this init stuff:

...

 //red led  = pru0 r30_3  ARM pin c12
   dsDAP_mem.writeData(0, 0x44e1099c, AM335X_PIN_OUTPUT | 5, 32); //mode 5

 //green led = pru0 r30_2 arm pin d12
   dsDAP_mem.writeData(0, 0x44e10998, AM335X_PIN_OUTPUT | 5, 32); //mode 5

...

must be done in the startup script. Can't this be done in the code ?

Could somebody guide me to the relevant part of the documentation ?

Thanks

Peter

  • Hello Peter,
    according to my understanding, your issue is related to
    Programmable Real-Time Unit Subsystem and Industrial Communication Subsystem (PRUICSS) on AM3359 processor.
    API provided by TI assumes, according to my reading, an initialization at startup.
    Refer to www.ti.com/.../toolssoftware
  • Yes , I know but that wasn't the question. Could you please re-read it ?
  • I am not a TI staff member.

    Quality of a question determines a quality of an answer.

    Garbage in, garbage out (gigo).

    Analyze startup script and refer to IPC related sections of the manual.

    Anytime you ask for help, please follow the first CCS forum rule:

  • Tom

    I didn't mean to be offensive and I never said your reponse was "garbage" nor did I expect you to be a staff member. I do appreciate your effort to help but please

    acknoledge that this effort is most effective when it relates to the question asked.

    It might well be that my question is garbage but in this case, I believe, it is not due to the lack of ceremony and red tape ( host OS, ) but rather to my lack of understanding of the PRU subsystem.

    I feel that the PRU subsystem is very powerful but also that there is  a lack of pratical information that makes it easier for new users to leverage that power

    especially in conjunction with the other cores on the Sitara processor.

    In fact, I have already done a first write-up  on the Beagle Bord (with the PRU)   pvittali.bitbucket.io/.../ and I would like to continue this little series with more practical infos on how to use the PRU simultaneously with other MCUs in a test setup. I want to control several processors with the DebugServer so that the PRU can be used to generate test signals agains another MCUs and therefore I do need to understand what goes on in the startup scripts.

    So maybe there are staff members out there who could answer the question ?

    Peter

  • Hello Peter,

    Peter Vittali said:

    I find it difficult to understand why all this init stuff:

    ...

     //red led  = pru0 r30_3  ARM pin c12
       dsDAP_mem.writeData(0, 0x44e1099c, AM335X_PIN_OUTPUT | 5, 32); //mode 5

     //green led = pru0 r30_2 arm pin d12
       dsDAP_mem.writeData(0, 0x44e10998, AM335X_PIN_OUTPUT | 5, 32); //mode 5

    ...

    must be done in the startup script. Can't this be done in the code ?

    It is often easier to get started using an initialization script (such as GEL or js) for target initialization (setting clocks, pin muxing, pulling save cores out of reset, etc). But you are correct that eventually such initialization will eventually have to be moved to your code when the program is run outside a CCS debug environment. I am not too familiar with this script or the PRU for this device, hence I will bring this thread to the attention of the SItara experts

    Thanks

    ki

  • Hi Peter,

    The two line code is to configure the pin c12/d12 in mode 5 (pr1_pru0_pru_r30_3/pr1_pru0_pru_r30_2, see Table 4-2. Pin Attributes of AM3358 data sheet) through the control module register (0x44e1099c/0x44e10998, see TRM Table 9-10. CONTROL_MODULE REGISTERS). Usually the pinmux is done in application with the files generated by pinmux tool (www.ti.com/.../PINMUXTOOL), for some particular application, this maybe manually configured like what you observed using the bbb_pru_startup.js script.

    Regards,
    Garrett
  • Hi Garret

    Thanks, I wasn't aware of the pinmuxtool, and from what I understand from @ki, part of this configuration could be done in application code.

    I want to port bbb_pru_startup.js to java but when I try to load the *.out file, I get a "data verification error".

    I wanted to reproduce this error in js by modifying the bbb_pru_startup.js  (see snipped bbb_pru_startup_load.js below).

    I get the following error:

    ❯ dss.sh bbb_pru_startup_load.js

    Connecting to DAP

    Configuring PRU pins

    Enabling ICSS clock

    Resetting ICSS

    Done

    SEVERE: CS_DAP_DebugSS: File Loader: Verification failed: Values at address 0x00000000@System_View do not match Please verify target memory and memory map.

    SEVERE: CS_DAP_DebugSS: GEL: File: /home/p/repo/cbrix/PRU-tutorial/Debug/PRU-tutorial.out: a data verification error occurred, file load failed.

    SEVERE: File: /home/p/repo/cbrix/PRU-tutorial/Debug/PRU-tutorial.out: a data verification error occurred, file load failed.

    SEVERE: Error loading "/home/p/repo/cbrix/PRU-tutorial/Debug/PRU-tutorial.out": File: /home/p/repo/cbrix/PRU-tutorial/Debug/PRU-tutorial.out: a data verification error occurred, file load failed.

    loadProgram failed: JavaException: com.ti.ccstudio.scripting.environment.ScriptingException: Error loading "/home/p/repo/cbrix/PRU-tutorial/Debug/PRU-tutorial.out": File: /home/p/repo/cbrix/PRU-tutorial/Debug/PRU-tutorial.out: a data verification error occurred, file load failed.

    The program "PRU-tutorial"  works fine  when I load it from CCS (with the original bbb_pru_startup.js as startup script).

    What does this error mean ?

    Thanks Peter

    the modified startup script:

    //****************************************************************************
    // BBB_PRU_STARTUP_LOAD.JS
    // Version 0.20.00
    // Released subject to the license at the end of this file
    //****************************************************************************

    .... snip

       //-------------------------------------------------------------------------
       // Get the Debug Server and start a Debug Session
       //-------------------------------------------------------------------------
       debugServer = script.getServer("DebugServer.1");

       //-------------------------------------------------------------------------
       // Open a session on the Debug Access Port (DAP)
       //-------------------------------------------------------------------------
       var deviceCCXMLFile = "/home/p/repo/cbrix/PRU-tutorial/targetConfigs/BeagleBone_Black.ccxml";

       debugServer.setConfig( deviceCCXMLFile );      // <<<<<<<<<<<<<<<<<<<<<<<<<<<<< CONFIG
       var debugSessionDAP = debugServer.openSession("*", "CS_DAP_DebugSS");

       //-------------------------------------------------------------------------
       // Connect to the DAP.  Error check.
       //-------------------------------------------------------------------------

      ... snip


       print("Done");
       // Load the program
       var programToLoad = "/home/p/repo/cbrix/PRU-tutorial/Debug/PRU-tutorial.out";

       try {
       debugSessionDAP.memory.loadProgram( programToLoad );  // <<<<<<<<<<<<<<<<<<<<  LOAD
       } catch (ex) {
         script.traceWrite("loadProgram failed: " + ex);
       }
    }

    //****************************************************************************
    // PRU_PINMUX_Config
    //****************************************************************************

    ... snip

    main.c

    /*
     * blink demo: blink LED ten times
     * LED should be connected to P8_11 (pr1_pru0_pru_r30_15)
     *
     */
    #include <stdint.h>
    volatile register uint32_t __R30;

    int main(void) {
        uint32_t gpo;

        while(1) {
            gpo = __R30;
            gpo ^= 0xF;
            __R30 = gpo;
            __delay_cycles(100000000);
        }
    }

  • Peter Vittali said:
    SEVERE: CS_DAP_DebugSS: File Loader: Verification failed: Values at address 0x00000000@System_View do not match Please verify target memory and memory map.

    The error has occurred because the script has tried to load a program onto the CS_DAP_DebugSS, rather than a PRU.

    The script needs to open a debug session on PRU, load the program to the PRU and then set the PRU running. E.g. by the following which was tested on a AM3359-SOM-EVB-IND

       // Load the program on PRU_0, and set it running
       var programToLoad = "Debug/AM3359_PRU_led_toggle.out";
    
       var debugSessionPRU_0 = debugServer.openSession("*", "PRU_0");
    
       print("Connecting to PRU_0");
       try
       {
          debugSessionPRU_0.target.connect();
       }
       catch (ex)
       {
          throw "Aborting!";
       }
    
       try {
       debugSessionPRU_0.memory.loadProgram( programToLoad );  // <<<<<<<<<<<<<<<<<<<<  LOAD
       } catch (ex) {
         script.traceWrite("loadProgram failed: " + ex);
       }
       debugSessionPRU_0.target.runAsynch();
       print("PRU_0 running");

    An example of using a script to load and run a program on PRU_0 produced the following:

    AM3359_PRU_led_toggle$ ~/ti/ccs830/ccsv8/ccs_base/scripting/bin/dss.sh am335x-som-evb-pru-startup.js 
    Connecting to DAP
    Enabling JTAG clock
    Configuring PRU pins
    Enabling ICSS clock
    Resetting ICSS
    Done
    Connecting to PRU_0
    PRU_0 running

    The example project with a PRU led toggle program and the am335x-som-evb-pru-startup.js is attached. AM3359_PRU_led_toggle.zip

    Note that this example was created for an AM3359-SOM-EVB-IND which has a different pin-out from a BeagleBone black + PRU cape, so you won't be able to run directly without modifying the pins used, but does demonstrate using a dss script to configure and load a PRU program.

  • Excellent Chester, thank you.

    So why does the orginal bbb_pru_startup.js (to be used from within CCS) works by opening the session on CS_DAP_DebugSS ?

    Wha exactly is CS_DAP_DebugSS ?

    Thanks

    Peter

  • Peter Vittali said:
    Wha exactly is CS_DAP_DebugSS ?

    CS_DAP_DebugSS is an ARM CS_DAP (CoreSight Debug Access Port) which allows debug access.

    At device reset the PRU's are held in reset.

    The original bbb_pru_startup.js opens a session to the CS_DAP_DebugSS to configure the pin mux, enable the PRU clocks and release the PRU's from reset and configure the clocks.

    My example modification to the script then opened as a session to PRU_0 to download a program to the PRU.

  • and so the relevant info is in the ARM infocenter.

    Many thanks

    Peter