Eight SPI *and* a UART on XMega A1U?

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

Folks,

I am looking for a device with eight SPI channels and a UART. A parametric search on the website indicates that, for example, the XMega A1U can do this. In fact, it says there are twelve SPI ports. However, reading the data sheets, that does not seem to be the case at all. In fact I do not understand how they can claim as, it seems to me, the SPI pins are shared with the USARTs, rending a claim of twelve to be, at best, a mistake!

Am I missing something? AFAICS, you cannot remap the comms interfaces outside of ports C,D,E,F. So, that gives you two SPIs per port, which is eight.

Can someone clarify please, what the situation is. Is the parametric search just plain wrong? IS it the case that you can have eight USARTs, but then no SPIs?

Many thanks!

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

You have not understood the idea behind a bus.

Instead of 1 - 50 motor cars taking 1 - 50 people, you have one bus that has 1 - 50 passengers.

So you connect all your SPI devices to the same bus. You have a separate /CS for each device. SPI is very fast. You talk to one device at a time.

Regarding "marketing". Each USART can behave a SPI master. Each SPI peripheral can be master or slave. Obviously, if you are using USART_MSPI, it is no longer available as a regular USART.

In practice, you might want to talk to two SPI devices at the same time. So you might use two SPI buses. Much like using a double-decker on one route and a single-decker on another route.

David.

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

Thank you for insulting my intelligence. I understand precisely what a bus is and you have no idea what my application is or why I need eight SPI buses.

Also, of course if you're using a peripheral as an SPI you can't use it as a UART, but read my post again. The parametric search says it has *twelve* SPIs.

My simple question remains: can you actually have eight SPIs and a UART or not?

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

If you have a genuine application that needs 8 SPI chanels open at one time, you could describe it.

I don't have a 128A1U. Just a regular 128A1.

SPIC, SPID, SPIE, SPIF
USARTC0, USARTD0, USARTE0, USARTF0 in MSPI mode.

So if you are using all of them, you can't have a separate USART.

Yes, I agree with you. Marketing is lying through their teeth. (unless you can remap other ports)

8 SPI + 0 USART
4 SPI + 4 USART
0 SPI + 8 USART

I still think that you need to explain why you need so many independent SPI buses.

David.

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

I too am intrigued to know the reason for them having to be separate. I suppose you could start an exchange on SPI0 and while it was occurring start the next on SPI1 and so on and thus overlap the comms a bit but in reality aren't you really going to be doing them in round-robin anyway?

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

Ignore David, he's always a bit grumpy.

You are correct, there is no way to get 8 SPI buses and a USART. Technically there are 12 available SPI buses, but four of them are USARTs in SPI master mode and share pins with the SPI peripherals.

This is quite normal for microcontrollers. It is rare to find one that has dedicated pins for everything. For example you couldn't use all 16 ADC channels and the DACs at the same time, or USB and SPI on port D.

So yeah, technically there are 12 SPI buses, you just can't use them all simultaneously. A bit misleading. Maybe you could bit-bang a UART? Or use an I2C to UART bridge.

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

Chaps,

I appreciate your assistance, I really do, but all I can say is that for timing reasons, I need eight separate SPI buses. Having two devices on one bus, then updating one before updating the next will not do what I need because half the devices would be updated before the others.

NIOS is probably the way to go for me in this instance.

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

Mojo-chan,

Thanks for the post, I realise that it is regularly the case that pins are shared (I've been designing stuff for twenty-five years), but I've never seen anyone claim they have twelve peripherals of a type then to find you can only access eight of them. It's often the case you have, say, four UARTS, four SPIs, but you cannot access 'em all at the same time. That's fine and understandable the way the pins have multiple use. But to say we have have twelve SPIs, but, soz, you can only actually use eight is nothing short of bizarre. In that case, you don't have twelve, you have eight. :p

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

I agree with you, it is misleading.

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

mojo-chan wrote:
Ignore David, he's always a bit grumpy.

You are correct, there is no way to get 8 SPI buses and a USART. Technically there are 12 available SPI buses, but four of them are USARTs in SPI master mode and share pins with the SPI peripherals.

Sorry, I have been getting grumpy recently.

Surely this is 8 USARTS in MSPI mode and 4 regular SPI.

Yes, it is extremely misleading to describe it as 12 SPI.

David.