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.

  • Resolved

Linux/K2GICE: PRU Memory access using Linux

Part Number: K2GICE

Tool/software: Linux

Hello

I am trying to access PRU shared Memory from Linux Application using uio_module_driver. I have modified the device tree to list the pru using uio. 

I am using the modified device tree - keystone-k2g-ice-pru-excl-uio.dtb.

I am able to access the registers of PRU and have wriitten program in pru iram to write data to shared memory and ocmc ram. 

I am using Icek2gv2 board along with sdk 04_03_00_05. 

My linux application is reading back value '0' instead of values written by the PRU. I have checked the running state of PRU.  

Kindly let me know what could be wrong.

Thanks.

  • In reply to Nick Saulnier:

    Hello Nick,

    I am accessing few registers in the devmem2 which return the default values as mentioned in the device datasheet.

    Before accessing the pru shared memory, I am also accessing few configuration registers. Upon reading them, I see that they return the default values.

    I do not know any other tool to access the memory locations and check if the values are actually written or read from it. If you have any suggestions then I can try it.

    Regards
    Manish Jain
  • In reply to Manishkumar Jain:

    Hello Manish,

    Here's example firmware I wrote using devmem2 to read PRU0 DRAM0 and shared RAM locations to see if my PRU firmware was actually writing to that memory:

    /* test reading PRU DRAM0 and shared RAM from command line */
    #define TESTA    (*((volatile unsigned int *)0x100))
    #define TESTB    (*((volatile unsigned int *)0x110))
    #define TESTC    (*((volatile unsigned int *)0x10120))
    #define TESTD    (*((volatile unsigned int *)0x10130))
    
    void main(void)
    {
    	TESTA = 0xA0A0A0A0;
    	TESTB = 0x0B0B0B0B;
    	TESTC = 0xCCCCCCCC;
    	TESTD = 0xD0D1D2D3;
    }

    this was my output: 

    Regards, 

    Nick

  • In reply to Nick Saulnier:

    Hello Manish,

    I'm going to mark this resolved. Please let us know if you have further questions.

    Regards,
    Nick
  • In reply to Nick Saulnier:

    Hello Nick,

    Thanks for your reply.

    I am using the below device tree for my system. 

    I am loading the pru program with uio driver module into PRUs. 

    When try to access the pru memory I am getting the issue with bus error.

    I am doing the following on my system:

    1. Load the device tree with the below mentioned dts file.

    2. Run a user application which loads PRU program and enable the PRU both using uio-module driver.

    3. Access the shared memory and data memory using uio-module driver - This results in segmentation fault. 

    Alternatively, when I try to access the access the PRU memory through the tool mentioned above, I get the Bus Error at that memory location.

    I would kindly request you to share with me the device tree which you used along with method to load code into PRU. 

    Thanks,

    Regards,

    Manish Jain

     

    7651.keystone-k2g-pru-uio.zip

  • In reply to Manishkumar Jain:

    Hello Manish,

    I am sorry this response took so long - future responses will be faster. Let me know if you are still working on this issue.

    Glancing through, your code does not look too different from the template.

    I typically load PRU firmware using RemoteProc (since TI does not support UIO for a general purpose use case). You would need to make sure that your device tree was not disabling the pruss_soc_bus[0,1] and all the subnodes which are created in keystone-k2g.dtsi. keystone-k2g-evm.dts would be a good example of how to set up the device tree appropriately.

    Information on RemoteProc can be found here.

    and an example of using it to load firmware is here. (the example is am335x, but k2g should work similarly)

    Regards, 

    Nick

  • In reply to Nick Saulnier:

    Hello Manish,

    I am going to mark this resolved. Please respond if I can offer further support.

    Regards,
    Nick
  • In reply to Nick Saulnier:

    Hello Nick,

    Thanks for the response.

    I am not getting any bus error from the methods you suggested.

    I seem to into segmentation fault when I access the memory that might be due a bad pointer or clean-up issues which I am yet to resolve.

    I would open a new thread for the issue as I think that would resolve it.

    Regards,
    Manish

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.