1
\$\begingroup\$

I am using Ubuntu 14.04 and the arm-linux-gnueabihf-gcc compiler to compile projects for the sama5d3 explained board and using minicom and zmodem to transfer the compiled source code from the ubuntu machine to the development board. The sama5 board comes with Poky, the yocto linux reference build. My end goal is to access and read registers for the ADC and SPI devices.

I've been giving the data sheet a good read here, on page 1664, it details the ADC Channel Status Register; at memory location 0xF8018018. Linux obviously provides a segmentation fault whenever i try to retrieve the value there. A detailed tutorial on how to use mmap for memory mapped IO would also be cool as I've heard this may be an alternative.

The reason for this is so I can read the ADC at 100 ksamples / sec. Accessing memory addresses from user space probably isn't possible, if it is, it would be greatly appreciated to let me know how. If not, I'd like to know how I'd go about creating a bare-metal application that would allow me to do it. Atmel has a GNU software package that includes ADC drivers for the arm-none-eabi-gcc compiler. How would I go about setting this up to compile and run programs on this board?

To condense this all down:

I have:

  • A desktop running Ubuntu 14.04

  • the sama5d3-xplained development board

The questions are:

  • Is there anyway possible to access the ADC at speeds >= 100 ksamples/sec

  • Is there anyway to access the registers from a memory location (like the ADC channel status register at memory location 0xF8018018) from user space?

  • How would I go about developing a bare-metal application if the answer to the question above is no.

Thank you for your help and time.

\$\endgroup\$
1
\$\begingroup\$

You could use the Linux AT91 ADC Device Driver but this will probably not meet your speed requirements (see also Use of the AT91 ADC driver).

Another solution could be to look into DMA transfer for the ADC registers into some user space memory. This could also be quick enough to satisfy 100 ksps. I haven't done such thing yet but a look into this could be worthwhile: Dynamic DMA mapping Guide.

\$\endgroup\$
  • \$\begingroup\$ Unfortunately thats no help :/; i'm pretty convinced the easiest way is to use mmap to map the peripheral . any ideas on how to do that? \$\endgroup\$ – Zachary Baltzer Jan 12 '16 at 17:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.