Serial Data Recorder

Aries

New Member
DSCN4319B.JPG

Several times I have found myself needing to capture the serial output (sertxd) from a Picaxe project, but without the luxury of being able to have a computer permanently connected to it. Also, the time that the output is actually needed could not be determined in advance, so the output could be very large indeed. For example, one system that controlled the lights worked perfectly for years, but suddenly started to switch everything off at unexpected times. It was impossible to predict when it would do it, and so pretty well impossible to diagnose without some output to show what it was doing and when.

This project – the Serial Data Recorder – takes serial output and stores it in a circular buffer on a pair of Microchip 24FC1025-I/P 1024Kbit (128K byte) serial chips, using hserin to receive the data and hspiout to store it. Hardware serial has the advantage of being able to take data at any standard input rate from 300 to 153,600 baud. hspiout does not interfere with hardware serial. Using a circular buffer means that only the last 256K bytes of data are retained before being overwritten.

The unit is based around a Picaxe 28X2, operating normally at 64MHz. The input baud rate is selected using the rotary switch at the top right, which is a 10-position rotary encoder connected to pins B4 to B.7.
Edited (26/10/2022 at 19:30): the rotary decoder is connected directly to the Picaxe, not via ADC.

Each notional data block (of 1024 bytes) starts with a header giving sequence number (0-1023), which enables the program to find the first and last blocks that have been recorded.

Connections are:
(left) standard 3.5mm stereo socket for direct connection to the AXE027 download cable;
(top) 4-pin DIN plug on lead, giving SERIN, SEROUT, GND and 5V from the device being monitored.
If the device cannot offer 5V (or does not have the DIN connection, which I use as standard), then there is also a DC socket (right) for an external 5V supply

There is also a CR2032 coin cell to maintain the voltage on the memory chips when the unit is not connected to power.

Operating modes are OFF, RECORD, RESTART and REPLAY, selected with a 2-pole 4-way slider switch (top centre-left).

In REPLAY mode, the unit finds the start and finish of the recorded data and then sends it out through the 3.5mm socket to the AXE027. Where possible, REPLAY mode sends data at the same rate as it was recorded. However, because of the limitations of the chip, 38400 and 115200 baud are both sent at 76800 baud instead.

In other modes, the 3.5mm socket is connected directly to the corresponding connections on the DIN plug. Therefore, the unit then operates as a direct connection between AXE027 and the Picaxe being monitored.

In OFF mode, nothing else happens.
In RECORD mode, serial input from the DIN connector is recorded on the memory chips, starting afresh.
In RESTART mode, serial input is recorded, carrying on from the end of the last recorded block.

In the event of a power failure, RECORD and RESTART both continue from where recording left off.

The box is 125mm x 40mm. My first version, using matrix board, could only hold one memory chip. This later version uses a custom PCB to fit two chips into the space.
 
Last edited:

Aries

New Member
Gerber files attached. The parts list follows below. There are references for the two "odd" items - rotary encoder and 4P 2W switch.
Note that the rotary encoder and slide switch are mounted on the "wrong" side of the board.
The Picaxe code is also attached.
Board RefTypeValueDescription
BT1CR2032 holder
Battery holder
C1Capacitor Elec Axial 5mm flat220uFSmoothing capacitor
C2Capacitor100nFDecoupling capacitor*
C3Capacitor100nFDecoupling capacitor*
C4Capacitor100nFDecoupling capacitor*
LN1Link
Picaxe V0 link**
D1Diode 5mm
Power isolating diode
D2Diode 5mm
Power failure pullup diode
D3Diode 5mm
Memory isolating diode
D4Diode 5mm
Battery isolating diode
HD1Header 6pin
External connections
HD2Header 4pin
Programming header
R1R 5mm4K7RESET pullup
R2R 5mm10KPower failure pulldown
R3R 5mm330Rhserin Safety
R4R 5mm10KSERIN pulldown
R5R 5mm22KSERIN safety
RA1Resistor Array 8 common10KPicaxe pullup
RA2Resistor Array 4 common10KMemory pullup
SW1Binary encoder
Binary encoder †
SW2Slider switch 2P4W
Slider switch 2P4W ‡
IC1PICAXE28X2PICAXE-28X2
IC2DIL 823LC1024Memory#1
IC3DIL 823LC1024Memory#2
X1Resonator16MHzResonator
*Fitted afterwards, directly across power supply pins
**Recommended to add bridge between the two V0 Picaxe pins


https://cpc.farnell.com/multicomp/mcrh3maf-10r-v-b/switch-rotary-tht-10x10-10-pos/dp/SW05752?CMP=TREML007-005
https://www.ebay.co.uk/itm/183739684497

Gerber files:
GTL: Top Copper
GTO: Top Silkscreen
GTS: Top Copper (Resist)
GTP: Top Copper (Paste)
GBL: Bottom Copper
GBO: Bottom Silkscreen
GBS: Bottom Copper (Resist)
GBP: Bottom Copper (Paste)
TXT: Drill Data - [Through Hole]
 

Attachments

Last edited:
Top