I just wondered if anyone out there is aware of any electrical differences between the operation of the SPI on a Mega16 compared to that on Mega168 or Mega128?
I've wired an Atmel AT45DB161B 16Mbit SPI interfaced Dataflash chip to my STK500 and started out writing code on a Mega128 to drive it. Everything worked fine and I could read and write data to my hearts content.
I started with the Mega128 because that just happened to be in the STK500 when someone lent it to me. Later I got samples of the Mega168 I intended to use for the final project and just ported the code across to that.
Again the SPI read/write worked just fine.
I then realised I'd need more than 28pin of I/Os so I got samples of both Mega16 and later Mega16L to use as the final device. I ported the code to this and then made the necessary hardware patches (SS, MISO, MOSI and SCK just moved from PB2..PB5 to PB4..PB7 I think).
I then downloaded some data from the PC across the UART link and wrote to the connected Dataflash but when I read it back I don't get the expected bytes. So, leaving the Dataflash chip connected I then switched back to the Mega168 and got it to read out the bytes that the Mega16 just wrote and the data was exactly as expected?!?
So there's a problem with reading from the device using the SPI of the Mega16. As writing worked perfectly it presumably verifies that SS, MOSI and SCK are all working as expected so I suspect there to be some difference in the Mega16's MISO pin behaviour compared to that of Mega128 and Mega168. It's not just a single sample of Mega16 either. I've tried it with several - both examples of Mega16 and the lower voltage Mega16L with the same problems shown.
I am slowly tearing my remaining hair out over this one as it's been a problem since yesterday morning.
I'm looking at SCK and MISO on a deep buffer digital scope and it just seems that the same Dataflash chip, fed the same SCK (period and amplitude) behaves differently into the Mega16 than into the Mega168. It's like the Dataflash chip SO connected to the Mega16's MISO can't drive it hard enough or something?
Is the capacitance/impedance of the SPI signals on the Mega16 different from 168/128 or something?