A Simple Serial (I2C/SPI) EEPROM Programmer Posted on 23rd December 2014 Tagged in electronics, tools, tgl6502 This is a small ATtiny84 based device to program I2C and SPI EEPROM chips over a serial port. FlashProg is USB base flash memory programmer to work with 3.3V serial flash memory devices. This programmer is specifically design to read, program and configure 25x series, serial flash memory devices which are commonly used to store BIOS in PC mainboards.
Is your serial eeprom onboard with the target or a separate board which you'll program multiple targets? For the first scenario, your application or bootloader will have to read out the data from the eeprom (SPI slave) and then program the application section with this data. The second scenario needs a microcontroller configured as an SPI master and 2 slaves. It will read data from the serial eeprom (slave 1) then program the target (slave 2) with this data - and of course correctly controlling the RESET pin. The commands to do this are well documented in the datasheets.
To program the mega8 you either need something that is going to 'wiggle the wires' outside the AVR chip (in the case of mega8 the only possible routes are ISP or high voltage parallel programming) or the mega8 needs to do it 'from the inside'. If the program data to be programmed is sitting in an EEPROM then you are either going to need a second microcontroller in the design that reads the data from the EEPROM and then wiggles the wires in the direction of the mega8 or the mega8 will read the EEPROM itself and use special SPM code running in the bootloader section to then self program the data into the application code space in the flash. You'd probably be able to port the code from something like that. If you look closely you'll see a mention there of our very own John Samperi! It´s true, It had to make this design because I can´t find this board before. I had found anothers devices like that, but they are a lot expesives (use SD cards, with LCDs) and to make a programmer is easy. The last year I developped a vending machine based in an Atmel micro.
When I release any update, I must carry my laptop and connect it into a STK200. It isn´t difficult, but is better to use a portable programmer. Thanks Clawson, your brain must be Data Base;). Estepaio, looking at your schematic, you have an ISP header for programming your 'master' AVR but you also need an ISP port for programming the 'slave' AVRs (you can't use the same port because its connected to your 'master's' RESET pin). Add another ISP port but connect pin 5 to a free pin like PD6. This will allow you to control the 'slave' AVR's RESET pin so that you can program it. Look at the attachment.
This is from a mega128 which uses different pins for ISP programming and ISP so the MISO, MOSI names are different but in your application they'll be the same. You should be able to get all functionality in 2k, including uploading new firmware into you eeprom via a PC. Greggallagher wrote: estepaio, looking at your schematic, you have an ISP header for programming your 'master' AVR but you also need an ISP port for programming the 'slave' AVRs (you can't use the same port because its connected to your 'master's' RESET pin). Add another ISP port but connect pin 5 to a free pin like PD6. This will allow you to control the 'slave' AVR's RESET pin so that you can program it. Look at the attachment.
This is from a mega128 which uses different pins for ISP programming and ISP so the MISO, MOSI names are different but in your application they'll be the same. You should be able to get all functionality in 2k, including uploading new firmware into you eeprom via a PC.
Thanks Greg, it´s true. First, I thought to share the ISP header to program the ATtiny2313 and the slave. But the pin 5 is connected to RST and I can´t control this pin.:wink: I hope to use 2K, the code doesn´t seem very difficult to develop.
Quote: I didn´t know it John, I believed the design was your Well when I first started playing with AVRs about 7 years ago I had one of those 4 resistors programmers (1K max code size). Then on a Saturday of a long weekend I broke the 1K barrier and could not program the chip:(,. PANIC. so I rushed over to my Jaycar shop and found an AVR910 kit which I got and put together, later on trying to program newer chips I modified the code.and the rest is history.so most of the work for the programmer was already done by others.but I get some of the limelight:lol: but really I didn't do much.
Communication between electronic devices is like communication between humans. Both sides need to speak the same language. In electronics, these languages are called communication protocols. Luckily for us, there are only a few communication protocols we need to know when building most DIY electronics projects. In this series of articles, we will discuss the basics of the three most common protocols: Serial Peripheral Interface (SPI),. First, we’ll begin with some basic concepts about electronic communication, then explain in detail how SPI works. In the next article, we’ll discuss UART driven communication, and in the third article, we’ll dive into I2C.
SPI, I2C, and UART are quite a bit slower than protocols like USB, ethernet, Bluetooth, and WiFi, but they’re a lot more simple and use less hardware and system resources. SPI, I2C, and UART are ideal for communication between microcontrollers and between microcontrollers and sensors where large amounts of high speed data don’t need to be transferred. Parallel Communication Electronic devices talk to each other by sending bits of data through wires physically connected between devices.
A bit is like a letter in a word, except instead of the 26 letters (in the English alphabet), a bit is binary and can only be a 1 or 0. Bits are transferred from one device to another by quick changes in voltage. In a system operating at 5 V, a 0 bit is communicated as a short pulse of 0 V, and a 1 bit is communicated by a short pulse of 5 V.
The bits of data can be transmitted either in parallel or serial form. In parallel communication, the bits of data are sent all at the same time, each through a separate wire. The following diagram shows the parallel transmission of the letter “C” in binary (01000011): In serial communication, the bits are sent one by one through a single wire.
The following diagram shows the serial transmission of the letter “C” in binary (01000011): Introduction to SPI Communication SPI is a common communication protocol used by many different devices. For example, and all use SPI to communicate with microcontrollers. One unique benefit of SPI is the fact that data can be transferred without interruption. Any number of bits can be sent or received in a continuous stream. With I2C and UART, data is sent in packets, limited to a specific number of bits. Start and stop conditions define the beginning and end of each packet, so the data is interrupted during transmission.
![Spi Serial Flash Programmer Schematic Definition Spi Serial Flash Programmer Schematic Definition](/uploads/1/2/5/4/125413351/199473655.png)
Devices communicating via SPI are in a master-slave relationship. The master is the controlling device (usually a microcontroller), while the slave (usually a sensor, display, or memory chip) takes instruction from the master.
The simplest configuration of SPI is a single master, single slave system, but one master can control more than one slave (more on this below). MOSI (Master Output/Slave Input) – Line for the master to send data to the slave. MISO (Master Input/Slave Output) – Line for the slave to send data to the master. SCLK (Clock) – Line for the clock signal.
SS/CS (Slave Select/Chip Select) – Line for the master to select which slave to send data to.In practice, the number of slaves is limited by the load capacitance of the system, which reduces the ability of the master to accurately switch between voltage levels. How SPI Works The Clock The clock signal synchronizes the output of data bits from the master to the sampling of bits by the slave. One bit of data is transferred in each clock cycle, so the speed of data transfer is determined by the frequency of the clock signal. SPI communication is always initiated by the master since the master configures and generates the clock signal.
Any communication protocol where devices share a clock signal is known as synchronous. SPI is a synchronous communication protocol. There are also asynchronous methods that don’t use a clock signal. For example, in UART communication, both sides are set to a pre-configured baud rate that dictates the speed and timing of data transmission. The clock signal in SPI can be modified using the properties of clock polarity and clock phase. These two properties work together to define when the bits are output and when they are sampled. Clock polarity can be set by the master to allow for bits to be output and sampled on either the rising or falling edge of the clock cycle. Clock phase can be set for output and sampling to occur on either the first edge or second edge of the clock cycle, regardless of whether it is rising or falling.
Slave Select The master can choose which slave it wants to talk to by setting the slave’s CS/SS line to a low voltage level. In the idle, non-transmitting state, the slave select line is kept at a high voltage level. Multiple CS/SS pins may be available on the master, which allows for multiple slaves to be wired in parallel. If only one CS/SS pin is present, multiple slaves can be wired to the master by daisy-chaining.
Multiple Slaves SPI can be set up to operate with a single master and a single slave, and it can be set up with multiple slaves controlled by a single master. There are two ways to connect multiple slaves to the master. If the master has multiple slave select pins, the slaves can be wired in parallel like this: If only one slave select pin is available, the slaves can be daisy-chained like this: MOSI and MISO The master sends data to the slave bit by bit, in serial through the MOSI line. The slave receives the data sent from the master at the MOSI pin. Data sent from the master to the slave is usually sent with the most significant bit first. The slave can also send data back to the master through the MISO line in serial.
The data sent from the slave back to the master is usually sent with the least significant bit first. Steps of SPI Data Transmission 1. The master outputs the clock signal: 2. The master switches the SS/CS pin to a low voltage state, which activates the slave: 3. The master sends the data one bit at a time to the slave along the MOSI line.
The slave reads the bits as they are received: 4. If a response is needed, the slave returns data one bit at a time to the master along the MISO line.