[En-Nut-Discussion] using SPI Controller of AT91SAM7X

Harald Kipp harald.kipp at egnite.de
Thu Mar 11 17:17:45 CET 2010


Dominik Schröder wrote:

> NUTSPINODE OLED_node = {
> 	&spiBus0At91, 				/* Pointer to the bus
> controller driver. */

This one specifies the SPI bus driver that uses the AT91 SPI hardware,
while this one calls the SPI bus driver using GPIO bit banging.

> 	rc = (*spiBus0Gpio.bus_initnode) (&OLED_node);

Did you connect the OLED to the MISO/MOSI/SCK pins for using the
hardware SPI?

Looks like Ulrich's 7-segment display driver is the most simple SPI bus
driver we currently have. It may serve well as a sample. See
nut/dev/spi_7seg.c.

Note, that he passes a pointer to the NUTSPINODE structure to the
send_command routine and gets the bus driver from this structure:

disp7segCommand(NUTSPINODE * node...)
{
...
  NUTSPIBUS *bus = (NUTSPIBUS *) node->node_bus;
...
  (*bus->bus_alloc) (node, 1000);
  (*bus->bus_transfer) (node, cmd, NULL, 2);
  (*bus->bus_release) (node);
...
}

The AT45D dataflash driver nut/dev/spi_at45d.c works in a similar way,
but is somewhat more complicated. It uses an additional block I/O
interface level, which makes it less easy to read and understand.

Harald







More information about the En-Nut-Discussion mailing list