A DS SPI/UART Bridge Hardware Project

来源:互联网 发布:java里try catch 编辑:程序博客网 时间:2024/05/17 23:27

 

http://masscat.afraid.org/ninds/spiuart.php

 

A DS SPI/UART Bridge Hardware Project

This hardware projects provides a bridge between the DS's DS card slot SPI bus and a UART, allowing the DS to communicate with anything with a UART interface. The hardware implementation given shows a RS232 line driver allowing the DS to communicate with a PC serial port.

Releases

Zilog Code

  • zilog_project_20060810.tar.bz2

DS driver

  • Serial_20060812.tar.bz2

ToDo List

  • Implement flow control on the UART side.
  • Provide a method to configure the UART settings.
  • Implement a method to stop possiblity of the data flows be turned off and never coming back on

Hardware Implementation

The hardware side is based around a Zilog Z8F0412 microcontroller. It is a nice and easy MCU to program (free tools available from the Zilog website), provides the SPI bus and UART interfaces so requires few additional components and is available in DIP packages so no need to get PCBs made up. The MCU can be flashed and debugged through a PC serial port using some open source tools.

The Zilog is programmed in C and compiles to a .hex file which is flashed to the MCU.

Here is a schematic of the circuit with a RS232 line driver and below is the circuit made up on some stripboard and prototype board.

The circuit built up

The DS Card Connector

You have a number of choices as to how to make a DS slot connector. You can hack a DS game, desoldering all the components on it and soldering some flying leads to connect to each card slot pin (this will destroy the DS game - you have been warned). Have a PCB made up professionally or etch one at home. Or if you cannot bring yourself to kill a DS game and have no etching equipment carve one out of a piece of solid copper PCB. It is not fun but is does work.


Software Driver

The driver provides a function interface to initialise the bridge and read data from and write data to it. The driver can be set to be polled or interrupt driven. When built the bridge driver comes as a library, libserial9.a, and a header file, spi_uart_bridge.h, giving the function interface. These are all that is needed to use the driver.

For the driver interface see the doxygen documentation for the spi_uart_bridge.h file.

Screenshots

Below is a picture of GDB talking to the DS over the serial port (note the target remote /dev/ttyS0 line) and some output that appears on the DS screen whilst this happens.


SPI Bus Protocol

 

 

原创粉丝点击