ATMega328p Extended Memory [logic analyser design]

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

I have been toying with the idea of making a simple Logic Analyzer and have just recently gotten serious about doing it.
I need more memory than a ATMega328p provides so came up with the solution outlined in the image attached and have a few questions:
1) Am I wasting my time? (I'm poor and can't afford a store bought model that's why I'm doing this with parts I have on hand, minus the memory chip.)
2) Will this work? (Basically I'm just dumping data as it is acquired and dumping it sequentially to memory)
3) Do I need a latch between the uController and the memory?
4) Am I crazy for even doing this? :) Rhetorical question

The memory chip is CY7C199CN-15PXC 32KX8 and the counter is 74HC4040.

As always thank y'all for your wisdom.

Attachment(s): 

Happy Trails,

Mike

JaxCoder.com

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

I am sure that it could work, but you are not going to have very many samples. My Saleae can do 20M samples at up to 20M Samples/s.

However you often only want to examine a relatively short period. So 32k Samples @ 2MHz is 16ms. Or 32k Samples @ 100kHz (10us period) is 320ms.

I suggest that you use an OCx pin to drive the CD4040 clock i/p. This would mean the SRAM is addressed completely by hardware. And you could clock at up to 8MHz for a 16MHz AVR.

I suspect that you are looking to relatively slow sample rates. Have you considered using several 23K256 chips? Or using an SDCard?

David.

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

Is 50USD too much?
http://dangerousprototypes.com/open-logic-sniffer/
There is the 30USD Bus Pirate version 3.
If one improves prototype Bus Pirate version 4 one can get it for half price or no cost.
If one can make an AVR equivalent of Bus Pirate it might be popular.
ZeptoProg for 30USD.

"Dare to be naïve." - Buckminster Fuller

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

David,

Yes I know there won't be many samples and yes I have thought about daisy chaining them together, I've got 4 coming and I had thought about combining some of the pins and using a 74HC595 that would also be used for the Mem. CS. My thinking though is since I will be using this mostly for communications and small bursts of data that I could intelligently (watch me now) trigger on say packet start and quit on stop then if multiple packets do the same so that I would not just be wasting memory space. Like I said at this point I'm just designing in my head.

gchapman,
Looks good I'll check it out thanks.

Happy Trails,

Mike

JaxCoder.com

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

A GIF is worth a thousend words   They are called Rosa, Sylvia, Tricia, and Ulyana. You can find them https://www.linuxmint.com/

Dragon broken ? http://aplomb.nl/TechStuff/Dragon/Dragon.html for how-to-fix tips

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

Yowza! Another Freak in Florida! Scarcer than hen's teeth they are!

Imagecraft compiler user

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

Bob,

Quote:

Yowza! Another Freak in Florida!

Wait a minute I resemble that. :)
Yeah we do seem kinda scarce, wish I was further south though. The only thing that is scarcer is a place to buy electronic parts...there are NONE here, I have to get everything online.

plons,
Thanks for the link I'll check it out.

Happy Trails,

Mike

JaxCoder.com

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

Quote:
Scarcer than hen's teeth they are!
Because alligators LOVE AVRs and anything associated with that...yummmyyy...

John Samperi

Ampertronics Pty. Ltd.

https://www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

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

js,

Gators we got but didn't know they liked AVR's, no wonder I have to order them. :)

Happy Trails,

Mike

JaxCoder.com

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

Why not use an AVR with an external memory interface? you'll get much better performance. Another option, if you want to stick with the 328p is to use a SPI based memory. [which will have similar performance to what you have above.]

Writing code is like having sex.... make one little mistake, and you're supporting it for life.

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

glitch,

I was trying to use what I had on hand additionally I had thought about SPI and SD card but thought that speed would be an issue.

Thank y'all for your valuable input.

Happy Trails,

Mike

JaxCoder.com

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

gchapman wrote:

If one can make an AVR equivalent of Bus Pirate it might be popular.

Joby did make an AVR based Ninja (Should even run on a Arduino)
http://blog.hodgepig.org/busninja/

I'm not sure if all features are implemented

/Bingo

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

Thanks Bingo looks interesting and affordable.

Happy Trails,

Mike

JaxCoder.com

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

Quote:

Why not use an AVR with an external memory interface?

mega64 or mega128 might seem an obvious candidate but I wonder if this is one occasion when using an Xmega would be justified as it's EBI is far more advanced and I imagine the DMA may come in useful too.

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

clawson,

Thanks.

Not a bad price for what all you get.

Now I'm more confused than ever y'all have given me a lot of good options now just deciding which way to go.
I started out simple and inexpensive and now see all the opportunities opening up given the hardware that's available.

Thank y'all for the valuable insight and wisdom.

Happy Trails,

Mike

JaxCoder.com

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

To be perfectly frank, if it was me I wouldn't use an 8bit for this at all. I'd use an ARM with a decent amount of DRAM (maybe 64MB+ ?). The one thing you can never have enough of in a logic analyser is buffer memory.

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

clawson,

clawson wrote:
To be perfectly frank, if it was me I wouldn't use an 8bit for this at all. I'd use an ARM with a decent amount of DRAM (maybe 64MB+ ?). The one thing you can never have enough of in a logic analyser is buffer memory.

Agreed!

I scratched my head for a while trying to think of how to do it with min. memory daisy chaining SRAM and such and it would only be able to handle short bursts.
After your last post I checked to see if the Netduino would work, been wanting to get one as I've done a lot of Visual Studio (a.k.a. Micr$s$ft) development but the boards that I've seen don't lend to adding external memory?
I'll research the ARM path you mentioned but I'm on a very tight budget (unemployed) and have to see what I can afford.

