Turn-key PCB assembly services in prototype quantities or low-volume to mid-volume production runs

Few tips for building reliable SPI interface

Many SPI tutorials use common notation of bus design where each device is directly in parallel connected to SCK, MISO, MOSI and CS lines. This normally works without problem, but in general, there can be problems when more than one SPI device is on the bus. DorkbotPDX rises several issues that can occur on poor design. Here are three suggestions for better SPI improvements: Use pullup resistors on all chip select signals. Verify tri-state behavior on MISO: use a tri-state buffer chip if necessary. Protect bus access with SPI.beginTransaction(settings) and SPI.endTransaction(). Pull up resistor helps to prevent response from multiple devices at once. This might come from poor software design when CS pins aren’t initialized properly. Second problem is with MISO pin. In fact some SPI devices doesn’t enter tri-state… Continue reading

Serial peripheral interface in AVR microcontrollers

Serial Peripheral Interface (SPI) is the fastest synchronous communication interface allowing data transfer speeds up to half of the core clock. If AVR microcontroller is clocked at 16MHz then SPI clock may reach 8MHz in master mode. SPI communication interface is standard way to talk to other peripherals around MCU like flash, EEPROM, sensors and even other microcontrollers. Generally speaking, devices communicate over SPI interface using four wires MISO (Master In Slave out), MOSI (Master Out Slave In), SCK (synchronization clock) and SS (Slave Select). Usually, if only one slave device is used SS line is omitted while slave chip select pin is connected to the GND. However, this is a particular case in all other cases SS pin has to be controlled manually in software – this isn’t handled… Continue reading