Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

SPI SLAVE Bit bang.

Status
Not open for further replies.

AtomSoft

Well-Known Member
hey guy im trying to make my own SPI Slave bitbang code and wanted to know whats the flow?

I know i have to:

1. Check CS line
2. Get data (command)
3. Check command and run other code to command
4. if command ask me to send data back when clock is pulsed

What im worried about is how much time do i have between getting the command and sending the data?

What standards are there? i hear of a 100khz and 400khz or does it depend solely on the master?
 
hey guy im trying to make my own SPI Slave bitbang code and wanted to know whats the flow?

What im worried about is how much time do i have between getting the command and sending the data?

What standards are there? i hear of a 100khz and 400khz or does it depend solely on the master?

Everything is controlled by the clock so that is what you need to respond to. How much control do you have over the master? Is is in one of your own projects?
 
There's phase and polarity standards. You can check the wiki for descriptions.

It's generally the Master responsibility to use whatever SPI Mode that the Slave supports.

Otherwise there's no timing standard. Generally they try to make the slave support as fast an interface as possible.
 
i was making my own DOSonChip and Wanted to use SPI as the protocol for sending and recieving data.
Both the master and slave are PICs with my own code so... complete control...

Im thinking about using USART now tho.
 
i assumed that Nigel :D thanks
Ill try to add the feature today and ill use interrupts and flags when data is sent and read this way i know when its complete. I need to make a packet system tho like so i know commands and arguments. Like:

Command|Arg5|Arg4|Arg3|Arg2|Arg1|Arg0...|END(0xFF)

to read a file would be like

0x01| seek_position | bytes | etc....

If i had that ARM7 it would be a issue :D
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top