[SOLVED] Question about SPI and Microcontroller

Status
Not open for further replies.

gghhh

Junior Member level 2
Joined
Oct 2, 2012
Messages
20
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,283
Activity points
1,402
Hello all,

I have a small doubt I have three devices that is connected to a microcontroller.

1. ASIC (1)
2. Zarlink (1)
3. Accelerator(3)

NOTE: 1,1,3 are the no. of devices I am using.

So a micro-controller should have min. 5 SPI to connect or just 3 SPI is enough?
 

Re: Question abt SPI and Microcontroller

Hello!

Your question is not clear.
An ASIC (application specific IC) does not necessarily have a SPI serial port.
Zarlink is a brand name.
Accelerator? Is it Accelerometer?

Anyway, supposing you want to connect 5 SPI devices, you can connect them to one single SPI bus
provided you have 5 chip-select lines to specify the device you are talking to.

Dora.
 
Re: Question abt SPI and Microcontroller

So, you have five SPI devices to connect in total.

Are these SPI slaves?
Do these devices each have an Enable, Chip Select or Slave Select input?
Do you need to talk to them simultaneously, or can you service them one at a time?

If the devices are slaves, have Enable, CS or SS lines and you can service them one at a time, then simply use select lines to control which device is currently communicating.
 
Reactions: gghhh

    gghhh

    Points: 2
    Helpful Answer Positive Rating
Re: Question abt SPI and Microcontroller

Asic is an application specific and Zarlink (ZL70101) is for wireless transmission of data and Accelerometer(LIS331DL).

ASIC works at 1.4Mhz frequency,

All i have to do is to send the data from Accelerometer and ASIC thru wireless and that too one at a time.

I am looking at the AT32UC3B0256 microcontroller, it seems fine and is capable of performing the task.

What I am confused at is How can I assign a GPIO to a SPI?

For example:

for ASIC can I assign:

PA15 [SPI0 - SCK] to ASIC_SPI_CLK
PA09 SPI0 - NPCS[2]] as ASIC_SPI_CS

Then 3 Accelerometer

PA17 [SPI0 - SCK] as ACC_SPI_CLK

PA16 [SPI0 - NPCS[0]] as ACC1_SPI_CS
PA23 [SPI0 - NPCS[1]] as ACC2_SPI_CS
PA24 [SPI0 - NPCS[0]] as ACC3_SPI_CS

For Zarlink:

I dont have a clock so can i use any GPIO to generate clock.

PA10 [SPI0 - NPCS[2]] as Zarlink_SPI_CS

Then MISO and MOSI as PA18 and PA19 resectively.
 
Last edited:

Re: Question abt SPI and Microcontroller

Hello!

Usually you don't use GPIO for SPI, you choose a processor which is SPI capable.
You can simulate SPI by GPIO, it's called bit banging, but the easiest way to do SPI
is to use a processor with an internal SPI device. Of course, you will use GPIO for
chip select.

The way to do it is to wire your MCU_MISO to all your devices MISO
same for MOSI and clock, and wire one CS per device to one bit of a GPIO.

PA09 SPI0 - NPCS[2]] as ASIC_SPI_CS
PA16 [SPI0 - NPCS[0]] as ACC1_SPI_CS
PA23 [SPI0 - NPCS[1]] as ACC2_SPI_CS
PA24 [SPI0 - NPCS[0]] as ACC3_SPI_CS

By the way, isn't it logically PA24 [SPI0 - NPCS[2]] as ACC3_SPI_CS?

For Zarlink:
I dont have a clock so can i use any GPIO to generate clock.
PA10 [SPI0 - NPCS[2]] as Zarlink_SPI_CS
Then MISO and MSI as PA18 and PA19 resectively.

What do you mean by I don't have a clock? The zarlink module does not have a clock?
In this case it's an UART and you should wire it to the MCU UART, not to GPIO.

Dora.
 
Reactions: gghhh

    gghhh

    Points: 2
    Helpful Answer Positive Rating
Re: Question abt SPI and Microcontroller

Cannt I use SPI for Wireless transmission?
 
Last edited:

Re: Question abt SPI and Microcontroller

Cannt I use SPI for Wireless transmission?

The ZL70101 module provides an SPI interface by which to control and send data from the MCU to ZL70101.

However, the actual wireless transmission utilizes a Reed-Solomon coding scheme with CRC over ISM.

Why have you selected the ZL70101 module? Is this a medical application?

There are several other wireless options which can provide greater throughput at low cost.


BigDog
 
Reactions: gghhh

    gghhh

    Points: 2
    Helpful Answer Positive Rating
yes its for medical application and its mandate that i have to use zl70101.
 

It fits the requirements, the biggest being cost... My supervisor can order it for free of cost.

- - - Updated - - -

How can I have 3 different SPI_CLK using AT32UC3B0256 it says in the doc that i can have 4 SPI connected but HOW?

http://www.atmel.com/devices/at32uc3b0256.aspx?tab=parameters

Ohh yes i need to have three different SPI_CLK and 5 SPI_CS.
 
Last edited:

SPI slave devices connected to the SPI interface, all share the MISO, MOSI and CLK lines, only the SS/CS lines must be unique.

When a particular slave devices is not selected by its individual SS/CS line, it simply ignores any activity on the other three lines.

Which is why for N SPI slave devices attached, you need 3+N I/O lines.


BigDog
 
Reactions: gghhh

    gghhh

    Points: 2
    Helpful Answer Positive Rating
Thank you very much.
 
Last edited:

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…