PonyProg :  PonyProg Phorum PonyProg
PonyProg open discussion 
How it works - the electrical functionality of SI Prog (the serial HW interface for PonyProg)
Posted by: sonix ()
Date: June 01, 2015 08:56PM

Hi all,

because of repetition of the questions regarding to the electrical functionality of PonyProg's hw interface I have decided to create this topic.

Firstly I have to thank to Mr. Lanconelli who has developed this famous PonyProg and the SI Prog hw interface.

I am interested in electronics and programming. My assumption about SI Prog functionality is based on my experiences in mentioned fields. So I will try to explain the functionality as I understand it by myself.

PonyProg uses serial port not for standard data transfer, but only for sending / receiving "signals" to the programmed serial device input / output pins in a time sequence defined according to the device datasheet.

I will use as an example SPI eeprom 25LC640. See attached picture with an example of "read sequence" of this eeprom.

The bus signals required for communication with 25LC640 are:
-clock input (SCK)
-data in (SI)
-data out (SO)

Access to the device is controlled through a Chip Select (CS) input.

If you "send" the right logical levels (e.g. logical 0 = voltage close to 0 Volt and logical 1 = voltage close to 5 Volt for standard TTL logic devices) to pins CS, SCK and SI in defined time sequence as shown on the attached picture you get a response (also a sequence of logical levels) from device on the SO pin containing data read from any valid address of the eeprom.

And now very basic information about using the standard PC's serial port and PonyProg ...
The RS232 communication standard use voltage levels +3V ... +15V for data transmission for logical 0 and voltage levels -3V ... -15V for logical 1. This voltage levels are used ONLY for data transmission lines (Rx and Tx ). The other signals e.g. "handshaking line" CTS (pin 8 at DB9 serial connector) uses standard TTL logic voltage levels 0V and 5V.

Ponyprog's SI Prog HW interface uses Tx and partially DTR and RTS lines for feeding limited power from PC serial port to the serial device which we are trying to communicate with. Data output (from PC to a serial device) is realized through Tx, RTS, DTR lines and as a data input (from a serial device to PC) is used only CTS line.

Every communication is fully controlled by software - PonyProg. There is no standard data flow, so in this case is the original meaning of pin descriptions more or less irrelevant, but the signal direction (input or output) of the pins is important. And there is also no need to set the baudrate, parity and so on, in PonyProg settings because of described non standard data communication.

I hope that this clarifies a little bit the electrical functionality of SI Prog HW interface. This is only a simple explanation what's behind the PonyProg's programming through serial port.

Best regards
sonix

Attachments: Serial_eeprom_25LC640_read_sequence.gif (37.7 KB)  
Options: ReplyQuote
Re: How it works - the electrical functionality of SI Prog (the serial HW interface for PonyProg)
Posted by: ebrahim ()
Date: June 02, 2015 07:30AM

Dear sonix,

May you explain "Data output (from PC to a serial device) is realized through Tx, RTS, DTR lines and as a data input (from a serial device to PC) is used only CTS line." in more details? How SI Prog do read transaction using only CTS line??


tnx

Options: ReplyQuote
Re: How it works - the electrical functionality of SI Prog (the serial HW interface for PonyProg)
Posted by: sonix ()
Date: June 03, 2015 09:06PM

Dear Ebrahim,

I will try to explain it more detailed. As an example device I will use spi eeprom 25LC640 with clock frequency 100kHz (=10us period). I have attached picture showing the time diagram of "read sequence" with highlighted important time events. On it we can see 4 "rows" of input/output lines namely CS (Chip Select), SCK (Serial Clock), SI (Serial Input) and SO (Serial Output). The red lines on the picture's left side are the rising edges of SCK and at this time is in place the "reading" of logical level at pin SI. The green lines show us the time when we must set the logical level for the next bit. The blue lines on the picture's right side are the falling edges of SCK and at this time is in place eeprom internal data reading. The green lines on the right side show us the time at which we can read data at pin SO. It is very important to keep logical levels and time sequence according to the device datasheet. I suggest to you to read the datasheet if you want even more detailed information.

After powering up of the serial device we must put CS line from logical 1 to logical 0. Setting logical 0 on Tx line causes rising voltage to level between +3V and +15V. The NPN transistor Q1 (located on the SI Prog base board) is now opened and CS line is at logical 0. This changes device status from standby mode to normal operation. Then we must prepare input data for serial device to pin SI. The read instruction has the length of one byte (8 bits). Each bit from this instruction (00000011) represents logical level and must be present on pin SI before rising edge of SCK. So the first bit (bit 7) of read instruction is 0, therefore we must set DTR line on PC's serial port to logical 0 and this must be set in 1/4 of SCK time period (2.5us) before the logical level on pin SCK goes high (for the very first bit at SI pin we must wait approximately 1/4 of SCK time period before we set SCK line high). Then we must set RTS line to logical 1 (SCK pin) and start the measuring of the time from the first rising edge of SCK after CS line is at logical 0 ( I will take name "time zero" ). The logical state at SCK and SI must not change within 1/2 of SCK time period (5us) to ensure the correct operation. Next we must set RTS line to logical 0 exactly in 1/2 of SCK time period (5us) after "time zero". After 3/4 of SCK time period (7.5us) we must set the logical level for the next bit at pin SI. 1 SCK time period (10us) after "time zero" we must set RTS line to logical 1 and so on until we "send" all 24 bits (8 bits for instruction and 16 bits for memory address at which we want to read data from eeprom). The clock must continually run until we get at least 1 byte (8 bits) of data at pin SO (CTS line on PC's serial port), else the read operation will fail. In time 23 and 3/4 of CK time period (237.5us) after "time zero" we can read logical level at pin SO for the first bit (bit 7) read from eeprom. Data will be present at pin SO always in time 24 (..25 till 31) and 3/4 of SCK after "time zero". After the last bit (bit 0) of byte was read, we can put CS line from logical 0 to logical 1 so the read sequence is terminated and eeprom is in standby mode.

Precise timing is very important to ensure the correct communication with serial device which you are connected to.


This is a very, very, very simplified example, but it explains how it works.

Yours sincerely
sonix



Edited 1 time(s). Last edit at 06/03/2015 09:10PM by sonix.

Attachments: Serial_eeprom_25LC640_read_sequence_timing_highlight.png (98.5 KB)  
Options: ReplyQuote
Re: How it works - the electrical functionality of SI Prog (the serial HW interface for PonyProg)
Posted by: ebrahim ()
Date: June 05, 2015 12:59PM

Dear sonix

Thank you for very useful explanation.
I implement this circuit and program my 93LC66B EEPROM successfully.

Kind regards.

Options: ReplyQuote