|
|
| Author |
Message |
sturgessb
Joined: 25 Apr 2008
Posts: 246
Location: Norwich, UK
|
|
Posted: 27 June 2008, 15:35 PM Post subject: I2C Slave mode |
|
|
Im trying to use the new I2C slave functions but i seem to have hit a roadblock.
I need to use inputcapture() on pin 12, as well as wanting to use I2Cslave mode, which wants to use the same pin for SCL.
Is there no way of getting I2Cslave to work by using a software I2C channel, or does it need to be channel 0?
not a huge problem as i can use SPI, just wondering
Regards
Ben
|
|
| Back to top |
|
 |
dkinzer Site Admin
Joined: 03 Sep 2005
Posts: 2499
Location: Portland, OR
|
|
Posted: 27 June 2008, 15:54 PM Post subject: Re: I2C Slave mode |
|
|
| sturgessb wrote: | | Is there no way of getting I2Cslave to work by using a software I2C channel, or does it need to be channel 0? | The I2C Slave, being interrupt driven, must use the I2C hardware channel. That's why there is no "channel" parameter on OpenI2CSlave().
|
|
| Back to top |
|
 |
mikep
Joined: 24 Sep 2005
Posts: 765
Location: Austin, TX
|
|
Posted: 27 June 2008, 15:58 PM Post subject: |
|
|
I believe you are using a ZX-128ne. For this device there are two input capture pins available as pin numbers 8 and 13 as described in the Oak Micros Technical Reference on page 15. SDA/SCL are on pins 11 and 12 respectively.
If you are using one of the ZX 24 pin devices then SCL and Input Capture are shared on the same pin 12. The only solution is to use one of the Oak Micros 40 pin devices where these two signals are on separate I/O pins. This is one of the reasons why Oak Micros provides 40 pin versions of the ZX 24 pin devices (and there are 15 other reasons). The "top" 24 pins of the Oak Micros devices are compatible with the their ZX 24 pin equivalents. For example Oak Micros 40 pin ZX-24pe is compatible with the Elba Corporation ZX-24p where the "e" denotes extended I/O capability.
|
|
| Back to top |
|
 |
sturgessb
Joined: 25 Apr 2008
Posts: 246
Location: Norwich, UK
|
|
Posted: 27 June 2008, 16:33 PM Post subject: |
|
|
you are right mike, but im trying to network it to a zx-24ne
no matter, im using SPI instead.
although one thing... it says SPI CS is pin 24, is that right? thats Vin
ben
|
|
| Back to top |
|
 |
mikep
Joined: 24 Sep 2005
Posts: 765
Location: Austin, TX
|
|
Posted: 27 June 2008, 16:45 PM Post subject: |
|
|
| sturgessb wrote: | you are right mike, but im trying to network it to a zx-24ne
no matter, im using SPI instead.
although one thing... it says SPI CS is pin 24, is that right? thats Vin
ben |
Something is wrong here. Do you mean network a ZX-128ne to a ZX-24n? I don't think you have any ZX-24ne devices.
The pin numbering is different for the ZX-24n and ZX-24ne and follows the standard numbering for 24-pin and 40-pin DIPs. For example Vin is pin 24 for a ZX-24n and pin 40 for a ZX-24ne.
|
|
| Back to top |
|
 |
dkinzer Site Admin
Joined: 03 Sep 2005
Posts: 2499
Location: Portland, OR
|
|
Posted: 27 June 2008, 16:47 PM Post subject: |
|
|
| sturgessb wrote: | | it says SPI CS is pin 24, is that right? thats Vin |
No. Check the diagram at http://www.zbasic.net/doc/ZBasicRef.php?page=133 . The CS pin is available at the pad just to the left of pin 1.
However, using a ZX-24n as an SPI slave is problematic because the CS signal is connected to the CS input of the onboard SPI EEPROM. This will be a problem if the ZX-24n is programmed as a slave because both the processor and the SPI EEPROM will respond to the SPI.
One solution is to remove the SPI EEPROM from the board - it is essentially a "spare part" on the ZX-24n, not used for anything. This is recommended only for those that have surface mount rework skills.
|
|
| Back to top |
|
 |
GTBecker
Joined: 18 Jan 2006
Posts: 457
Location: Cape Coral
|
|
Posted: 27 June 2008, 17:01 PM Post subject: I2C Slave mode |
|
|
> ... ZX-24n as an SPI slave is problematic... One solution is to
remove the SPI EEPROM...
So, is SPI Slave on a ZX-24n is not possible without module modification, Don?
Tom
Last edited by GTBecker on 27 June 2008, 20:04 PM; edited 1 time in total |
|
| Back to top |
|
 |
sturgessb
Joined: 25 Apr 2008
Posts: 246
Location: Norwich, UK
|
|
Posted: 27 June 2008, 17:17 PM Post subject: |
|
|
| yeah you are right mike its a 24n, my mistake.
|
|
| Back to top |
|
 |
mikep
Joined: 24 Sep 2005
Posts: 765
Location: Austin, TX
|
|
Posted: 27 June 2008, 17:18 PM Post subject: |
|
|
| dkinzer wrote: | However, using a ZX-24n as an SPI slave is problematic because the CS signal is connected to the CS input of the onboard SPI EEPROM. This will be a problem if the ZX-24n is programmed as a slave because both the processor and the SPI EEPROM will respond to the SPI.
One solution is to remove the SPI EEPROM from the board - it is essentially a "spare part" on the ZX-24n, not used for anything. This is recommended only for those that have surface mount rework skills. | This is a little unfortunate. It is probably worth updating the AN219 application note to point out that the ZX-24n cannot be used as a SPI slave and does not provide InputCapture capability if used as an I2C slave. This is all part of the trade-off of using a small 24-pin device.
Other options instead of a ZX-24n would be to use a ZX-40n or ZX-44n. If you have a ZX-24ne then you just need to unplug the SPI EEPROM from its socket.
If you have a ZX-24n and the SMD soldering skills then all you really need to do is to unsolder/lift pin 1 on the EEPROM. If you cannot identify which is pin 1 then you probably shouldn't be trying it in the first place.
|
|
| Back to top |
|
 |
mikep
Joined: 24 Sep 2005
Posts: 765
Location: Austin, TX
|
|
Posted: 27 June 2008, 18:43 PM Post subject: Two peas in a pod |
|
|
Attached is a picture of two ZX-24ne devices connected as a SPI slave and master; the master is on the right. The output from the SPI master is | Code: | Slave ID: ZX24ne
Slave RAM size: 4096 bytes
|
The red LEDs are the device power monitors. The four white wires are for SPI, the three orange wires leaving the top middle of the picture are the RS-232 connection to a PC, and the other brown/black wires are power. No CS pullup resistor is required as that is already on board the slave ZX-24ne.
| Description: |
| Breadboarding SPI Master and Slave using Oak Micros ZX-24ne devices. |
|
| Filesize: |
124.96 KB |
| Viewed: |
5639 Time(s) |

|
|
|
| Back to top |
|
 |
dkinzer Site Admin
Joined: 03 Sep 2005
Posts: 2499
Location: Portland, OR
|
|
Posted: 27 June 2008, 18:55 PM Post subject: |
|
|
| mikep wrote: | | all you really need to do is to unsolder/lift pin 1 on the EEPROM. | The chip's CS pin should probably be tied high. Another option is to leave CS connected and lift the SO pin (pin 2).
|
|
| Back to top |
|
 |
GTBecker
Joined: 18 Jan 2006
Posts: 457
Location: Cape Coral
|
|
Posted: 27 June 2008, 19:45 PM Post subject: |
|
|
On the bottom of the ZX-24n, there is an opportunity to cleanly cut SO from the '256. A drill bit could also remove the bottom of the through-hole easily.
| Description: |
| Yellow line cut for no SO from '256. |
|
 Download |
| Filename: |
ZX24n_Native_Cut.JPG |
| Filesize: |
255.42 KB |
| Downloaded: |
3303 Time(s) |
Last edited by GTBecker on 27 June 2008, 20:45 PM; edited 1 time in total |
|
| Back to top |
|
 |
mikep
Joined: 24 Sep 2005
Posts: 765
Location: Austin, TX
|
|
Posted: 27 June 2008, 20:06 PM Post subject: |
|
|
| GTBecker wrote: | | On the bottom of the ZX-24n, there is an opportunity to cleanly cut SO. A drill bit could also remove the bottom of the through-hole easily. | Good find but a word of caution. All of these techniques for disabling the on board EEPROM probably void any kind of warranty for the device and some are not easily reversed. They are not for the faint of heart either.
|
|
| Back to top |
|
 |
GTBecker
Joined: 18 Jan 2006
Posts: 457
Location: Cape Coral
|
|
Posted: 27 June 2008, 20:15 PM Post subject: |
|
|
Alternatively, two cuts and two jumpers can save the '256 EEPROM function.
Here, /CS is cut and jumpered around the '256, and the '256 /CS is jumpered to ZX-24n pin 5 (or any other) for its /CS. A pullup on that pin might be required to prevent the '256 from selecting when in processor Reset (but does that matter in Native devices)?
| Description: |
| Cuts '256 from /CS, reconnects it to ZX-24n Pin5. |
|
 Download |
| Filename: |
ZX24n_SPISlaveWith 256_Cuts_and_Jumper.JPG |
| Filesize: |
264.56 KB |
| Downloaded: |
3229 Time(s) |
|
|
| Back to top |
|
 |
dkinzer Site Admin
Joined: 03 Sep 2005
Posts: 2499
Location: Portland, OR
|
|
Posted: 28 June 2008, 3:39 AM Post subject: |
|
|
The images in the two recent posts appear to be the R6 revision of the board which was used for the early ZX-24n builds. The current production for all 24-pin devices is R7 which is similar, but not identical. The attached image is an excerpt from the bottom layer of the R8 board.
| Description: |
|
| Filesize: |
25.05 KB |
| Viewed: |
5596 Time(s) |

|
|
|
| Back to top |
|
 |
|