Forum Index
HomeZBasic Home   Forum RulesForum Rules   Forum FAQForum FAQ   MemberlistMemberlist   UsergroupsUsergroups   RSS FeedRSS Feed
Site SearchSite Search   LinksLinks   DownloadDownload   Digests and SubscriptionsDigests and Subscriptions
ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in   RegisterRegister
SPI 3.3v to 5v
Goto page Previous  1, 2
 
Post new topic   Reply to topic    Forum Index -> ZX-24
Author Message
sturgessb



Joined: 25 Apr 2008
Posts: 246
Location: Norwich, UK

Posted: 04 May 2008, 23:40 PM    Post subject: Reply with quote

When you say 'Update firmware', do you mean updating the VM base firmware or updating the program data?

Cheers
Ben
Back to top
dkinzer
Site Admin


Joined: 03 Sep 2005
Posts: 2593
Location: Portland, OR

Posted: 04 May 2008, 23:59 PM    Post subject: Reply with quote

sturgessb wrote:
When you say 'Update firmware', do you mean updating the VM base firmware or updating the program data?
I should have been more precise. The issue is that writing to internal Flash memory is unreliable when the voltage is too low. Internal Flash memory is written in the following instances:
  • For VM devices that use external serial EEPROM for Program Memory (e.g. ZX-24a, ZX-24p, etc.), the only time that Flash memory is written is when the VM firmware is updated.
  • For VM devices that use internal Flash for Program Memory (e.g. ZX-1281, ZX-1280), Flash memory is written when the VM firmware is updated, when a user program is downloaded and when a Program Memory data item is written.
  • For all native mode devices (e.g. ZX-24n, ZX-1281n, etc.) Flash memory is written when a user program is downloaded and when a Program Memory data item is written.
Back to top
stevech



Joined: 23 Feb 2006
Posts: 688

Posted: 05 May 2008, 3:55 AM    Post subject: Reply with quote

changing to 10MHz will affect a few things in the VM I think. Not sure there's a global to get everything affected to adapt.
Back to top
dkinzer
Site Admin


Joined: 03 Sep 2005
Posts: 2593
Location: Portland, OR

Posted: 05 May 2008, 4:31 AM    Post subject: Reply with quote

stevech wrote:
changing to 10MHz will affect a few things in the VM I think.
Many things. All of the configuration for things that are timing-related (serial, I2C, PulseIn(), InputCapture(),...) are hard coded for 14.7456MHz. A ZX simply will not work at any other frequency. While it might have been possible to code the routines to dynamically compute the proper configuration for arbitrary frequency operation, it was judged to be impractical to do so with the Flash size limitation of the original ZX.

In any event, if a ZX were to be configured for lower speed operation, the frequencies 11.052MHz, 9.216MHz or 7.3728MHz would be better choices for the AVR because they allow configuration for 115.2K baud serial port speed with 0.0% error whereas 10MHz does not.
Back to top
sturgessb



Joined: 25 Apr 2008
Posts: 246
Location: Norwich, UK

Posted: 05 July 2008, 22:58 PM    Post subject: Reply with quote

Just received a few of these from sparkfun, wondering if someone could offer some assistance...

http://www.sparkfun.com/commerce/product_info.php?products_id=8745

It has 2 channels with TX 3.3 > 5v and RX 5v > 3.3. If I want to use it to interface a 3.3v SPI device, what would the schematic be? bearing in mind I have other 5v devices on the SPI bus. Or do I need to have a separate SPI channel for 3.3v and 5v devices?

Thanks

Ben
Back to top
dkinzer
Site Admin


Joined: 03 Sep 2005
Posts: 2593
Location: Portland, OR

Posted: 06 July 2008, 3:38 AM    Post subject: Reply with quote

sturgessb wrote:
It has 2 channels with TX 3.3 > 5v and RX 5v > 3.3. If I want to use it to interface a 3.3v SPI device, what would the schematic be?
You need to translate three lines from 5V to 3.3V (SCK, MOSI and SS) and one line from 3.3V to 5V (MISO). You could use simple voltage dividers with a 2.2K and 3.3K resistors - this will produce a 3.0V level from a 5.0V level.

The resistor divider on the SparkFun breakout board is 10K/10K. This will produce a 2.5 volt level from a 5V input level. This output may not be high enough to be consistently recognized as a logic 1 by the 3.3V device. Check the device specification to determine the minimum logic 1 input level.

The low-to-high conversion is more difficult - that's were the MOSFET circuit in the SparkFun device comes in. It is similar in principle to the NPN transistor converter circuit shown in the application note AN213 External Device Interfacing.

sturgessb wrote:
do I need to have a separate SPI channel for 3.3v and 5v devices?
You need a separate chip select pin for each SPI device but they all need to be connected to the same MOSI, MISO and SCK signals. If you have multiple 3.3V SPI devices they can all be on the same side of a single set of level conversion circuits but each 3.3V device chip select needs its own conversion circuit.
Back to top
sturgessb



Joined: 25 Apr 2008
Posts: 246
Location: Norwich, UK

Posted: 06 July 2008, 14:10 PM    Post subject: Reply with quote

Do I need to translate the 3.3v to 5v? Will the zx not read the 3.3v as logic high?
Back to top
dkinzer
Site Admin


Joined: 03 Sep 2005
Posts: 2593
Location: Portland, OR

Posted: 06 July 2008, 15:03 PM    Post subject: Reply with quote

sturgessb wrote:
Will the zx not read the 3.3v as logic high?
The specifications for the AVR indicate that the minimum voltage that is reliably recognized as a logic 1 is 0.6 * Vcc. If your supply voltage is exactly 5.0 volts that means the threshold is 3.0 volts. If your supply voltage is lower, the threshold is lower.

The other important aspect of this issue is the minimum voltage that will be output by the 3.3V device as a logic 1. If that is comfortably above the minimum level recognized by the AVR then you're all set. Check your device's datasheet.

It is a good practice to design your circuits with a safety margin. For example, you might choose a 10% safety margin. Applied to the issue above, if the threshold for a logic 1 is 3.0v, you would add 10% to that and use 3.3V as the minimum. On the other side, if the device guarantees a 3.1V output for logic 1 you would subtract 10% and use 2.8V. Using this safety margin, a level converter is clearly required.
Back to top
GTBecker



Joined: 18 Jan 2006
Posts: 472
Location: Cape Coral

Posted: 06 July 2008, 15:21 PM    Post subject: SPI 3.3v to 5v Reply with quote

Although perhaps not ideal, I've had no difficulty with a 5v pullup on
the 5v input and a forward diode drop to the 3.3v logic output. That
puts the 5v logic input 0.6v above the 3.3v logic high output, and its
low at ~0.6v since logic low is essentially zero volts for both families.

Tom
Back to top
dkinzer
Site Admin


Joined: 03 Sep 2005
Posts: 2593
Location: Portland, OR

Posted: 06 July 2008, 15:52 PM    Post subject: Re: SPI 3.3v to 5v Reply with quote

GTBecker wrote:
I've had no difficulty with a 5v pullup on the 5v input and a forward diode drop to the 3.3v logic output.
This type of level converter circuit is also described in AN213 on page 10. As shown there in the schematics it can be used to convert either direction.
Back to top
Display posts from previous:   
Post new topic   Reply to topic    Forum Index -> ZX-24 Time synchro. with the server - Timezone/DST with your computer
Goto page Previous  1, 2
Page 2 of 2

 


All content Copyright © 2005-2012 Elba Corp. All Rights Reserved.
Opinions expressed in posts are those of the author and not necessarily those of Elba Corp.
Powered by phpBB © 2001, 2005 phpBB Group