electro-music.com   Dedicated to experimental electro-acoustic
and electronic music
 
    Front Page  |  Radio
 |  Media  |  Forum  |  Wiki  |  Links
Forum with support of Syndicator RSS
 FAQFAQ   CalendarCalendar   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   LinksLinks
 RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in  Chat RoomChat Room 
 Forum index » DIY Hardware and Software » Microcontrollers and Programmable Logic
Question about CPLDs
Post new topic   Reply to topic Moderators: State Machine
Page 1 of 1 [18 Posts]
View unread posts
View new posts in the last week
Mark the topic unread :: View previous topic :: View next topic
Author Message
skrasms



Joined: Feb 21, 2008
Posts: 121
Location: Portland, OR

PostPosted: Sun Nov 09, 2008 8:52 pm    Post subject: Question about CPLDs
Subject description: Trying something new
Reply with quote  Mark this post and the followings unread

I am familiar with PAL chips from my college digital logic days, but they had a lot of limitations. Right now I am looking for a chip that I can use in a pretty complicated scheme, and I wonder if it is possible with a CPLD.

I need a programmable logic chip that I can make into two halves sharing information. One half interfaces with a processor running about 2 MHz, and the other interfaces with a processor running at around 80MHz.

The point of this chip would be to take timing burdens away from the processor running at 80MHz. The 2MHz processor needs *new* data (not just old data repeated) on every clock cycle, so whatever is running on the 80MHz processor has to be interrupted for a data output routine. It makes any other code execute very slowly because of all the data output routine calls.

So I am hoping I can get some kind of programmable logic chip into this system that will guarantee the 2MHz processor is always getting the right data at the right time, and also that the 80MHz processor doesn't need to be concerned with what the 2MHz processor is doing.

Sometimes the 80MHz chip will have too much data to give the 2MHz chip at once, so it will need to get queued. Other times the 2MHz chip will need data while the 80MHz chip is doing other calculations, so then this "middle-man" chip can make sure it gets some data to keep it happy.

Right now I have everything working with no middle-man CPLD, but the queue and interrupt routines are just bogging down the 80MHz processor way too much. Also, I'm using a lot of glue logic chips in between processors that I could easily save with a single PAL chip.

Does that sound like something a CPLD could handle? It seems like something I could create on a simple PAL with the exception of the queue system that I need.

_________________
Software and Hardware Design
Back to top
View user's profile Send private message
urbanscallywag



Joined: Nov 30, 2007
Posts: 317
Location: sometimes

PostPosted: Mon Nov 10, 2008 12:28 am    Post subject: Reply with quote  Mark this post and the followings unread

You won't have a lot of memory in a CPLD to buffer the data going in between the two processors. Depending on how much you need you could either interface the CPLD to some SRAM or move into an FPGA which may have enough RAM on board. The disadvantage with FPGA is that you'll need some FLASH to configure at startup, the advantage is you may be able to put more or all of your project onto an FPGA (including processors).
Back to top
View user's profile Send private message
skrasms



Joined: Feb 21, 2008
Posts: 121
Location: Portland, OR

PostPosted: Mon Nov 10, 2008 12:45 am    Post subject: Reply with quote  Mark this post and the followings unread

urbanscallywag wrote:
You won't have a lot of memory in a CPLD to buffer the data going in between the two processors. Depending on how much you need you could either interface the CPLD to some SRAM or move into an FPGA which may have enough RAM on board. The disadvantage with FPGA is that you'll need some FLASH to configure at startup, the advantage is you may be able to put more or all of your project onto an FPGA (including processors).


I don't really need a lot of memory... 16 bytes should work great with room to spare.

Processor 2 cannot be changed because I am using it specifically for its sound hardware. Processor 1 could technically be changed to an FPGA, but it is a dsPIC being used for DSP, A/D, and miscellaneous tasks. It already has the A/D on board, so if I switched to an FPGA I'd end up with more chips. I also already have everything I need coded for the dsPIC, so I'd be starting from scratch with an FPGA.

