Skip to content

Endian-mess

January 22, 2016

So, before I pack for florida I just want to make sure SPI works in both directions. One easy way to do that is to write an IP address into an ethernet card and read it back. The good news is that the logic analyzer shows the ip address (10.0.0.180) going out on MOSI and being read back later on MISO. The bad news is that some weird mess is happening that stops it printing properly with printf. On the right below is the logic analyzer data showing MOSI and MISO with the ip address highlighted.  On the left is what gets printed.  It’s not printf that’s messing up though, looking at address a2b7 with the monitor shows the F6F8FAFD it’s printing.  This is some horrible mess between the z80 being little-endian, me being unfamiliar with the SDCC library functions, my layout/soldering of the new pcb, and the tp3465.

 

AHAH: I’ve been looking for something in the software but, of course, the fact that the correct data is on MISO doesn’t mean it makes it in to the CPU.  In a way this is exactly the kind of fault i’ve been looking for.  Maybe something like /RD isn’t making it to the TP3465 chip.

UPDATE: /OE specifically buzzes out ok but I’m still betting it’s something outboard of the CPU.  I’ll figure out how to trap that tomorrow.

OK(or not really but…): I trapped the control signals and the bottom couple of bits of the data bus and exported the data to excel.  The result below shows the expected pattern of writes as above right and, in fact, the data read back is consistent with what the software reports rather than what’s come in on MISO. I see the Z80 writing 00 0F 00  to start a read of the source IP address then it is supposed to send 4 read 10, send 3 read 0, send 2 read 0, send 1 read 180.  I only see the bottom two bits which should be reading 10, 00, 00, and 00 (to fit with 10.0.0.180)but instead i see 10,0,10,1.  I’m willing to bet that if i could see the other 6 bits they’d be consistent with what the software reports: F6,F8,FA, and FD.  So what does it mean? It’s probably down to the TP3465-Z80 interface.  What if I pull the ethernet board and just ground MISO?  Note that the F6,F8,FA, FD are consistent from one run to the next.

16-01-23 read ip

UPDATE: I’m pretty sure it’s a bad connection on MISO.  Resoldering didn’t help but I bet I’ll find something there.

Advertisements

From → Olduino/Z

Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: