Hi,
i'm using Arduino Mega ADK rev3 board.
I'm interested to know exact SPI pins related to USB Host chip.
Are these all pins, by which two chips ATmega2560 and MAX3421E connected:
.equ SS = PORTH7 ;PH7 as Slave Select out (maybe it is PORTB0?)
.equ SCK = PORTB1 ;PB1 as Clock out
.equ MOSI = PORTB2 ;PB2 as Master Out
.equ MISO = PORTB3 ;PB3 as Master In
.equ MAX_RST = PORTH4 ;PH4 as Reset out
.equ MAX_GPX = PORTJ3 ;PJ3 as GPX in
.equ MAX_INT = PORTJ6 ;PJ6 as INT in
Or not?
Is this correct in respect to my board?
"NB:Please do not use Digital pin 7(RST) as input or output because is used in the comunication with MAX3421E" - what doest it mean? Should i control this pin if i want SPI communication with MAX3421E ?
"Non broken out on headers: PJ3 (GP_MAX), PJ6 (INT_MAX), PH7 (SS). " - what doest it mean? What is the difference between broken_out and non_broken_out ?
Vendor, because it's "Arduino" who is vendor of board i bought. They aren't volunteers coz i paid for this board and thus i may ask for support.
It is special SPI, at least standard /SS pin (PORTB0 - one of hardware SPI pins) is not used in this inter-chip connection.
Instead, as far as i see, board designers for SPI Slave Select function decided to use general PORTH7. But it has no relation with hardware SPI pins MISO, MOSI, SCK (All from PORTB group). Such configuration prohibits automatic start of byte transmit after writing to AVR's SPDR register because it relies on /SS signal on PORTB0.
How to bring up such tricky SPI connection? Should i manipulate PORTH7 by software? When? after writing to SPDR register or just before?
SS is the chip select pin. It is "special" because you need one for every SPI device that shares the same bus, that is why it is not hardwired. As to when to assert it, just check the 3421 docs, specifically figs 10 and 11. But generally, you assert it a few microseconds before the SPI communication and bring it back high a few microseconds after.
So i still have a problem: Can't get SPI to work. And i know, that it works - i checked with Google ADK2011 example (C code). I want to get it done using Assembler. ]
On this PCB are 2 chips connected by SPI - AVR and MAX3421E (USB host controller).
They connected by at least 4 wires, 3 are from ATmega hardware SPI (SCK, MOSI, MISO but not /SS) and /SS pin is connected to general AVR PH7 (real hardware /ss pin is on PB0).
So i need to simulate /SS operation by software. But i found that nevertheless i need to activete PB0 as output because if not - other 3 wires aren't work.
I troubleshoot it in simulator (Atmel Studio 6.1)
And found that can't write to SPDR. Whatever byte i wrote there - it shows only zeroes, and AFAIK transmit didn't start.
Also, manually setting SPIF to 1 is ignored by "sbrs" command - it stay in loop forever.