My understanding is that FPGAs are very expensive... on the order of $10 or more. That's double the cost of the uP I'm using right now, and why I'm looking into CPLDs. I kind of assumed I could get a CPLD solution for $5, but maybe not.

_________________
Software and Hardware Design
Back to top
View user's profile Send private message
urbanscallywag



Joined: Nov 30, 2007
Posts: 317
Location: sometimes

PostPosted: Mon Nov 10, 2008 8:10 pm    Post subject: Reply with quote  Mark this post and the followings unread

I see. 16-bytes sounds entirely reasonable, 16*8 = 128 flip flops. You'll need some more for whatever state machine or FIFO controller you implement. So a CPLD with 192 flip flops in a TQFP-100 looks like $6 in quantity 1. I think that should suit your needs.
Back to top
View user's profile Send private message
skrasms



Joined: Feb 21, 2008
Posts: 121
Location: Portland, OR

PostPosted: Tue Nov 11, 2008 9:01 pm    Post subject: Reply with quote  Mark this post and the followings unread

urbanscallywag wrote:
I see. 16-bytes sounds entirely reasonable, 16*8 = 128 flip flops. You'll need some more for whatever state machine or FIFO controller you implement. So a CPLD with 192 flip flops in a TQFP-100 looks like $6 in quantity 1. I think that should suit your needs.


Someone showed me the 74HC40105, and it can take care of asynchronous FIFO control to free up macrocells. With that aspect taken care of I could actually greatly simplify the PLD functions. Even a 16V8 might be enough for my needs... and then I'd only be spending around $3 for the whole thing.

