Metaboard/2010 activities/6-pin auto-detecting programming

aus Metalab Wiki, dem offenen Zentrum für meta-disziplinäre Magier und technisch-kreative Enthusiasten.
Version vom 27. September 2010, 13:17 Uhr von Chrysn (Diskussion | Beiträge) (plan for programming the sensors)
(Unterschied) ← Nächstältere Version | Aktuelle Version (Unterschied) | Nächstjüngere Version → (Unterschied)
Zur Navigation springenZur Suche springen

For programming the sensor boards, we want to be able to program them from the master board, with these goals in decreasing priority:

  • simple sensor design (no components at all)
  • safe operation (especially against the sensors being inserted in the wrong direction) without prior notification
  • minimal pin usage
  • simple master board design

For programming, 6 pins are needed:

  • power (3.3V)
  • ground
  • MISO (response from the sensor board)
  • MOSI (commands to the sensor board)
  • SCK (clock of the MISO/MOSI lines, driven by the master)
  • slave select (could be pulled to ground on the sensor board, but then it has to be made sure that sensors are only connected if no other slave on the SPI is active)

To prevent external pins from being pulled (too) high when inactive, MISO, MOSI and SCK get 1kΩ resistors on the master board. Slave select and power will both be driven from general purpose IO pins. (Don't remember where I read that powering an AVR from another AVR's GPIO pin works, but it does.)

The pinout chosen for the plug is

left (PIN6) right (PIN1)
base RESET POWER MOSI MISO SCK GND
regular RESET POWER MOSI MISO SCK GND
flipped GND SCK MISO MOSI POWER RESET

When idling, RESET is actively pulled low, and POWER is configured as input with the builtin pullup resistor. Thus, connecting a sensor regularly or flipped pulls POWER down and a device is recognized.

After the presence of a plug is detected, it can be determined whether the direction is ok. A simple implementation works by configuring POWER as an output and driving it high, then reading on RESET, but this could create problems if POWER just got short-circuited to ground; an enhanced solution that includes using MISO / MOSI SCK is being worked on. (Those pins can be used freely for a short time, in which the other slaves on the bus are disabled.)