I'm developing AD routines for PRU0 on a BeagleBone Black.
Using TI's sample code I have been able to read channel 0, aka AIN0 on the Black and send the data back to an ARM-side host program using RPMSG where it is converted to a voltage value and displayed on screen. (I don't have a debug probe so I am doing this the hard way!).
I actually need to read three A/D inputs so first I modified the code to change the channel and read each one independently. This just confirmed that I had the right configuration values for each channel I need to read. The data is going into FIFO0 based on the sample code.
Now, I want to set up two new steps to read channels 4 (AIN4) and 5 (AIN5) when channel 0 is read. So I configured step2 to read channel 4 and step3 to read channel5. I send the data for channel 4 to FIFO0 and for kicks decided to send the data for channel 5 to FIFO1 (really, just to see if I could, I'll leave channel 5 of this going forward).
So, two questions, the Section 12.5.1.10 of the TRM says that bit 1 controls whether the tag is written in the FIFO with the data. However, it's confusing to me. The field is called Step_ID_tag. The description says "Writing 1 to this bit will store the Step ID number with the captured ADC data in the field. 0 - Write zeros. 1 = Store the channel ID tag." So which is it? Step ID or Channel ID?
Also, how is the data stored in the FIFO? Is it LSB first? I sent the raw string back to my host program and output it as hex and couldn't really convert it. I got 6 bytes (for example, 0x476b0) back. No matter what the input voltage being measured, the data always ends with b0. So it appears to be LSB first. However, I'm not doing anything to 'invert' it however it must be getting inverted because my conversion to volts is accurate.
I'm an old dog learning and relearning new tricks. I may have forgotten something simple here so I'd appreciate your help very much!