XMega multiple SPI, I2C ports

Discussion about the ZBasic language including the System Library. If you're not sure where to post your message, do it here. However, do not make test posts here; that's the purpose of the Sandbox.
Post Reply
twesthoff
Posts: 247
Joined: 17 March 2006, 6:45 AM
Location: Fredericksburg, VA

XMega multiple SPI, I2C ports

Post by twesthoff »

I see in the manual where there is a way to select the many hardware UARTs available with the ZX-128A1 XMega devices. I did not see how to select one of the SPI or I2C (or the other compare I/O's etc.).

How in ZBasic do we select these interfaces when there are multiple interfaces on multiple ports to choose from?
dkinzer
Site Admin
Posts: 3120
Joined: 03 September 2005, 13:53 PM
Location: Portland, OR

Re: XMega multiple SPI, I2C ports

Post by dkinzer »

twesthoff wrote:How in ZBasic do we select these interfaces when there are multiple interfaces on multiple ports to choose from?
The System Library routines for SPI and I2C use a pre-determined "port" and there is currently no way to change it. The I2C routines use the I2C controller on port C and the SPI routines use the SPI controller on port D.

If you want to use an alternate I2C or SPI controller on the xmega you'd have to write your own code for doing that. The SPI controller is fairly simple but the I2C controller is a bit more complex.
- Don Kinzer
twesthoff
Posts: 247
Joined: 17 March 2006, 6:45 AM
Location: Fredericksburg, VA

XMega multiple SPI, I2C ports

Post by twesthoff »

Thanks for the info Don,
In the future, adding an option or additional parameters to the OPenI2C or OpenSPI that would allow selecting the various XMega ports would be great!
Tom

On 1/10/2011 5:55 PM, ZBasic wrote:
twesthoff wrote: How in ZBasic do we select these interfaces when there are multiple interfaces on multiple ports to choose from? The System Library routines for SPI and I2C use a pre-determined "port" and there is currently no way to change it. The I2C routines use the I2C controller on port C and the SPI routines use the SPI controller on port D.

If you want to use an alternate I2C or SPI controller on the xmega you'd have to write your own code for doing that. The SPI controller is fairly simple but the I2C controller is a bit more complex.



- Don Kinzer



dkinzer
Site Admin
Posts: 3120
Joined: 03 September 2005, 13:53 PM
Location: Portland, OR

Re: XMega multiple SPI, I2C ports

Post by dkinzer »

twesthoff wrote:In the future, adding an option or additional parameters to the OPenI2C or OpenSPI that would allow selecting the various XMega ports would be great!
Do you envision needing to change the port at run time?
- Don Kinzer
twesthoff
Posts: 247
Joined: 17 March 2006, 6:45 AM
Location: Fredericksburg, VA

XMega multiple SPI, I2C ports

Post by twesthoff »

I had thought of the possibility of using more than one I2C port, and sending commands to both depending on which chip I wanted to talk to. 

Not for this particular design though.  I was drawing the schematic and saw that there was many choices with the XMega part and some of the UART, SPI and I2C pins conflict.  Sometimes it makes the layout simpler to use certain pins to do something, and I just naturally thought it would be useful to be able to choose the port to use , rather than being required to use only one SPI port/pin combination and one SPI port/pin combination.

Since I am using only one SPI and one I2C and two UARTS I will change my schematic to work with the pins you have selected. 

I did have a future project for which I was thinking about using multiple I2C and SPI ports, although I am sure there are ways to do it using only one port.


On 1/10/2011 7:54 PM, ZBasic wrote:
twesthoff wrote: In the future, adding an option or additional parameters to the OPenI2C or OpenSPI that would allow selecting the various XMega ports would be great! Do you envision needing to change the port at run time?



- Don Kinzer



twesthoff
Posts: 247
Joined: 17 March 2006, 6:45 AM
Location: Fredericksburg, VA

XMega ports

Post by twesthoff »

As I was re-working my schematic, I realized that the main reason I would like to be able to assign a different I2C or SPI port. For example, I could use Port D for Com1, I2C, and SPI. This would use all pins of Port D, and allow Port C to be used for byte wide purposes. As it is now part of Port C is used and part of Port D is used.

There are a lot of Ports available on the XMega devices, so for some designs that is OK, but if one wanted to use a lot of the port features it could cause issues.
tomhilton
Posts: 26
Joined: 03 July 2009, 8:24 AM
Location: Peoria AZ
Contact:

ATxmega Compiler Support

Post by tomhilton »

I would like to use the individual ATXmega chips you sell, but your compiler really does not support them completely. I don't want to have to write in C or Assembly, I should be able to do it in Zbasic.
You really need to provide support for the ATXmega IC's if you are going to sell them.

In fact it does not support all the pins on many of the ZX-32 and ZX1281 ic's. Not good. It almost makes it worthless to use these
and necessary to use the modules.

Not very happy, as I have my schematic done. I was planning on using all 5 uarts on the ZX-32x4, and at least 12 more IO pins.
I really don't want to have to go back to C and purchase an update to my compiler to support the ATxmega processors. Not a very happy camper at this moment.
Thomas Hilton
www.arizonaskys.com
dkinzer
Site Admin
Posts: 3120
Joined: 03 September 2005, 13:53 PM
Location: Portland, OR

Re: ATxmega Compiler Support

Post by dkinzer »

tomhilton wrote:I would like to use the individual ATXmega chips you sell, but your compiler really does not support them completely.
I don't know which particular features you're referring to. The latest release of the ZBasic compiler supports alternate SPI and I2C controllers on xmega devices (see, for example, OpenSPI) and has always supported the full complement of USARTs on all ZX chips.

If you can identify the specific resources you'd like to use I can probably point you in the right direction.
tomhilton wrote: I don't want to have to write in C or Assembly, I should be able to do it in Zbasic.
Generally speaking, the ZBasic System Library routines support most of the AVR chip features but the coverage is not 100%. Depending on what feature you want to use that isn't covered, you can, in most cases, still use the feature by writing ZBasic code to manipulate the related registers. Resorting to C or assembly language will seldom, if ever, be necessary.
- Don Kinzer
Post Reply