Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Locked thread
yippee cahier
Mar 28, 2005

I'm getting started, coming from an RTOS-on-microcontroller environment. I got myself a Raspberry Pi. Would a good starting path be to read up on and use buildroot, then attempt to write a kernel driver for some random SPI chip with interrupts?

I'm guessing a standard-ish project exposes the hardware to userspace in this way, then the actual application logic could be done in any old scripting language?

Just wanna learn some stuff here, feeling uneasy about getting pigeon-holed in RTOS land, especially when I'm reimplementing a wheel for months on end.

Adbot
ADBOT LOVES YOU

yippee cahier
Mar 28, 2005

Malcolm XML posted:

linux has a SPI driver and it's a device tree overlay away in raspbian, so no dicking with kernel drivers (u dont want to, its a PITA)

http://www.haifux.org/lectures/258/gpio_spi_i2c_userspace.pdf

i had find some time to get vagrant because i'm on a mac, but now make's taking care of business on my stock raspberry pi image...

i'm confident that i can make a test program go out and talk to a SPI device and will do that before diving in further. i mentioned kernel drivers because i'm trying to give myself a crash course in the field. i've written microcontroller drivers for SPI chips that require rapidly servicing interrupts, e.g. relatively decent ADCs for an application that requires samples not be dropped. i was planning on going through the linux device drivers book to try to recreate something like that in this environment. i know it's not an RTOS, but i imagine my raspberry pi doing nothing else is up to the task and this sort of thing is all in a day's work for an embedded linux dev. sound feasible?

would this be the sort of task an intermediate level developer would be expected to be doing? what else should i make sure i get familiar with?

yippee cahier
Mar 28, 2005

Malcolm XML posted:

Here's the spi driver for the bcm chip in the rpi: http://lxr.free-electrons.com/source/drivers/spi/spi-bcm2835.c

bcm2835 lib will give you the constants for enabling DMA access to the HW, but only as root to get direct access to the MMIO registers via /dev/mem

It's pretty mechanical and not that interesting tbh

Thanks, but I should have been more clear... eventually I intend to write a driver for a SPI connected ADC (or something similar) that uses GPIO interrupts to read out samples.

I got my stock image for my RPi booting. Is there much support for aarch64? I see changing the architecture in buildroot (and yes, running make distclean first) doesn't immediately work. Would trying to get this going be a good learning exercise for the ins and outs of buildroot?

  • Locked thread