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?
 

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 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
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…