Hi
I have built an SPI/Ethernet TCP/IP co-processor using the NE64 in SPI slave mode and found it worked fine. Therefore I don't think that there is a bug in the chip.
There have been some posings concerning problems but as far as I know these could always be solved by correct coding.
Here's a very brief initialisation and slave (reception/)transmission sequence (probably well out of context) but you may see something. If you have no luck, send me your code and perhaps I can see wheat is going wrong.
Cheers
Mark
unsigned char ucTestByte = 0x55; // test byte
SPICR1 = (SPIE | SPE); // enable in slave mode - enable interrupt of rx char
SPIDR = ucTestByte ; // prime first test byte.
.. when master reads(sends), it will read the test byte and interrupt will occur
void SPI_Interrupt(void) // interrupt routine when byte read
{
volatile unsigned short usDummy = SPISR; // dummy read of status register on entry (we know it is rx)
volatile unsigned char ucRx = SPIDR; // read the received byte
while (!(SPISR & SPTEF)) {} // wait until Tx complete before setting next byte
SPIDR = ++ucTestByte ; // send next value
}
Hi
It is a shame that things are not working out just yet. I have had a quick think and just two things spring to mind.
1. You say that you receive an echo from the NE64. This sounds in fact to be quite normal for a slave device which doesn't have any data ready to be sent - that means I have also experienced this (not sure whether the NE64 or another) but it seems to be the way the SPI shift registers work. If there is data ready to be sent it will be sent and if not there is probably an echo. This means that you should carefully check the parts of code which are writing the data to be transmitted when the master reads because it may be that this is somehow not really writing the register correctly.
2. The SSEL line. The slave requires it be activated by the SSEL line, which is probably the case since it must be driving the MISO line to send the echos. I looked at the code at the master side of my design (a Philips LPC2106) and saw that I set the SSEL line to '0' when sending and back to '1' between each byte being send. Not sure why but it may be that the NE64 needs this.
The operation of the SSEL line seems to be ill defined between devices since the SSEL line in master mode is activated automatically to drive just during each byte transmission for some devices (I think it's like this for the NE64) and this will not work with some peripheral devices. I have a file system for a web browser which is in external SPI EEPROM and it was, for example, not possible to use the SSEL line of the NE64 SPI in automatic operation mode - the SPI EEPROM just didn't want to know. Therefore I had to program the output as a normal port and activate it continuously during block read and writes - this worked fine.
Check out these points before giving up, maybe there is something there. Ifyou are setting SSEL continuously low from the PIC try just activating during each byte tranmission...
Cheers
Mark Butcher
www.mjbc.ch