in reply to Re^4: Device::BCM2835, hardware access on a pi, SIGSEGV
in thread Device::BCM2835, hardware access on a pi, SIGSEGV

One thing I noticed though was that adding network support seems tricky

Yes, indeed. Programming 8 bit AVRs (ATtiny, ATmega, ATxmega) is comparable to programming the old home computers, but in C (and perhaps some Assembler) instead of BASIC (and almost always Assembler). Your code runs on the bare hardware, there is no operating system, you have to implement everything by yourself (or find good libraries).

Networking can be easy, for some kind of networks. Many AVRs have hardware support for I²C (called two-wire interface), SPI, the "better" ones also have a hardware UART capable of implementing RS232 and RS485 (except for the line level inverters), the "big" ones also have a CAN bus controller.

But the UART lacks a FIFO that you are used to from "big" computers, so you need a fast interrupt routine to buffer incoming data and another one to send buffered outgoing data. This is also true for I²C, SPI, and probably even CAN. And due to the low clock frequency (typically much less than 50 MHz), your code runs slow compared to any PC you might use today, even with a highly optimizing compiler and a RISC instruction set. You simply won't be able to handle data coming in at Gigabit Ethernet speeds, no matter what interface you use. Probably not even at 10 MBit/s. And you don't have the memory to do so, not even enough address lines.

So, what does work?

Note that the really big AVRs contain USB controller hardware, so you don't need bit-banging to communicate with the USB host. But those AVRs come only in SMD packages.

AVRs are cheap. Consider using two AVRs, one for the real-time task and one for the communication with the outer world. Use I²C, SPI or similar for a simple, fast protocol in between those two AVRs. Or use I²C, SPI, or RS232 between an AVR and a raspi.

Alexander

--
Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)
  • Comment on Re^5: Device::BCM2835, hardware access on a pi, SIGSEGV