Go Down

Topic: extra RAM on Arduino Due (Read 4 times) previous topic - next topic

pito

#15
May 30, 2013, 04:07 pm Last Edit: May 30, 2013, 04:31 pm by pito Reason: 1
I built an external sram device with XC9536XL ($1) and a 4MBytes large SRAM chip. You need 11 wires to control the memory (8data+3bit control). With bigger cpld (more pins) you can access an "unlimited" size of sram. It has got an auto increment feature thus a rd/wr to the device automatically increments the sram's address.

The r/w speed with pic32@80MHz (bitbanging, no dma) and with larger blocks (ie. 512bytes) is ~6.5Mbytes/sec. It can be used in "16bit mode" (16data+3bit control wires required) with double speed.

Actually, the data width is not related to the cpld, so you may run it in 32b or 64b data width mode (4x or 8x faster) but you need more data wires, unfortunately..

More on:
http://retrobsd.org/viewtopic.php?f=5&t=991

ralphnev


I built an external sram device with XC9536XL ($1) and a 4MBytes large SRAM chip. You need 11 wires to control the memory (8data+3bit control). With bigger cpld (more pins) you can access an "unlimited" size of sram. It has got an auto increment feature thus a rd/wr to the device automatically increments the sram's address.
[snip]


i looked at a similar method but it requires to much processor intervention
- using SPI/USART with PDC/DMA should get up to 4MBytes/sec with very little processor intervention ...

my chunks are 4096bytes occuring once every 5ms (and faster if i can make other improvements)
so low processor over head is very important to me ..

gaith

Hi,
I don't understand all you're talking about, but it confirms that it's possible to add parallel SRAM, with high performances.

Pito, could you explain me something I don't understand (I already think about the library I'll have to write) :
You're telling in your post that by doubling the data size, it doubles the data transfer speed. But does the Arduino can read for example 32 pin-in state in the same time ? If I put 32 times the instruction DigitalRead(x) to read the DATA, I think it must take more CPU cycles than reading 8 inputs, and then slow the RAM access frequency ? Or is there a special function on Arduino which can read all the 32 input bits in the same time ?

Sorry for my questions, I'm totally noob in low-level micro controllers.
Build a groove box with Arduino Due :
http://groovuino.blogspot.com/

pito

#18
May 31, 2013, 11:14 am Last Edit: May 31, 2013, 11:53 am by pito Reason: 1
@gaith: some mcus can read/write a 16bit port with single instruction (ie. they have 16bit ports) or maybe 32bit ports as well. You have to investigate. I do not have DUE handy, but I would guess 32bit ARM or 32bit AVR can read/write 16/32bit data from/to its ports..

Quote
If I put 32 times the instruction DigitalRead(x)

With 8bit arduino you can read/write 8bit port in a single instruction, reading data with DigitalRead() is of course something I would never ever consider, indeed. Again - any mcu I know can read/write 8bit wide data from a port with single instruction.

This writes a byte to the port B:
Code: [Select]
 DDRB = 0xFF; //sets port B to output
 PORTB = addr;


This reads a byte from the port D:
Code: [Select]
 DDRD = 0x00; //sets port D to input
 data = PIND;


More reading: http://www.arduino.cc/en/Reference/PortManipulation

The pic32mx I referenced above has 16bit ports, so you can r/w the 8b or 16b port with single instruction. For a 32bit mcu it basically does not matter whether you read/write 8/16/32 bit - it is always (or mostly) a single instruction, because they always work with 32bit data internally..
Example:
Reading 8bits from the above disk device:
Code: [Select]

loop {
set /RD low
int8 data[i] = (PORTA & 0x00FF)
set /RD high
}


Reading 16bits from the above disk device:
Code: [Select]

loop {
set /RD low
int16 data[i] = PORTA
set /RD high
}


Writing 8bits to the above disk device:
Code: [Select]

loop {
set /WR low
PORTA = (int8 data[i]  & 0x00FF)
set /WR high
}


Writing 16bits to the above disk device:
Code: [Select]

loop {
set /WR low
PORTA = (int16 data[i] )
set /WR high
}


gaith

Great !
So I have to find how to access to the port registers on Due.
It seems that someone already tried to adapt an arduino Mega library which can do this, but after reading the posts... I don't know if it works or not. 
http://forum.arduino.cc/index.php?PHPSESSID=5mukpmk3fcgd6712quj4fnop57&topic=129868.0

Maybe it can be easier if I use directly some ARM assembly code.

I'll keep on investigate.

Thanks a lot for your explanations.
Build a groove box with Arduino Due :
http://groovuino.blogspot.com/

Go Up