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.

DataRAM

Other Parts Discussed in Thread: AM3359

Hello,

I want to write and read from the DATARAM of the PRU1, So I used this part of program:

/*******************Transfert/Reception of values in DATARAM********************************/
unsigned char fileDataArray[4]={1,2,3,4};
prussdrv_pru_write_memory(PRUSS0_PRU1_DATARAM, 0, (unsigned int *) fileDataArray, 16);
prussdrv_map_prumem (PRUSS0_PRU1_DATARAM,&pruDataMem);
for(ret=0; ret<4; ret++)
{
printf("value %d: %p adress %d: %p\n", ret, (void*)pruDataMem, ret, pruDataMem);
pruDataMem ++;
}
/*************************************************************************************************/

After executing this program, I saw this result:

value 0: 0xb6d78000 adress 0: 0xb6d78000
value 1: 0xb6d78001 adress 1: 0xb6d78001
value 2: 0xb6d78002 adress 2: 0xb6d78002
value 3: 0xb6d78003 adress 3: 0xb6d78003

I think that this program must print results(1,2,3,4) and their adress.

Regards,

Ayoub

  • Hi Ayoub,

    Can you share, what is your setup? Which device & SDK do you use? Which TI board (beablebone black, starter kit, GP EVM, etc.. )?
    Could you attach the whole program, in order to reproduce your use case?

    I am not sure about the pruDataMem values, but in my opinion value 0/1/2/3 & address 0/1/2/3 are correct (loop goes from 0 to 3).

    Best Regards,
    Yordan
  • I use the AM3359, this is just a test program.
    I use now data RAM and it works, the program I used is in the following:
    Note: when I use a constant table c2/c25 to store or read from Data RAM, an error appears(I declared them in .hp)???
    I had problem with defining some registers adress like cycle_counter. In the TRM they are offsets but I should add it to a value that I don't find?

    >> Assembler program:
    .origin 0
    .entrypoint START

    #include "pulse.hp"

    START:

    /* Enable OCP master port*/
    lbco r0, CONST_PRUCFG, 4, 4
    clr r0, r0, 4 /* Clear SYSCFG[STANDBY_INIT] to enable OCP master port*/
    sbco r0, CONST_PRUCFG, 4, 4

    mov r0, 0x00
    mov r1, PRU1_CTRL + CTBIR_0
    sbbo r0,r1,0,4
    mov r0,0x0000 // adress of DRAM
    mov r1,0x0000000A
    sbbo r1,r0,0,4
    mov r1,0x00000009
    sbbo r1,r0,1,4
    mov r1,0x00000008
    sbbo r1,r0,2,4
    /* signal c program done */
    mov r31.b0, PRU1_ARM_INTERRUPT+16

    halt


    >> C program:

    // Standard header files
    #include <stdio.h>
    #include <sys/mman.h>
    #include <fcntl.h>
    #include <errno.h>
    #include <unistd.h>
    #include <string.h>

    // Driver header file
    #include "prussdrv.h"
    #include "pruss_intc_mapping.h"

    #define PRU_NUM 1
    #define PRU_PROG "./pulse.bin"
    static void *pruDataMem;
    static unsigned int *pruDataMem_int;
    /******************************************************************************
    * Global Function Definitions *
    ******************************************************************************/

    int main (void)
    {
    int ret;
    tpruss_intc_initdata pruss_intc_initdata = PRUSS_INTC_INITDATA;

    printf("\nINFO: Starting %s example.\r\n", "led");
    /* Initialize the PRU */
    prussdrv_init ();

    /* Open PRU Interrupt */
    ret = prussdrv_open(PRU_EVTOUT_1);
    if (ret)
    {
    printf("prussdrv_open open failed\n");
    return (ret);
    }

    /***********Getting the interrupt initialized ******************/
    prussdrv_pruintc_init(&pruss_intc_initdata);
    /***************************************************************/

    /******************Mapping DATARAM******************************/
    prussdrv_map_prumem (PRUSS0_PRU1_DATARAM,&pruDataMem);
    pruDataMem_int = (unsigned int*) pruDataMem;
    /***************************************************************/

    /**************** Execute example on PRU ***********************/
    printf("\tINFO: Executing example.\r\n");
    prussdrv_exec_program (PRU_NUM, PRU_PROG);
    /***************************************************************/
    /******** Wait until PRU0 has finished execution ***************/
    printf("\tINFO: Waiting for HALT command.\r\n");
    prussdrv_pru_wait_event (PRU_EVTOUT_1);
    printf("\tINFO: PRU completed transfer.\r\n");
    /***************************************************************/
    for(ret=0; ret<=2; ret++)
    {
    printf("value %d: %i adress %d: %p\n",ret,*pruDataMem_int,ret, pruDataMem_int);
    pruDataMem_int ++;
    }

    /***************************************************************/
    prussdrv_pru_clear_event (PRU_EVTOUT_1, PRU1_ARM_INTERRUPT);
    /***************************************************************/
    /**********Disable PRU and close memory mapping*****************/
    prussdrv_pru_disable(PRU_NUM);
    prussdrv_exit ();
    /***************************************************************/
    return(0);
    }