Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Implementing SPI interface in codes

Status
Not open for further replies.

mrinalmani

Advanced Member level 1
Joined
Oct 7, 2011
Messages
463
Helped
60
Reputation
121
Reaction score
58
Trophy points
1,318
Location
Delhi, India
Activity points
5,285
Hi
Our project requires an MCU to communicate with a device over the SPI.
The budget for the end product is very tight and MCUs with embedded SPI are slightly expensive.

Is it possible (easily) to implement SPI programmatically?
Data rate is irrelevant, a few kbps will do.

Thank you
 

Hi,

Is it possible (easily) to implement SPI programmatically?

ya, it is possible to implement the protocol programmatically with GPIO pins,
concept to implement a protocol with GPIO's is called bit banging.

Check bit banging concept on wiki, then you come know about it..

Data rate is irrelevant, a few kbps will do

Data rate is depends on the GPIO speed, anyway it is controller peripheral
can work with some kbps, we should check it...
 
Software (bit-banging) SPI examples can be found for any CPU and have been often discussed at Edaboard. I believe you can also write it from the scratch within minutes if you know the required SPI mode (clock polarity and phase).
 

Hi,

ya, it is depends on the selected slave SPI mode(clock polarity & phase).

If you know that can implement bit banging with GPIO's.
 

Just remember that when doing software SPI, a lot of time will be spent by the processor in wiggling the lines up and down.
 

... and MCUs with embedded SPI are slightly expensive.
I would question this.
You don't say what type of MCU you are looking at but even the basic ones in many manufacturer's range have a hardware SPI.
Susan
 

I am looking for MCUs that would cost less than 0.3$. Performance is not an issue.
I am thinking of Texas Instruments MSP430G2 series.
 

If you budget the design time to scale down a product down to the last cent, writing a few line of software SPI shouldn't be the problem, respectively asking someone who knows how to. I believe the original question has been answered, it's possible with any processor that can afford 3 or 4 GPIO lines.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top