I did some step forward and I putted my header file on github <https://github.com/lore4/TSCADCss>. I hope that it could be helpfull :) One note: it is mandatory to power the TSC_ADC via PRCM or DT (i.e. device tree, I used the uio_pdru_genirq as suggested by zmatt).
Now, I am experiencing that ADC returns incorrect values, but I'll open a different thread. P.S. for my experience, DT with drivers and modules was, still is, pretty hard to understand. Do you know if there is an updated and correct guide, please? Il giorno lunedì 23 gennaio 2017 09:03:46 UTC+1, in...@orionitalia.com ha scritto: > > As far as I understood from the example, it should be enough to enable > "OCP port" and point to TSC ADC registers (i.e. on-board/internal ADC > registers) in order to configure and read values, am I right? > > Hence, I wrote down a header file (i.e. sys_tscadcss.h) which contains the > structure that represents the TSC ADC registers (e.g. sysTscadcss struct > with register fields REVISION, SYSCONFIG, etc.). Then, I created also the > TSCADCSS variable of type sysTscadcss in this header file. > > In order to point to the right TSC ADC's memory location > (i.e. 0x44E0D000), I used two ways that I took from some examples of PRU > software support package: > 1. "#define TSCADCSS (*((volatile sysTscadcss*)0x44E0D000))" ; > 2. "volatile __far sysTscadcss TSCADCSS > __attribute__((cregister("TSCADCSS", far), peripheral));" with its constant > define "TSCADCSS (R) : org = 0x44E0D000 len = 0x00000300 CREGISTER=27" in > AM335x_PRU.cmd file. > > In both cases, the pru firmware compiles, and runs. However, in the same > both cases, when I try to read any register with a default value not equals > to 0 (e.g. REVISION, ADCSTAT, etc. ), I read 0. > > Any idea what I am missing, please? > > Il giorno giovedì 19 gennaio 2017 08:15:01 UTC+1, in...@orionitalia.com > ha scritto: >> >> On Mon, Jan 16, 2017 at 9:55 AM, Greg <soapy...@comcast.net> wrote: >> >>> I'm pretty sure that others have successfully accessed the internal ADCs >>> from the PRU. If you do some searching I think you can find a specific >>> instance. >>> I think it should be possible via the PRU's OCP master port. >>> >> >> So far, I found examples that access the internal ADC from PRU, but none >> using C language. For example, this >> <https://raw.githubusercontent.com/pgmmpk/beaglebone_pru_adc/master/src/firmware.p> >> is taken >> from the previously linked python library. We are going to deep our >> understanding of this example, hopefully it is possible to write a working >> counterpart in C :) >> > -- 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+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/beagleboard/2f8dc02b-2c35-4c35-92e3-16c1761cf601%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.