> -----Original Message----- > From: D Lloyd [SMTP:dan.lloyd@GB.ABB.COM] > Sent: Wednesday, September 20, 2000 3:27 PM > To: PICLIST@MITVMA.MIT.EDU > Subject: Re: [OT]: PC simulating SPI slave/master > > > > Hi, > > Thinking a bit more about it, the PC will be purely the slave device and I > dont > really need any "master" functionality. I have found a program that > squirts out > SPI data from a PC so this may suffice to some extent, although I wanted > to > create my own data structures etc. > That sounds very much like it's the master to me. Is the PC responsible for generating the clock (SCK) or does the embedded system produce the clock? > As to the speed, the embedded host can only > clock fast enough for 60 kilobits per second; I imagine that if this > 533Mhz PC > cannot manage that (under DOS - I just know Windows is going to be > trouncing it) > then it is time to pack in! > As a master you could probably get in excess of 1Mbit/sec through the serial port in DOS with a fast CPU and tight coding. You could even use something like VB and get a decent data rate, although timing is tricky. With a slave implementaion, the PC has to poll the clock to look for a 1-0 or 0-1 transistion before reading in the state of the data line. You would have to sample the clock at several times the maximum speed of the bus to get reliable results. > The other way I can imagine it working is for me to borrow our contractors > 877 > dev kit and plonk a load of data in that, then set it up to deliver the > synchronous serial data.......Oh joy(!) > > Regards, > Dan > I was going to suggest knocking up an SPI to RS232 converter using a PIC! Nice little project for you. But serialously :o) I would use Qbasic or a Dos compiler to do the job of a master. Mike > |-------------> > |(Embedded | > |image moved | > |to file: | > |pic16904.pcx)| > | | > |-------------> > > >------------------------------------------------------------------------| > |Michael Rigby-Jones > | > |20/09/2000 15:11 > | > > >------------------------------------------------------------------------| > > > > Please respond to pic microcontroller discussion list > > > To: PICLIST@MITVMA.MIT.EDU > cc: (bcc: Dan Lloyd/GBPTD/ABB) > Subject: Re: [OT]: PC simulating SPI slave/master > > Security Level:? Internal > > > > I don't have any SPI code, but a master implementation would be very > simple > to write, even in something like QBASIC. I think making an SPI slave that > works at reasonable frequencies will be pretty hard work though. You will > have to be polling the clock line at a ridiculous rate for say, a 500KHz > SPI > clock. Unlike I2C (AFAIK) you can't use clock stretching to slow the > slave > down. > > Mike > > > > > -----Original Message----- > > From: D Lloyd [SMTP:dan.lloyd@GB.ABB.COM] > > Sent: Wednesday, September 20, 2000 2:18 PM > > To: PICLIST@MITVMA.MIT.EDU > > Subject: [OT]: PC simulating SPI slave/master > > > > Hi, > > > > I am on the verge of writing some parallel port control code to simulate > > the PC > > as being an SPI slave or master to prove out an embedded system. > > Eventually, I'd > > like the PC to supply data (as though it were the peripheral it is > > simulating) > > to the embedded micro for testing purposes (as the peripheral doesnt > > actually > > exist, as yet....if that makes sense!) > > > > I just wondered if anyone has written such a beast? I dont imagine too > > much work > > involved (just bit bashing the parallel port to generate the clock and > > data) but > > it could save some valuable time if anyone out there has done this > > already.. > > > > Any help would be greatly appreciated. > > > > Regards, > > > > Dan Lloyd > > > > -- > > http://www.piclist.com hint: The list server can filter out subtopics > > (like ads or off topics) for you. See http://www.piclist.com/#topics > > > > > > -- > http://www.piclist.com hint: The list server can filter out subtopics > (like ads or off topics) for you. See http://www.piclist.com/#topics > > > > > > > << File: pic16904.pcx >> -- http://www.piclist.com hint: The list server can filter out subtopics (like ads or off topics) for you. See http://www.piclist.com/#topics