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.

RTOS/PROCESSOR-SDK-AM335X: PRU initialization issue

Part Number: PROCESSOR-SDK-AM335X
Other Parts Discussed in Thread: SYSBIOS

Tool/software: TI-RTOS

Hi, 

I'm trying to run and load PRU from arm cortex A8, but when my code want to execute the PRUICCS_create() funciton it ends up with an error 

CortxA8: Unhandled ADP_Stopped exception 0x20023

And goes to do_AngelSWI()


Did anyone had a similar porblem to mine? This is my code:

/*
* ======== main.c ========
*/

#include <xdc/std.h>
#include <xdc/runtime/System.h>
#include <ti/sysbios/BIOS.h>
#include <ti/sysbios/knl/Task.h>
#include <xdc/runtime/Error.h>
#include <stdio.h>

#include <ti/drv/pruss/pruicss.h>
#include <ti/drv/pruss/soc/pruicss_v1.h>

#include <ti/board/board.h>

/*
* ======== taskFxn ========
*/

PRUICSS_Handle handle = NULL;
uint32_t instance = PRUICCSS_INSTANCE_ONE;

extern char binBuff[8192];

Void taskInitPRUFxn(UArg a0, UArg a1)
{
System_printf("enter taskFxn()\n");

PRUICSS_Config *pruss_config;
PRUICSS_socGetInitCfg(&pruss_config);

/* Creates handle for PRUICSS instance */
handle = PRUICSS_create(pruss_config, instance);
//PRUICSS_HwAttrs const *hwAttrs = handle->hwAttrs;

//PRUICSS_pinMuxConfig(handle, 0x0); /* PRUSS pinmuxing */

PRUICSS_pruDisable(handle, PRUICCSS_PRU0);
PRUICSS_pruDisable(handle, PRUICCSS_PRU1);

UART_printf("\n\rPRU beggin to load app!\n");

PRUICSS_setPRUBuffer(handle, PRUICCSS_PRU0, binBuff, (11*10));
PRUICSS_setPRUBuffer(handle, PRUICCSS_PRU1, binBuff, (11*10));

PRUICSS_enableOCPMasterAccess(handle);

PRUICSS_pruExecProgram(handle, PRUICCSS_PRU0);
PRUICSS_pruExecProgram(handle, PRUICCSS_PRU1);

//PRUICSS_IntcInitData pruss_intc_initdata = PRUSS_INTC_INITDATA;
//PRUICSS_pruIntcInit(handle, &pruss_intc_initdata);


PRUICSS_pruEnable(handle, PRUICCSS_PRU0);
PRUICSS_pruEnable(handle, PRUICCSS_PRU1);

UART_printf("\n\rPRU Load!\n");
Task_sleep(10);

System_printf("exit taskFxn()\n");
}

/*
* ======== main ========
*/
Int main()
{
/*
* use ROV->SysMin to view the characters in the circular buffer
*/
System_printf("enter main()\n");


Board_initCfg boardCfg;


boardCfg = BOARD_INIT_MODULE_CLOCK |
BOARD_INIT_ICSS_PINMUX;

Board_init(boardCfg);

BIOS_start(); /* does not return */
return(0);
}


And this is how I enable the pru in GEL file:

#define PRCM_BASE_ADDR                        (0x44E00000)
#define CM_PER_PRU_ICSS_CLKCTRL     (PRCM_BASE_ADDR + 0x0E8)

#define CM_DPLL                                          (0x44E00500)
#define CLKSEL_PRU_ICSS_OCP_CLK      (CM_DPLL + 0x030)


WR_MEM_32(CM_PER_PRU_ICSS_CLKCTRL, 0x2);
WR_MEM_32(CLKSEL_PRU_ICSS_OCP_CLK, 0x1);

GEL_TextOut("PRU_ICSS enabled.\n");

  • I think I'm doing something wrong with eneabling the PRU cos when I check the PRU_ICSS adress (0x4A300000) in memory browser it shows only ???????? so I think this can be the problem. Someone knows how to fix it?
  • Hi rafal,

    You can use the GEL file AM335x_PRU_ICSS.gel from ti\ccsv7\ccs_base\emulation\boards\beaglebone\gel to enable the PRU, also try to do a System_Reset in CCS before loading your application.

    Regards,
    Garrett

  • I tried to use the GEL file but I end up with the problem reaching the 0x4a300000 adress (the one I spotted) I think after enabling the PRU_ICSS this should be accessible, but it isn't . I don't have any idea why it dosen't want to work. On the printscreen you can see what happen after running script->PRU_ICSS->PRU_ICSS_Init gel function

  • rafal,

    You have beagleboneblack.gel associated with your target configuration, correct? AM335x_BeagleBlack_Initialization( ) should be done prior to PRU_ICSS GEL functions, and the GEL files from CCS v7 should work as is.

    I don't have a BBB with JTAG soldered to reproduce the issue, do you happen to have AM335x ICEv2 board? So you can refer to some existing PRU examples, e.g. ICSS_EMAC, in PDK without spending time on the BBB setup unless you really want to develop a project on the beaglebone board instead of a PRU project as you described for AM572x in another thread.

    Regards,
    Garrett
  • Thank you for your respond it help me alot! Also for other people reading this thread I had to MMU my PRU_ICSS in the app.cfg file. This is what I add:

    /* Define the base address of the 1 Meg page the peripheral resides in. */
    var peripheralBaseAddr = 0x4a300000;

    /* Configure the corresponding MMU page descriptor accordingly */
    Mmu.setFirstLevelDescMeta(peripheralBaseAddr,
    peripheralBaseAddr,
    peripheralAttrs)

    after adding this everything start working fine!