Can a Mega do this...

I would like to port our application from it’s current platform, a 68332 based Datalogger/controller (TattleTale8) to an arduino mega, but there are a few things I’m not sure I can do.

My application interfaces with three external instruments(depth, wind, and a water quality suite) via three RS-232 connections and controls the location of the instruments via a bi directional motor. A fourth RS232 port interfaces with a cellular modem so I can dial in and download data files, upload new programs, etc. In the future I may want to add more serial interfaces for more instruments.

One of the instruments provides feedback for controlling the motor so I have to both record and parse the incoming data stream.

A typical sensor run lasts 3 minutes and generates 30k of data. Roughly one 80k line of readings per second from each of two instruments.

My first Arduino worry has to do with RAM. The TT8 has 256K of RAM, and while part of the program goes here, there’s a lot left over. I have to record data from several serial lines simultaneously during a run. I’ve been setting up big buffers (up to 16k) and when everything is done, saving the data in the buffer to a CF card. With an arduino, I will probably have to actively save the data to an SD card as it comes in.

Another functionality I currently have is the ability to count state changes on a pin in the background. I use this to monitor motor rotations (8 state changes/rotation). On the arduino I think I can use an interrupt to do this.

So, while I’m in a sensor run, I’m:

  • Monitoring motor rotations
  • Monitoring motor amps to make sure it hasn’t stalled
  • Recording 80k/ sec from serial one and parsing out several values which I use to control the motor. After being parsed, this data is saved to an SD card.
  • Recording a second 80k/second stream of data directly to the SD card.

While I’m not in a sensor run, I’m waiting for someone to dial in, and when they do, providing some simple commands (ren, del, ymodem send/receive, etc.).

One last thing I can do currently is load new programs remotely over the modem.

It looks like the mega has plenty of I/O for an SD card interface, enough serial and any program should be able to fit in 128k. Is the 4k of RAM a deal breaker. Should I be looking at linux based solutions like this:http://www.embeddedarm.com/products/board-detail.php?product=TS-7800

I may be able to switch the cellular dial in to 3G with a TCP/IP interface.

The mega1280 supports external RAM (up to 64K) and this could be bank switched to give you 128K. The mega1280 also has enough I/O and processing power to do what you want as well.

The question is whether you use the Arduino platform or simply install WinAVR.

One consideration for example is Googling on “arduino mega” “external RAM” doesn’t give many hits. Alternatively you could look at this as an opportunity.

Is the 4k of RAM a deal breaker.

I would say so yes.

While it is not beyond the bounds to add external RAM it would have to be static ram and it would use up a lot of I/O. Basically 16 + 8 lines all in a byte access mode Plus a R/W and enable and output enable. That’s 27 lines to access 64K of RAM. Then you have bank switching on top of that. There are only two ports in a Mega that have all 8 bits coming out, so the software interfacing to drive this is not going to be simple. I don’t think you will be able to write to an SD card fast enough to act as a buffer.

Microchip has a 32k SRAM with an SPI interface. It’s 3.3V, so you’d have to level translate, but with the number of IO pins available for chip select on the MEGa you could throw a bunch of them on there.

Another possibility is the Atmel Dataflash devices. The one I looked at (stocked at sparkfun) is a few megabytes (2?) and has double SRAM buffers for high throughput.

-j

Microchip has a 32k SRAM with an SPI interface

Thanks I didn’t know that. So I went and looked and found that they also do 64K and 256K versions. But before you get too excited the memory capacity is quoted in bits so that equates to 32K bytes. Any way they are quite cheap so I think I will get some and have a play.

If you want the link it is here:-
http://uk.farnell.com/microchip/23k256-i-p/sram-serial-256k-2-7v-pdip8/dp/1695546

Grumpy_Mike: Basically 16 + 8 lines all in a byte access mode Plus a R/W and enable and output enable. That’s 27 lines to access 64K of RAM. Then you have bank switching on top of that. There are only two ports in a Mega that have all 8 bits coming out, so the software interfacing to drive this is not going to be simple.

I respectfully disagree. The builtin external RAM interface on a mega1280 is port A, Port C, and 3 I/O lines from port G. This is a total of 19 I/O lines available from JP1 and JP2 on the Arduino Mega. You will need a 74HC595 buffer as well. If you want bank switching for a 128K RAM chip then you need on extra I/O pin. Oak Micros (which I own) sells a compact SMD solution if that is useful.

It is perfectly possible to purchase DIP buffers and RAM chips to wire up everything either on a breadboard or strip board. If you get SRAM with an access time of <70ns then there will be no wait states.

The SPI-based RAM is an alternative but access speed is going to about 1/4 of regular RAM.

Guys,

You can save I/O by running a multiplexed address bus. Use a couple of 74HCT574 latches and latch the upper and lower address line in these. I used a similar scheme adding 128K x 8 to a PIC a few years ago.

Alternatively if your data is stored sequentially you can use the upper 8 address lines to access up to 256 pages and then use a CMOS counter like a 4020 or similar to auto-increment through successive bytes on a page. The original Psion Organiser used a similar scheme on its data packs.

G