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.

PRU BeagleBone Black - Create and save data in a file

Hi everybody,

I have to send data between two BeagleBone Black (BBB). PRU is one of the fastest way so I'm using it. But I have to save what I sent (using a log file for example) and what I received. For now, I send a HIGH/LOW signal on one BBB and read it and copy (the input) to a PRU output on another BBB.
I saw lots of code which shown how to create, write to a file, etc but it's in assembly and I think that the assembly for BBB is a bit special (it's PRU assembly langage).

Do you think it's possible to create a file in PRU assembly ? If not, have you any idea about how save data?

Thanks.

  • How much data is getting logged and how fast?

    The RPMsg example below shows exchanging strings between PRU and Linux:
    processors.wiki.ti.com/.../RPMsg_Quick_Start_Guide

    You could probably log the data that is passed from PRU on the Linux filesystem as long as Linux can keep up.
  • In fact, I just want to log what I sent. So, for example, if I send a HIGH (so a "1" bit) and then a LOW (a "0" bit), I want a log file where it's written:

    1

    0


    The same thing for the reception's log file. I have a sending speed at about 4MHz with PRU and this speed is good for me.

    I saw your link but don't really understand how I can implement it to my project. Because as I understand, I should make the echo command each time I want to save a data (and at 4MHz). I saw too that it use serial port, so UART, and the max speed is lower than 4MHz. In the example (of your link), is rpmsg_pru30 a file? An issue will be that a serial debugger is needed and I cannot use a device between the two beaglebone.

    I may have another issue. I use Cloud9 for UART and other codes in python. So, it has to work with the new firmware.

  • >> I should make the echo command each time I want to save a data (and at 4MHz). 

    I would think you can run this as a background task on the AM335x Linux while handshaking with the PRU.  Basically echo to a file >> log.txt.  That way you do not lose real time (around 4 MHz should be easy for the PRU, I think).

    >> I saw too that it use serial port, so UART, and the max speed is lower than 4MHz.

    That UART is only for user interface and debug,  I would assume with above background task you can read the file periodically non-real time. Please note the above link was an excerpt from the following remoteproc training if you want to pursue:

    http://processors.wiki.ti.com/index.php/PRU_Training:_Hands-on_Labs#Part_2:_User_Space_Communication 

    >>In the example (of your link), is rpmsg_pru30 a file? 

    Beauty of Linux (that I am learning) is that EVERYTHING is a file.  So the above eco should work,

    >>I use Cloud9 for UART and other codes in python.

    From a speed issue this should not matter as mentioned above since the UART is just user interface and debug.  But if you are using Debian instead of Arago, I am not sure if/how remoteproc s supported for PRU on Debian.

    Hope this helps!

  • Thanks for all this helpfull answers.

    I have Debian yes and I think I have to use Arago. So I think I will use Arago on the SD card for PRU and Debian on the eMMC to work with other pythons files.

    But sorry but these all things are hard to understand for me.

    In the example (first link), they used a serial debugger. But if I'm connected with the USB cable, I can execute all commands by accesing with SSH to the BBB, right?

    I read Lab4 and 5 (from second link) and understand I have to install a firware to use RPMsg on the computer but don't understand why a Ubuntu computer is needed. Because on the first link, they just access with a serial communication to the board. So, why a firmware is needed on a Ubuntu computer because they did command on the board? And I can do the same on Windows with Putty, right?

    Or maybe when I execute echo "a" > rpmsg_pru30 , it will send 1100001 (after converted  "a" using ASCII table) to a PRU output? And if yes, how to know which output?

    So, for me, I should make echo "a" > rpmsg_pru30 and then echo "a" > log.txt.

    To execute more than one command or make a loop, I should make a shell script, right?

    Thanks again.

  • Please see my comments embedded below (took my best guesses since I have not fully done what you are trying)

    >>In the example (first link), they used a serial debugger. But if I'm connected with the USB cable, I can execute all commands by accesing with SSH to the BBB, right?

    [Yes]

    I read Lab4 and 5 (from second link) and understand I have to install a firware to use RPMsg on the computer but don't understand why a Ubuntu computer is needed.

    [Assume you will need to make some changes to the RPMsg code for format, timing, etc. but then again maybe not?] 

    Because on the first link, they just access with a serial communication to the board. So, why a firmware is needed on a Ubuntu computer because they did command on the board? And I can do the same on Windows with Putty, right?

    [Maybe but I don;t know how you can sync up the Linux/PRU timing withouut chanigng the code somewhat] 

    Or maybe when I execute echo "a" > rpmsg_pru30 , it will send 1100001 (after converted  "a" using ASCII table) to a PRU output? And if yes, how to know which output?

    [Honestly not sure without trying]

    So, for me, I should make echo "a" > rpmsg_pru30 and then echo "a" > log.txt.

    [Sure if the formatting works for you]

    To execute more than one command or make a loop, I should make a shell script, right?

    [Yup. Though again not sure of the best way to sync up the Linux/PRU timing]