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.

AM3358: PRU initialization problem

Part Number: AM3358

I have a TI-RTOS application running on a BeagleBone Black. 

Below is the versions of the tools I'm using.

CCS 8.2.0

AM335x PDK v1.0.14

SYS/BIOS v6.7.2.00

EDMA3 2.12.5

XDCTools v3.51.1.18

Compiler: GNU v7.3.1 (Linaro)

In my application I'm able to initialize PRU1, load an application and receive and interrupt from the PRU.  However when I changed it to use PRU0, I get an access violation on the call to PRUISS_create. 

 

PRUICSS_Config *pruss_config;

PRUICSS_socGetInitCfg(&pruss_config);

/* Creates handle for PRUICSS instance */

PRU_handle = PRUICSS_create(pruss_config, PRUICCSS_PRU0);  <----------- Crashes here when using PRU0

/* Disable PRUICSS instance */

PRUICSS_pruDisable(PRU_handle, PRUICCSS_PRU0);

/* Register an Interrupt Handler for an event */

PRUICSS_registerIrqHandler(PRU_handle, PRU_EVTOUT0, 20, 19, 1, rx_callback);

/* Sets the buffer pointer for PRU */

PRUICSS_setPRUBuffer(PRU_handle, PRUICCSS_PRU0, pru_code, sizeof(pru_code));

/* Execute program on PRU */

PRUICSS_pruExecProgram(PRU_handle, PRUICCSS_PRU0);

/* Enable PRU */

PRUICSS_pruEnable(PRU_handle, PRUICCSS_PRU0);

 

As I said, it work great when using PRU1, but when I changed it to PRU0 it crashes.

 

 

  • Hi Shawn,

    Can you please try to add pruicss_drv.c into your RTOS project and step into PRUICSS_create()?

    Regards,
    Garrett

  • Hi Garrett,

    Thanks for the reply.  The PRUICSS_create() function is as follows:

    PRUICSS_Handle PRUICSS_create(PRUICSS_Config *config, int32_t instance)
    {
    PRUICSS_Handle handle;
    PRUICSS_V1_Object *object;
    PRUICSS_HwAttrs const *hwAttrs;
    uintptr_t temp_addr = 0U;
    uint32_t temp_val;

    handle = (PRUICSS_Config *)&config[instance-1];
    hwAttrs = (PRUICSS_HwAttrs const *)handle->hwAttrs;
    object = (PRUICSS_V1_Object*)handle->object;
    object->instance = instance;
    temp_addr = (hwAttrs->prussCfgRegBase + CSL_ICSSCFG_REVID);
    temp_val = CSL_REG32_RD(temp_addr) & 0xFFFFU;
    object->pruicss_version = temp_val;
    return(&config[instance-1]);

    }

    The application is calling it like so:

    PRU_handle = PRUICSS_create(pruss_config, PRUICCSS_PRU0);  

    PRUICCSS_PRU0 is defined in pruicss_v1.h as:

    typedef enum PRUSS_PruCores_s
    {
    PRUICCSS_PRU0,
    PRUICCSS_PRU1,
    PRUICCSS_RTU0,
    PRUICCSS_RTU1,
    PRUICSS_MAX_PRU
    }PRUSS_PruCores;

    So PRUICCSS_PRU0 = 0;

     

    So the fist line in PRUICSS_create is a problem

    handle = (PRUICSS_Config *)&config[instance-1];   <--instance = 0

    This doesn't make much sense to me.  Why would it be instance-1?  It would explain why PRU1 seemed to work, if everything was actually running on PRU0, but everything was pinmuxed for PRU1, so things don't add up.

     

     

  • Shawn,

    Please refer to PDK v1.0.15 as below:

    pruicss_soc.h:

    */
    typedef enum PRUICSS_MaxInstances_s
    {
    PRUICCSS_INSTANCE_ONE=1,
    PRUICCSS_INSTANCE_MAX=2
    }PRUICSS_MaxInstances;

    main_a8.c:

    pruIcssHandle = PRUICSS_create((PRUICSS_Config*) pruIcssCfg,PRUICCSS_INSTANCE_ONE);

    Regards,

    Garrett