Thanks for your input.

Happy Trails,

Mike

JaxCoder.com

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

clawson wrote:
Quote:

Why not use an AVR with an external memory interface?

mega64 or mega128 might seem an obvious candidate but I wonder if this is one occasion when using an Xmega would be justified as it's EBI is far more advanced and I imagine the DMA may come in useful too.

Agreed, Was trying to stick with AVR which is why I didn't suggest anything else. However, I'm also in agreement with your follow-up ARM suggestion. another option is to use a ram chip coupled to a CPLD or FPGA to perform the sampling/storage. Then just about any micro can be used to run any UI, and provide the mechanism for retrieving the data.

Writing code is like having sex.... make one little mistake, and you're supporting it for life.

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

Quote:

I'll research the ARM path you mentioned but I'm on a very tight budget (unemployed) and have to see what I can afford.

I guess we'll all tend to recommend anything we've been using recently but I have to say that I've been blown away by the value for money offered by the FriendlyARM micro2440:

http://www.watterott.com/index.p...

The "module" is just €35:

http://www.watterott.com/en/Frie...

That's a 400MHz ARM9 based Linux computer running 2.6.32 with 64MB of DRAM and 64MB of NAND flash (in my current setup the bootloader is 256K, the kernel is 2MB and the root filing system is about 12MB so there's about 50MB of the flash still free and when Linux loads it mounts unused DRAM as something like a 37MB tempfs.

To develop it's true that you probably also need to get the "backplane":

http://www.andahammer.com/micro2...

but in that you are getting a micro2440 module and the backplane all for $95. That's the same ARM9 Linux computer but now it has 4 USB host ports, SD/MMC reader (which simply automounts just as USB sticks plugged into the ports do), a DM9000 Ethernet, three serial ports and there's even 4 LEDs and 6 buttons (which every dev board needs!).

The step from Windows app development to Linux kernel development is perhaps not such a leap as going to low level MCU work though it's true that to access the h/w in Linux you have to learn about developing Linux kernel device drivers - but that's a very saleable skill to have anyway!

As well as variants of the micro/mini2440 with various sized LCD touch screens there's even one with VGA graphic output so you could really go to town with UI design for a logic analyser if you wanted to.

Cliff

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

you could also look at Ika logic's first logic analyzer based on a mega 16, once again not a lot of samples but something that works and can store data then be analyzed with his newer software.

http://ikalogic.com/scanalogic_h...

A read of the forum for this project is also suggested if you are interested in it.

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

Mongoose,

Thanks for the heads up. I could use one right now am trying to get SD Card to work and having problems. Heeeeeelp. :)

Happy Trails,

Mike

JaxCoder.com

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

Quote:

Agreed, Was trying to stick with AVR which is why I didn't suggest anything else.

Is an Xmega an "AVR"?

Should be enough SRAM to use DMA and double-buffering and maybe 2k deep. The triggerring would control when continuous double-buffer captures are stopped. Should be able to get a few Msps.

https://www.avrfreaks.net/index.p...

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.

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

Quote:

I could use one right now am trying to get SD Card to work and having problems. Heeeeeelp

Using FatFs? If not see:

http://elm-chan.org/fsw/ff/00ind...

for the "small version" see:

http://elm-chan.org/fsw/ff/00ind...

If it is FatFs you are using already then tell us about the problems - I think a lot of us here have wired up an SD/MMC to an AVR at some stage and used FatFs to access it. There are threads about its use in Tutorial Forum that may get you over any "pit falls" though it has to be said that on the whole it just simply works.

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

clawson,

Checked out the FatF software and several others doing research while waiting for my socket.
http://www.sparkfun.com/products...
Found some software by Stefan Filipek (and I've spent the last hour trying to find out where I got it to no avail) that I've converted from ATMega16 to ATMega328p that does basic Raw read/write. During initialization it:
1) CMD_GO_IDLE - Ok
2) CMD_READ_OCR - Ok
3) CMD_SEND_OP_COND - Ok
4) CMD_CRC_OFF - Ok
5) CMD_SEND_CID - fails
I am going to trace it using my AVRDragon and see if I can shed any light on the problem.
I've enclosed a schematic, I had to change a few things to get it to recognize the card at all. Also had a bad card to contend with.

Attachment(s): 

Happy Trails,

Mike

JaxCoder.com

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

I'd really recommend switching to FatFs. Apart from anything else there's probably 50+ regulars here who've all used it - so you can get a lot of support/advice. (maybe in "AVR Forum"?)

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

clawson wrote:
I'd really recommend switching to FatFs. Apart from anything else there's probably 50+ regulars here who've all used it - so you can get a lot of support/advice. (maybe in "AVR Forum"?)

Ok thanks will do. The only reason I went with the other is that I thought it would be drop-dead simple. (ass-u-me)
I appreciate your help and patience.

Mike

Happy Trails,

Mike

JaxCoder.com

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

@Mike

And when you are finished toying around ...
Get a real "Analyzer" , it would even be usable in building your "analyzer"

http://www.seeedstudio.com/depot...
http://dangerousprototypes.com/c...
Remember to get some cables , atleast for the 16 5v tolerant ports :-)

/Bingo

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

Bingo,

I haven't quite talked myself into it yet but my b-days coming up. :)

Happy Trails,

Mike

JaxCoder.com