Help with SDRAM on XMEGA128A1U

Go To Last Post
5 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Greetings all,

 

I am a mechanical engineering grad student using an Alvidi dev board with a XMEGA128A1U and external SDRAM (link). I am using the system to control a motor along with reading three encoders.

 

I have the system working fine and all, but I would like to add a data logging feature. Here is how I'd like the system to work:

 

1) Turn on and wait for serial command from computer to start.

2) Commence control routine. For every cycle, store 4 integer variables into memory.

3) Run until "stop time" is reached.

4) When stopped, send data to computer for analysis

 

The data is to look like the following table:

 

DAC_OUT Encoder 1 Encoder 2 Encoder 3
1005 -5063 450 6300
2040 -2000 890 3355

 

 

 

 

 

Here are my assumptions, i need to store the 4 integer variables in memory. My issue is that I don't really get address tables, block sizes, and all that. I played around with one of the EBI examples in AVR1312 and it does what it's supposed to, but after reading and reading and reading, I'm not getting how I set up the SDRAM registers for my needs. 

 

I'd like to write a loop that iterates through the memory addresses and sends it via usart to my computer. So I guess here are my questions based on the above data table:

Assuming: DAC_OUT is an unsigned integer (values = 0 to 4095). Encoder values are signed integers (values = -7000 to +7000).

 

1) As a sanity check, can you please confirm that the values above are type short int and take up 2 bytes of memory? If so, that means that I need 8 bytes of memory (2 bytes * 4 short int variables) for every clock cycle?

2) If the above is true, how big of an "Address Space" do I need? If I want to iterate through the addresses, does that mean that if I set the "Address Space" to 8 bytes, that I can achieve what I want neatly???

3) I am utterly confused about SDRAM row bits and SDRAM column bits. Can you please clarify as to what I need to set them to?

4) I am running the routine in a Timer Overflow ISR clocked at 226 Hz -- this is how my professor says it needs to achieved. The CPU is set at 32 MHz. What considerations should I make for delays???

5) The example that I was playing with has a defined function (__far_mem_read(addr)) which uses assembly language to retrieve the data from the memory address. What should the function in C look like to retrieve the data from the memory address?

6) And finally, I really found the USART tutorials from FourWalledCubicles VERY helpful. Is there an equivalent out there for EBI?

 

Any considerations that I am not bringing up would be appreciated. Also, if you could kindly list your recommendations as bullet points, that would be great for me and for anybody else who will read this post.

 

Last Edited: Mon. Jul 15, 2019 - 04:00 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I’d suggest you contact Alvidi and ask if they have a setup. The setup is based on the sdram specs and not all sdram chips are the same. Hopefully Alvidi can give you guidance.

With the timer you have a number of choices. What time period do you need? What ‘delays’ are you referring to?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Without any experience in software and hardware, such a project is not easy to start. You need a lot of time and patience or you buy this service from the experts.

 

If you want to do it yourself, you should first look at the datasheet on the manufacturer's homepage. For SDRAM visit the website https://www.micron.com. At some point, the manufactory also offers the source code. Also many examples and libraries for this SDRAM can be found at the ASF of atmel / microchip. In my trial software for this product I use the libraries of Atmel ASF.

 

I hope this information could help you.

 

Best regards

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Time and patience I have plenty of. This is for my master's degree which I will finish in about 9 months. That's plenty of time. I am just one Eureka moment away from figuring this out.

I have already read the datasheet from Micron, I have reviewed the EBI examples from AVR and the corresponding examples from ALVIDI. I've run the examples and have modified them slightly to test things out.

I'm now ready to configure it to my application. What I need is some clarification on configuring the EBI and maybe someone share an example of how they tackled a problem utilizing SDRAM.

It's summer time and all the computer engineering professors are on vacation. So I am relying on the AVR community in the meantime.

So the question is, what configuration do I need for the application I've laid out above???

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Surely some of Atmel's own Xmega Xplained boards must have SDRAM on EBI? If so don't you just follow their schematic and take the board example code from Atmel Start.
.
Even in professional designs (with complex CPUs) it's usually a case of being guided by the design and use of the manufacturer's dev board.
.
No point reinventing the wheel. Presumably Atmel/Microchip know how it's supposed to be used?