Friday, August 12, 2022

Modified Arduino Mega 2560 to enable second SPI channel

BRINGING SCLK SIGNAL FROM SERIAL CHANNEL TO AN EXTERNAL CONNECTOR

The chip on the Arduino has power serial channels called USARTs which do more than the usual asynchronous serial protocols. Atmel provides support in their serial ports for pseudo SPI mode - master mode only, can't work as a slave - and the chip has four USART ports. 

One is connected to the USB link for serial communications as well as programming the board. The other three are accessible for normal serial communications, bringing their Tx and Rx lines to external pins on the board, but the clock pin of those serial ports is not brought out for connection. This limits the use of certain clocked serial modes and more importantly it does not allow the use of the port as an SPI link. 

Those signals are on pads of the Atmel ATMega2560 chip, sitting right there on the board in its TQFP 100 pin format that has the leads around the rim of the chip. If it had been a BGA or similar chip that has the connections underneath it would not have been as easy to gain access to the signal. 

Time to whip out the stereo microscope, rework tools and modify this board to allow the clock signal of one of the USARTs to be connected via one of the external connectors on the board. All the external connector pins are wired to other signal pins on the chip or to other circuits, but not every pin is important for my planned use. 

DISCONNECT TRACE FOR AREF SIGNAL TO FREE UP EXTERNAL PIN

For my sacrificial external pin I chose the AREF signal, used with analog inputs. I don't need it for this project. It is at pin 98 of the chip and runs only to the AREF connector which is on the other side of the ground in next to Arduino pin 13. That will now be my Sclk pin for USART 2.  The lead of the processor was lifted off the pad to disconnect it and I verified lack of connectivity with a VOM.

Pin 98 lifted off pad

TACKING WIRE TO ATMEL PROCESSOR PAD

USART for serial port 2 has the clock pin at position 14 on the chip, which is currently unconnected. A wire tacked onto that lead of the chip is the next step of this modification. 

Pin 14 is XCLK2 - clock for USART 2

I used some 30 gauge wire as it is nice and thin, appropriate to the width of the processor lead to which it is soldered.

Wire tacked onto pin 14

CONNECTING OTHER END OF WIRE TO THE CHOSEN EXTERNAL PIN

The wire was routed through a mounting hole and down to the underside where I connected it to the bottom of the connector block for the AREF pin. This is now a SCLK pin for USART channel 2. 

Routing wire to underside

Soldered to AREF pin of connector

LATE BREAKING NEWS - READY BUILT ALTERNATIVE ON ORDER

I discovered that Seeed Studio produces a variant of the Arduino Mega 2560 which they call the Seeeduino Mega 2560 which among other differences brings out more signals to external pins. Very significantly, it brings the serial port two clock to a connector, the same signal that I had to hack to access with a standard Arduino. Seeeduino Mega description

It is on order and should arrive next week, allowing me to skip the hacks when building more of these. For now I can begin to debug the Arduino to FPGA communications with the hacked board while I wait for the shipment that is already delayed by UPS for 'operational reasons' which I guess is code for 'my bad'. 

No comments:

Post a Comment