The problem there is... what can I use to program a PLD? The cheapest programmer I have found (excluding Chinese ones on ebay that I don't trust) was around $300. It seems like if I can get a microcontroller programmer for $50-70 that I should be able to get something to program PLDs for less than $100. Am I dreaming?

_________________
Software and Hardware Design
Back to top
View user's profile Send private message
urbanscallywag



Joined: Nov 30, 2007
Posts: 317
Location: sometimes

PostPosted: Tue Nov 11, 2008 9:24 pm    Post subject: Reply with quote  Mark this post and the followings unread

I don't know about 16V8 but for CPLD or FPGA there are parallel -> JTAG programming cables that are reasonably priced. You might even be able to DIY one. Smile
Back to top
View user's profile Send private message
blue hell
Site Admin


Joined: Apr 03, 2004
Posts: 24493
Location: The Netherlands, Enschede
Audio files: 298
G2 patch files: 320

PostPosted: Wed Nov 12, 2008 2:13 pm    Post subject: Re: Question about CPLDs
Subject description: Trying something new
Reply with quote  Mark this post and the followings unread

skrasms wrote:
The 2MHz processor needs *new* data (not just old data repeated) on every clock cycle


makes me curious Laughing are you feeding it instructions from another processor instead of from a ROM?

Maybe dual ported RAM could do the synchronization?

_________________
Jan
also .. could someone please turn down the thermostat a bit.
Posted Image, might have been reduced in size. Click Image to view fullscreen.
Back to top
View user's profile Send private message Visit poster's website
skrasms



Joined: Feb 21, 2008
Posts: 121
Location: Portland, OR

PostPosted: Wed Nov 12, 2008 7:13 pm    Post subject: Re: Question about CPLDs
Subject description: Trying something new
Reply with quote  Mark this post and the followings unread

Blue Hell wrote:
skrasms wrote:
The 2MHz processor needs *new* data (not just old data repeated) on every clock cycle


makes me curious Laughing are you feeding it instructions from another processor instead of from a ROM?

Maybe dual ported RAM could do the synchronization?


That is exactly what's going on Laughing

I thought about dual-ported RAM, but there were a few reasons I decided against it:

First, it's rare. It still exists, but it's not easy to come by and interface. I'm using enough obsolete chips in this design already Wink

Second, I would have to write actual software for the 2MHz processor. Right now it is using glue logic that tells it from the moment it turns on to continuously read data in as address - location - address - location - and so on. With RAM I would have to actually code out a process, and that could get pretty complicated because the "fake" code I'm generating in real-time is dynamic. It is constantly growing and shrinking in length. I might need to update 2 registers, then 1, then 3, and so on with no set pattern. There are also some other issues here that don't make sense without a much longer explanation. I get around all of them by having dynamic code length.

Third, I'd run into sync issues between the processors. If the 2MHz reads from an address the same time the 80MHz writes to it, the new data may not get through. I'd have to make some kind of routine or extra logic to guarantee none of the data gets missed.

These issues come up because I am not using the 2MHz processor for its intended purpose.

With a simple PLD + FIFO solution I could set it up so everything to be written from the 80MHz processor gets written to the FIFO register. The PLD would then generate the fake code based on the data in the FIFO register and enable it out onto the data bus accordingly. If the FIFO register is empty then the PLD can generate fake code to waste a couple cycles. With 16 stages in the FIFO I don't think they would ever all be filled. It also gives me the option to slow down the 80MHz processor without having to worry about changes in synchronization.

That's my thought process, anyway. I hope it makes sense.


I found these programmers: http://microcontrollershop.com/product_info.php?cPath=92&products_id=2551&osCsid=85c6b78ad5cb9e42896b2eda58f90def

They go for about $100 including shipping on ebay. They list all the standard 16V8, 20V8, and others as being supported. I don't know how much I can trust them, though.

_________________
Software and Hardware Design
Back to top
View user's profile Send private message
urbanscallywag



Joined: Nov 30, 2007
Posts: 317
Location: sometimes

PostPosted: Wed Nov 12, 2008 11:38 pm    Post subject: Reply with quote  Mark this post and the followings unread

Well since you have a separate FIFO now you can get yourself into a ~$1.25 range CPLD and use a cheap parallel JTAG programmer.
Back to top
View user's profile Send private message
skrasms



Joined: Feb 21, 2008
Posts: 121
Location: Portland, OR

PostPosted: Thu Nov 13, 2008 12:01 am    Post subject: Reply with quote  Mark this post and the followings unread

urbanscallywag wrote:
Well since you have a separate FIFO now you can get yourself into a ~$1.25 range CPLD and use a cheap parallel JTAG programmer.


Who makes JTAG-able CPLDs for that cheap? Do you know any specific lines off hand? I haven't found any CPLDs under $5 yet, but I might be looking in the wrong places.

_________________
Software and Hardware Design
Back to top
View user's profile Send private message
blue hell
Site Admin


Joined: Apr 03, 2004
Posts: 24493
Location: The Netherlands, Enschede
Audio files: 298
G2 patch files: 320

PostPosted: Thu Nov 13, 2008 8:53 am    Post subject: Re: Question about CPLDs
Subject description: Trying something new
Reply with quote  Mark this post and the followings unread

skrasms wrote:
That's my thought process, anyway. I hope it makes sense.


Sure it does.

I've been using a similar sort of construction in the past to bootstrap a new processor system, but that processor (Z80) had a wait input that I used to sync things with and I got it connected to the SASI port (precursor of SCSI) of my CP/M system then ... all that was needed was a couple gates to get that working (and some software, but no software on the target). Then after debugging new code this way I could just burn the new software into an EEPROM and it would then work in the target without modification .. my first ICE of sorts.

What are you cooking? It smells good Wink

_________________
Jan
also .. could someone please turn down the thermostat a bit.
Posted Image, might have been reduced in size. Click Image to view fullscreen.
Back to top
View user's profile Send private message Visit poster's website
skrasms



Joined: Feb 21, 2008
Posts: 121
Location: Portland, OR

PostPosted: Thu Nov 13, 2008 7:19 pm    Post subject: Re: Question about CPLDs
Subject description: Trying something new
Reply with quote  Mark this post and the followings unread

Blue Hell wrote:

What are you cooking? It smells good Wink


It's for my CV Nintendo module Smile
Right now there are about 7 chips between the uP and the 2A03!
It works, and sounds like this.

_________________
Software and Hardware Design
Back to top
View user's profile Send private message
urbanscallywag



Joined: Nov 30, 2007
Posts: 317
Location: sometimes

PostPosted: Thu Nov 13, 2008 8:28 pm    Post subject: Reply with quote  Mark this post and the followings unread

Altera...

PLCC
http://search.digikey.com/scripts/DkSearch/dksus.dll?Detail?name=544-1150-5-ND

TQFP
http://search.digikey.com/scripts/DkSearch/dksus.dll?Detail?name=544-1970-ND

Smile
Back to top
View user's profile Send private message
skrasms



Joined: Feb 21, 2008
Posts: 121
Location: Portland, OR

PostPosted: Thu Nov 13, 2008 8:34 pm    Post subject: Reply with quote  Mark this post and the followings unread

urbanscallywag wrote:
Altera...

PLCC
http://search.digikey.com/scripts/DkSearch/dksus.dll?Detail?name=544-1150-5-ND

TQFP
http://search.digikey.com/scripts/DkSearch/dksus.dll?Detail?name=544-1970-ND

:)


