lsmod | grep uio
ls -l /dev/uio*ls -l /sys/devices/platform/libpruio
sudo /opt/scripts/tools/version.shLet me know if you need any other information from me!
--
For more options, visit http://beagleboard.org/discuss
---
You received this message because you are subscribed to the Google Groups "BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email to beagleboard...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/beagleboard/f0ac4d39-2edf-4a15-a274-591857093277%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
#uboot_overlay_pru=/lib/firmware/AM335X-PRU-RPROC-4-14-TI-00A0.dtbo
uboot_overlay_pru=/lib/firmware/AM335X-PRU-UIO-00A0.dtbo
... how do I read the data that is written in the output.x file that is written by rb_file.py. Since its raw data I cant sudo nano the files and I am not quite sure how to convert it to something like a .txt or csv file that I can then parse through. Any suggestions on how I would do this?
May I ask why?
and how?
Instead add yourself (your user ID) to the group pruio, and work from user space.
Okay, do you understand how the data is written in C, and how in C I could convert the data to readable data? I think I understand how to transport that from C to python but I don't understand the initial translation from the written form to a human-readable form.
Have you ever shown the contents of your rb_file.py ?
The best place to convert the data format for later use would be in
that file (change whatever write statements you are using).
The alternative would be to use another Python script to /read/ the
file and then convert the data to something usable. After all, if you wrote
it with Python, the equivalent type of read operation should handle it.
You're already using Python -- a byte-code interpreted language. If
that's fast enough to write the data as is, it can probably handle
conversion at the same time. (especially as you have a 1millisecond
polling loop!)
p1 = cast(byref(p0, half), POINTER(c_ushort))p1 = cast(byref(p0.contents, (half << 1)), POINTER(c_ushort))Okay, do you understand how the data is written in C, and how in C I could convert the data to readable data? I think I understand how to transport that from C to python but I don't understand the initial translation from the written form to a human-readable form.
import structimport csvimport array
#Note this file assumes you are using 7 outputs in rb_file.py and assumes that you have#not changed the file naming convention. You must use command Python3 to run this file!
CHNK_SAMPLES = 64
rdr = struct.Struct("H")
write = open("data.csv" , "w") #Opens a csv file called data.csv in write modecsvwriter = csv.writer(write, delimiter = ',', quotechar = '"', quoting = csv.QUOTE_MINIMAL) #sets up the csv writer where a , seperates data entries and '' is used for quotationcounter = 0 #sets up a counter used to iterate over the various data output filesfileName = "output.%u" #follows the same naming format as used in rb_file.pydatarr = array.array('f',[0,0,0,0,0,0,0]) #sets up an array of length 7 that will contain floatsi = 0 #sets up the index for looping over our arraywhile True: try: fin = open(fileName % counter,"rb") #opens the output file corresponding to the counter value in read binary mode print("Now Reading: " + fileName % counter) #updates the user on the current file being read while True: chnk = fin.read(2*CHNK_SAMPLES) #gathers data from the output file in chunks if not chnk: break for smpl in rdr.iter_unpack(chnk): #iterates over the values found in the chunk datarr[i] = smpl[0]*1.8/4095 #converts the raw data into voltge form and stores it in the ith entry if(i == 6): #if we have filled the array csvwriter.writerow([datarr[0],datarr[1],datarr[2],datarr[3],datarr[4],datarr[5],datarr[6]]) #writes the data values to the csv i = 0 #resets the index and the array values to 0 datarr[0]=0 datarr[1]=0 datarr[2]=0 datarr[3]=0 datarr[4]=0 datarr[5]=0 datarr[6]=0 else: i= i+1 counter = counter + 1 #raises the counter so we can move onto the next file fin.close() #closes the previous file except IOError: #this will trigger when you run out of data files to loop over print("No file called: " + fileName % counter + " found. This may be because you ran out of data.") write.close() #closes the csv file break