Electronic – AVR SRAM limitation

atmegaattinyavrspisram

I'm just an enthusiast looking for some advice.

I'd like to use a microcontroller to read frames from a camera and write those frames to a small LCD screen. The camera and screen are on the same SPI bus. I've been prototyping with an Arduino but I'd like to move to an AVR eventually.

Problem is, an image frame is 9600 bytes and the Arduino SRAM is 2.5KB. I can't buffer a whole frame. I tried reading from camera and writing to the screen a few lines at a time, but because they are on the same SPI bus, I need to de-assert the camera, assert the screen, and then re-assert the camera. If you de-assert the camera mid-frame you lose sync.

I need to figure out a way to get 9600 bytes from camera to screen without de-asserting the camera. Seems like I have 2 options: Increase SRAM to buffer a frame or separate SPI busses.

Increase SRAM:

  • Change AVRs – The only ATmega with enough SRAM is ATmega1284 and it's got 44 pins.
  • External SRAM? Never worked with it.

Separate SPI busses:

  • Move screen from hardware SPI to regular pins and write software SPI. (I doubt this would be fast enough.
  • Looks like there are several ATtinys and ATmegas with 2 or more SPI busses. Some as small as 20 pins. This would still delay the reading of single frames, but hopefully not too much.

Something… else?

  • FPGA? Never worked with them…
  • Some other type of microcontroller?

Thanks!

Best Answer

Something else (sort of):

Several of the ATmega devices can reconfigure their USART(s) to act as a SPI master. Simply connect one of the devices to one of these reconfigured peripherals. Look for "USART in SPI Mode" or "MSPIM" in the datasheet.