Oh cool, I'll keep those in mind for 3.3V designs. I'm working with +5 for everything else in this circuit.

_________________
Software and Hardware Design
Back to top
View user's profile Send private message
urbanscallywag



Joined: Nov 30, 2007
Posts: 317
Location: sometimes

PostPosted: Thu Nov 13, 2008 8:42 pm    Post subject: Reply with quote  Mark this post and the followings unread

Quote:
MultiVoltTM I/O interface enabling the device core to run at 3.3 V,
while I/O pins are compatible with 5.0–V, 3.3–V, and 2.5–V logic
levels


I think you'd just need a TO-92 3.3V regulator.

Cool
Back to top
View user's profile Send private message
blue hell
Site Admin


Joined: Apr 03, 2004
Posts: 24493
Location: The Netherlands, Enschede
Audio files: 298
G2 patch files: 320

PostPosted: Fri Nov 14, 2008 2:40 pm    Post subject: Re: Question about CPLDs
Subject description: Trying something new
Reply with quote  Mark this post and the followings unread

skrasms wrote:
It works, and sounds like this.


Promising!

_________________
Jan
also .. could someone please turn down the thermostat a bit.
Posted Image, might have been reduced in size. Click Image to view fullscreen.
Back to top
View user's profile Send private message Visit poster's website
skrasms



Joined: Feb 21, 2008
Posts: 121
Location: Portland, OR

PostPosted: Sun Feb 01, 2009 2:58 pm    Post subject: Reply with quote  Mark this post and the followings unread

urbanscallywag wrote:
Quote:
MultiVoltTM I/O interface enabling the device core to run at 3.3 V,
while I/O pins are compatible with 5.0–V, 3.3–V, and 2.5–V logic
levels


I think you'd just need a TO-92 3.3V regulator.

8)


I can see how to get 5, 3.3, and 2.5V logic signals in, but only 3.3 and 2.5V signals out. I know a lot of digital stuff will recognize 3.3V as a logic high on a 5V rail, but what about driving 5V CMOS?

_________________
Software and Hardware Design
Back to top
View user's profile Send private message
urbanscallywag



Joined: Nov 30, 2007
Posts: 317
Location: sometimes

PostPosted: Fri Apr 17, 2009 11:20 pm    Post subject: Reply with quote  Mark this post and the followings unread

Check the minimum high threshold of the 5V CMOS device.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic Moderators: State Machine
Page 1 of 1 [18 Posts]
View unread posts
View new posts in the last week
Mark the topic unread :: View previous topic :: View next topic
 Forum index » DIY Hardware and Software » Microcontrollers and Programmable Logic
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Forum with support of Syndicator RSS
Powered by phpBB © 2001, 2005 phpBB Group
Copyright © 2003 through 2009 by electro-music.com - Conditions Of Use