Thursday, 22 November 2018

Salvaging electronic parts - Part 3 BenQ GL2430 Monitor

Summary
This blog continues a series of salvaging electronic parts, this time focusing on a BenQ model GL2430 monitor and what components could be salvaged. 


GL2430-B  BenQ Monitor
GL2430-B  BenQ Monitor
The monitor build date was from early 2011.


GL2430 Name Plate
GL2430 Name Plate

Salvaging
The dismantling process for the monitor was skipped. The two major and two smaller printed circuit boards (PCB) removed from the monitor were: Flat panel driver board, Power supply board, Backlight driver board and Audio breakout board.

Flat panel driver board
Shown below is the flat panel driver board, single sided multilayer circuit board. This board contains the Realtek flat panel driver IC boxed in blue. Realtek part RTD2483RD. 


GL2430 Flat Panel Driver Board Top Side
GL2430 Flat Panel Driver Board Top Side
Boxed in red of the image are a mixture of five serial memory devices ranging from ST Micro 24C02 EEPROM to a Winbond 2Mbit Flash W25X20. These devices are usually very easy to salvage.

Boxed in yellow are some of the numerous inductors on the board.

The semiconductor in the top right hand corner of the image is a Diodes Inc PAM8603 - 3W stereo class D amplifier. Possibly not worth salvaging as there are parts available with lower distortion ratings.

In the bottom left hand corner of the board are a pair of TVS arrays from the manufacturer InPaq 1045QU. Again probably not worth salvaging.

The crystal on the board is common video 14.318MHz type and could be repurposed if any crystal frequency is suitable.

Remaining on the board are a mixture of connectors, passives and unidentified semiconductors. If you were really scratching to find a MELF diode or 220uF Lelon Electrolytic then this board could be added to the spare parts box.

Power supply driver board
The power supply board is populated with components on both sides, double sided with a single layer PCB design. Heavy through hole components on the top side of the PCB and smattering of glued surface mount components on the solder side.


GL2430 Power Supply Board Top Side
GL2430 Power Supply Board Top Side
Boxed in red is the mains common mode choke and towards the centre of the board, the switching transformer. Both these devices are manufactured by a Taiwanese transformer manufacturer. These parts can come in handy for research and design projects and a worth salvaging.

The green boxes highlight a few resistors which could be extracted for the spares bin. There are no signs of overheating or other physical damage which may have been caused by a fault on the PCB.

In the blue boxes are the diodes and bridge rectifiers. The bridge rectifier is listed as an obsolete part on supplier's websites such as Mouser so may be good for the spare parts box. The two larger axial diodes are Vishay part UG4B; a reputable brand worth salvaging once properly tested.

The two devices on heatsinks are the mains side switching MOSFET K4101 and secondary side dual rectifier diode FMX12S. At least one of these devices has discolouration in the PCB surrounding the heatsink. Heatsinks could be salvaged for other purposes.

Remaining on the top side of the board are various connectors, mains voltage rated varistors and mixture of capacitors. Usually components which have been operating at mains voltages for an unknown amount of time can left on the PCB if the operational state of these parts is unknown.


GL2430 Power Supply Board Bottom Side
GL2430 Power Supply Board Bottom Side
Shown above is the solder side of the power supply board. To the left of the image is the switch mode controller. Across the board are a number of other parts, all glued down with epoxy. Using epoxy to glue surface mount components in order to simplify the assembly process is standard practice. The epoxy can make repair and salvaging parts difficult.

Backlight driver board
Below is an image of the backlight driver board. The main LED driver, boxed in red, is an MP3389 from Monolithic Power. Device is worth salvaging or even the entire board itself as it is a self-contained unit which could easily be reused.


GL2430 Backlight Board Top Side
GL2430 Backlight Board Top Side
Boxed in blue is an unbranded inductor which is always good to have in the spares box.

Shown in the yellow box is a SinoPower MOSFET APM1110 which was not located on the company website. Specifications are nothing to be excited over although part would be worth salvaging for prototyping.

The remaining passives such as the radial capacitors are from Lelon making the remainder of the board a contender for the spares box.

Audio Connector board
Lastly is the small 3.5mm audio connector board. The connectors are a standard pinout and could be salvaged or the entire board repurposed for a bespoke project.


GL2430 Audio Connector Board Top Side
GL2430 Audio Connector Board Top Side

Design Notes
A section of the power supply mains input section was chosen for some brief notes on PCB design.


GL2430 Power Supply Board Main Input Section
GL2430 Power Supply Board Main Input Section
Boxed in white, top left hand corner of the above image, is the one of the mounting holes with exposed long pads coated in solder. This is a good feature for eliminating star or copper washers however the electrical resistivity can suffer due to the smaller contact area and surface oxidisation of the solder. It should be noted that on the component side of the board is a through hole nut allowing direct access to the mains earth connection.

In the orange boxes are several slots on the board to improve the creep distance between component pins. Slots in the board are an effective and cheaper solution to conformal coating.

Shown in the blue box is attention to detail by the PCB designer. A small pullback was applied to the copper surrounding the two mounting holes for the IEC mains connector.

Boxed in purple is a section of silk screen showing the isolation plane between mains AC and isolated DC voltages. The silk screen for the isolation plane and most components is present on both sides of the PCB making component identification and servicing easier.

Lastly the red box shows three cascaded surface mount resistors used in series to discharge the mains input capacitor connected between active and neutral. The PCB designer was mindful of creep distance and to some degree spacing between these components.

Saturday, 13 October 2018

Rigol DP832 Output Capacitor Limitations

Summary
This blog details a hindrance with the Rigol DP832 power supply outputs when used for purposes such as characterising digital inputs, circuit reaction times or external power supply transient performance to name handful.


Rigol DP832
Rigol DP832

DP832 'Gotcha'
The Rigol DP832 is a good mid-range power supply sporting an easy to use interface to suit the hobbyist and options such as remote communications and power cycling to cater for some professional applications. For engineers familiar with power supply interruption testing, as defined in EN61496-1, the Rigol DP832 can be setup, with some fiddling, to assist with compliance tests.

It was the power cycling feature on the DP832 that was to be used for testing the PLC input design, however after the first few power cycles some unexpected measurements were observed. The configurable PLC input section circuit is shown below.


PLC Input Section
PLC Input Section

The power On captures shown below illustrate the difference between using the Rigol On/Off power button and the second capture shown the response using an external switch with the Rigol power button set to On.


Power ON Delay using Rigol Power Button
Power ON Delay using Rigol Power Button

Power ON Delay using External Switch - Rigol Power ON
Power ON Delay using External Switch - Rigol Power ON

The delay in powering the circuit Off was also easily visible on the scope.



Power OFF Delay using Rigol Power Button
Power OFF Delay using Rigol Power Button

Power OFF Delay using External Switch - Rigol Power ON
Power OFF Delay using External Switch - Rigol Power ON

Output Capacitance
Looking at the captures from the scope this appeared to be output capacitance. I recalled that Dave Jones from EEVBlog had torn down the DP832 several years ago; the output capacitors where found in EEVBlog #511; credit and many thanks to Dave Jones saving me the teardown.

The output capacitors appeared to be 1000uF electrolytics, which would explain the delayed switching performance.


EEVBlog #511 DP832 Output Capacitors - 2 Channels
EEVBlog #511 DP832 Output Capacitors - 2 Channels

EEVBlog #511 DP832 Output Capacitors - 1 Channel
EEVBlog #511 DP832 Output Capacitors - 1 Channel

Output Solution
As a temporary solution to testing, a relay was added. Channel one performed the relay coil switching and Channel two was left powered with the output connected to a Normally Open relay contact. The switching response was did not have the effect of the capacitor charge time although some relay contact bounce was evident.

Saturday, 6 October 2018

Asus X202E Restoring Windows 8.1

Summary
This blog details the rather simple restoration process of Windows 8.1 on an Asus X202E which previously had Lubuntu installed. The motive was rather benign; a terminal application capable of supporting 921600 baud with a logging capability, such as RealTerm or TeraTermwas required.

The Asus X202E was factory shipped with the Windows keys in the netbook 'hardware' meaning Windows 8.1 could be restored under the provision that the installation media could be downloaded.

Downloading Windows 8.1
Before proceeding down the rabbit hole that is Windows, a search for the Windows installation media was made. To my amazement the ISO was available from Microsoft - https://www.microsoft.com/en-au/software-download/windows8ISO

Installation Media
To create the installation (USB) drive Rufus 3.3 was used. Rufus, by Pete Batard / Akeo, is one of the 'go to' applications for boot drive creation under Windows.


Rufus 3.3 - Windows 8.1 Boot Drive Creation
Rufus 3.3 - Windows 8.1 Boot Drive Creation
The capture above shows the default settings used to copy the Windows 8.1 ISO onto a 16 Gb bootable thumb drive.


Rufus 3.3 - Overwrite Thumb Drive
Rufus 3.3 - Overwrite Thumb Drive
After confirming the drive can be overwritten the process was run until completion.

Asus X202E BIOS
With the Windows USB boot drive installed in the Asus X202E and the power off, the BIOS was activated. For this model X202E, the F2 key was held then the power button pressed. The F2 key was only released when the BIOS was displayed. See the Asus website FAQ for further details.

In the Boot menu the USB drive was selected.


Asus X202E - USB Boot Option
Asus X202E - USB Boot Option
The change to the boot was then saved and the Asus allowed to restart.

Standard Windows Installation
Subsequent to the Windows USB drive starting the usual installation process is followed.
Asus X202E - Windows Installation Splash
Asus X202E - Windows Installation Splash
The standard Windows agreement screen and setup options.

Asus X202E - Windows Agreement
Asus X202E - Windows Agreement
Followed by the Windows installation screen.


Asus X202E - Installation Screen
Asus X202E - Installation Screen
After the Asus restarted the Windows setup completed without any issue.

Thursday, 6 September 2018

Surface Pro (2018) for Embedded Software Development

Summary
This blog examines the feasibility of using the Surface Pro 2018 'Surface' as an alternative to a Windows based laptop or desktop machine for the purpose of embedded software development.

Consideration was given to targeted metrics which consisted of physical handling, connectivity, storage speed and keyboard solutions. For a performance comparison, two common software packages were used to compile example projects on the Surface and a reference Asus laptop. Metrics dependent on factors which were difficult to verify, such as battery life, were not examined.


Surface Pro i5
Surface Pro i5
Testing was performed on a Surface Pro i5 over the duration four weeks, with the default Windows 10 Professional installation.


Surface Pro Hardware
Surface Pro Hardware

The Surface Pro i5 uses the Intel 7300U processor and was loaded with 8GB of RAM running Windows 10 Professional.


Surface Pro Windows Version
Surface Pro Windows Version

Handling and Portability
As a desktop replacement, without the addition of a keyboard such as the Surface Type, the Surface Pro 'Surface' is a befitting of the name space saver. Notably for small benches or work spaces the footprint of the Surface is very appealing which makes shifting or repositioning the Surface comparably easy moving from a laptop.

Off the bench in general use, the low weight of the Surface results in relative ease of movement. The kickstand was adjusted in the same manner a laptop display would be moved to cater for varying locations or seated positions.


Bluetooth
During point and select operation during code changes, use the Surface Pen was used without any issue. Other Bluetooth devices in the same proximity to the Surface did not cause any interference. 

Wireless
The wireless maintained connection whether at short distances (1m) or longer distances (30m) from a wireless router (BiPac). Only one dropout was noted during the test period.

Wi-Fi Bandwidth testing was performed using a local server, albeit slow. The Surface and Asus devices were both loaded with IPerf 3.1.3, then several tests conducted. Tests were conducted using the bidirectional configuration in IPerf.

SO_SNDBUF is 212992
[  4] local x.x.x.x port 56795 connected to y.y.y.y port 5201
[ ID] Interval           Transfer     Bandwidth
[  4]   0.00-1.00   sec  18.8 MBytes   157 Mbits/sec
[  4]   1.00-2.00   sec  15.8 MBytes   132 Mbits/sec
[  4]   2.00-3.00   sec  12.8 MBytes   107 Mbits/sec
[  4]   3.00-4.00   sec  11.5 MBytes  96.2 Mbits/sec
[  4]   4.00-5.00   sec  10.8 MBytes  90.4 Mbits/sec
[  4]   5.00-6.00   sec  10.0 MBytes  83.7 Mbits/sec
[  4]   6.00-7.00   sec  11.6 MBytes  97.6 Mbits/sec
[  4]   7.00-8.00   sec  11.0 MBytes  92.3 Mbits/sec

[  4]   8.00-9.00   sec  10.8 MBytes  90.1 Mbits/sec

Shown below are the results of the bandwidth tests conducted.


Surface Pro vs Asus Wi-Fi Bandwidth Results
Surface Pro vs Asus Wi-Fi Bandwidth Results
USB
The Surface's single port USB connection could certainly be considered a limitation for a embedded software or hardware developer who may need two or more USB ports.

During development the single Surface USB port was connected to a USB hub which facilitated a mouse, keyboard and programming adaptor. In some instances a serial adaptor was required. There were no issues relating to the download of drivers, operation of the USB or the performance of the adaptors.


Storage
For copying medium sized (>500Mb) files between computers either, an SD card or USB drive was used. With a meagre 128 Gb internal SSD, the removable SD card was used to store working files and backups.

The USB port was usually broken out to a hub, consequently little commentary on use with insertion of various USB equipment.

Inserting and removing the SD card from the Surface was seamless. The location of the SD slot behind the kickstand resonated with me for typical operation. 

For comparison of copy speeds for the SD card, an Asus i7-77HQ provided results as a reference device.

SD Speed
SD Card testing was performed with a Strontium Nitro 433X Class 10 16 Gb SD using the test software H2testw 1.4. This package was selected because it was capable of testing SD and USB.


Strontium Nitro 433X
Strontium Nitro 433X
Several tests were conducted using the Strontium Nitro on the Surface and Asus with the results displayed below.


Surface Pro vs Asus SD Card Read Speeds
Surface Pro vs Asus SD Card Read Speeds


Surface Pro vs Asus SD Card Write Speeds
Surface Pro vs Asus SD Card Write Speeds
USB Speed
Speed testing was performed with a Silicon Power USB 3 32GB drive using the same test software, H2testw 1.4, that was used with the SD card.


Silicon Power USB 3 Drive
Silicon Power USB 3 Drive
Again several tests were conducted using the Silicon Power USB on the Surface and Asus with the results displayed below.


Surface Pro vs Asus USB Drive Read Speeds
Surface Pro vs Asus USB Drive Read Speeds
Surface Pro vs Asus USB Drive Write Speeds
Surface Pro vs Asus USB Drive Write Speeds
Software Compile Times
The first application used for comparing software compile times was the 'Maker' popular Arduino, version 1.8.6.

Arduino
Three example projects were built on the Surface and an Asus laptop. Timing of the compile process was performed manually therefore some tolerance in timing shall be noted.


Surface Pro vs Asus Arduino Project Compile Times
Surface Pro vs Asus Arduino Project Compile Times
PSoC Creator
Again three example projects provided by Cypress were built on the Surface and an Asus laptop using PSoC Creator 4.2 'IDE'. Timing of the compile process was taken from the start and end times noted in the IDE output window.


Surface Pro vs Asus PSoC Creator Project Compile Times
Surface Pro vs Asus PSoC Creator Project Compile Times
Code Editing
Editing code with an application such as PSoC Creator, utilising the on-screen Surface keyboard was more cumbersome compared to a standard mechanical keyboard. One of the primary reasons was the standard Surface keyboard on-screen layout results in additional key presses to realise straightforward characters. For instance, at worst case, curly, round or square brackets would require three button presses.
A further reason for using a Surface Keyboard or a similar external keyboard solution was the on-screen keyboard does not display when text areas are clicked for editing. The on-screen keyboard had to be invoked manually.


Silicon Labs PSoC Creator Project on Surface Pro
Silicon Labs PSoC Creator Project on Surface Pro
On-Screen Keyboard
There were some initial complications with phantom presses. Applying the Microsoft HotFix for Surface Pro 4 resolved this issue.

Using the Surface Pro in landscape mode was personally the preferred option when writing code because the rear stand was used in the lowest position. Typing with the Surface flat on the desk was achievable although did not suit my office layout. The above image shows typically the ratio of code to keyboard that was used while developing the Silicon Labs blog.

Surface Pen
For specific editing tasks such as selection of text, repositioning selected text or moving on-screen objects the Surface Pen is a handy tool however, a standard external mouse will achieve the same result. People using the Surface Pen for more advanced tasks may have different feedback on its suitability.

Microsoft Surface Cover (Keyboard)
As a keyboard solution, the Surface Cover was more than reasonable with the depth of keystrokes sufficient to provide tactile feedback. The backlight keys on the Surface Cover were handy when typing whilst in low lighting conditions.


Surface Pro with Surface Cover
Surface Pro with Surface Cover
Final Thoughts
For embedded software development the Surface Pro is a worthy competitor to devices with similar specifications and features already in the market. 

In this setting, pro's for the Surface were the lightweight, fan less design, ease in handling and a solid Wi-Fi performance.

Unsurprisingly con's for the Surface related to limited connectivity resulting from the single USB port, throttled processor performance and initial phantom touch screen issues. The latter touch issue being the most obstructive as this phenomenon prevented device useability to the point of preventing logging onto the Operating System.

In a nutshell choosing the most suitable device ultimately depends on the requirements of the end user. Certainly for embedded software development other devices such as the middle to high end Lenovo Yoga, Dell Inspiron 13 or the HP Spectre may be a more suitable solution.


Thursday, 16 August 2018

Silicon Labs SI8380S example design

Summary
This blog details the design and testing of a circuit board 'PCB' for the Silicon Labs SI8380S Digital Isolator PLC input device. The circuit board was designed to use the Arduino compatible pin layout with the code developed for the Cypress CY8CKIT-042 development board using PSoC Creator.

Silicon Labs Digital Isolator
In a previous blog, the approach of implementing PLC inputs using discrete components was reviewed for Single Board Computer such as the Raspberry Pi and Beagle. The use of the Silicon Labs eight input digital isolator could be considered a progression on the discrete solution. Some benefits in using the digital isolator pertain to component count reduction, localised solution, and the option of using a serial interface (SPI).

Schematic Design
Silicon Labs provide a basic application schematic in Application Note 970 which serves as a starting point for the design.


Silicon Labs Example Application Schematic
Silicon Labs Example Application Schematic
The Silicon Labs device datasheet and the aforementioned application note also detail resistor values for achieving the necessary IEC PLC Input Types from 1 to 3.


Silicon Labs Suggested Resistor Values
Silicon Labs Suggested Resistor Values
Even though there is little mention of input protection for the design, additional parts were included on the Arduino compatible board for the purposes of testing.


Silicon Labs Alternative PLC Input Section
Silicon Labs Alternative PLC Input Section
The schematic displayed above was designed for testing five possible input circuit configurations. Some parts in the schematic are superfluous because of the technology used inside the Silicon Labs device. This is explained later in the blog.

1. Diodes - D1, D2, D3 not fitted. D2 replaced with a zero ohm link. This design is representative of the Silicon Labs design.

2. Diodes - D1, D3 not fitted. Using a single forward biased diode would commonly provide reverse polarity protection for a PLC input circuit. When a diode is used on the test PCB, the bipolar input behaves as a unipolar input in a sinking configuration. No overvoltage protection would be provided to the input of the Silicon Labs device.

3. Diode - D2 not fitted. Using the series Zener reduces the power dissipation in the resistors and provides overvoltage protection for the input of the Silicon Labs device. The inclusion of the series Zener also changes the turn ON and OFF characteristics of the circuit.

4. Diodes - D1, D2 not fitted. D2 replaced with a zero ohm link. The design provides overvoltage protection for the input of the Silicon Labs device and retains the turn ON and OFF characteristics of the circuit.

5. Diode - D1 not fitted. The design provides overvoltage with the Zener and would commonly provide reverse polarity protection. The series Schottky diode would only result in a slight deviation in turn ON and OFF characteristics of the circuit because the low forward drop of a Schottky.

Capacitor C3 was added for signal conditioning.


Arduino Pin Compatible Silicon Labs Adaptor Design
Arduino Pin Compatible Silicon Labs Adaptor Design
PCB Design
The board layout and connector placement was borrowed from an Arduino Uno board and verified against the Cypress CY8CKIT-042 development board.


Arduino Pin Compatible 8 Input Silicon Labs Prototype PCB
Arduino Pin Compatible 8 Input Silicon Labs Prototype PCB
Some prior checking using a Cypress Creator project was required to ensure that the pins chosen for SPI communications would be compatible with the Cypress SPI component and the development board.

PCB Population
Only relevant components and a single input channel were populated for initial testing of the PLC prototype PCB. The image below shows the unpopulated prototype.


Prototype PCB for Silicon Labs SI8380S
Prototype PCB for Silicon Labs SI8380S
Obligatory test points were soldered to the board to observe the data exchange on SPI with the Silicon Labs device. 

Cypress Development Board
A connection for a UART was added on the Cypress development board. A connection was made between the on-board PSoC4 and PSoC5 (Kitprog) devices to provide debug information during code development.

Arduino Pin Compatible 8 Input Silicon Labs Constructed Prototype
Silicon Labs Prototype Input Circuit 1
For the following tests conducted, a series of measurements were taken with tabulated data detailed after the last test.

Testing Input Circuit 1
As shown in the above capture only resistors R1 and R2 were fitted to the prototype, with input diode D2 replaced with a zero ohm link.

Turn on 7.7VDC and Turn off 7.1VDC

Testing Input Circuit 2
As shown in the capture below, diode D2 and resistors R1 and R2 were fitted to the prototype.

Turn on 7.9VDC and Turn off 7.3VDC


Silicon Labs Prototype Input Circuit
Silicon Labs Prototype Input Circuit 2
Testing Input Circuit 3
As shown in the next capture below, diodes D1, D2 and resistors R1, R2 were fitted to the prototype.

Turn on 12.8VDC and Turn off 12.2VDC


Silicon Labs Prototype Input Circuit
Silicon Labs Prototype Input Circuit 3
Testing Input Circuit 4
As shown in the next capture below, diode D3 and resistors R1, R2 were fitted to the prototype. Diodes D1 and D2 were not fitted and D2 was replaced with a zero ohm link.

Turn on 7.7VDC and Turn off 7.1VDC


Silicon Labs Prototype Input Circuit
Silicon Labs Prototype Input Circuit 4
Testing Input Circuit 5
As shown in the last capture below, diodes D2, D3 and resistors R1, R2 were fitted to the prototype. Diode D1 was not fitted.

Turn on 7.9VDC and Turn off 7.3VDC


Silicon Labs Prototype Input Circuit
Silicon Labs Prototype Input Circuit 5


Input Circuit Initial Measurement Data
Input Circuit Initial Measurement Data
As expected only input circuit 3, with the series Zener D1 on the input, was significantly different. One item to note is the reduction in total resistor power dissipation due to the addition of the Zener.

The diodes used for testing were manufactured by Diodes Incorporated. The Zener diodes being part BZT52C5V1 and the Schottky diode part SBR1A40S3. All resistors were from ROHM in a 1206 case, rated at 500mW.

Modified Input Circuit 3
The range of Silicon Labs PLC input devices are compliant to the IEC_61131-2:2003 standard. To modify the input circuit 3 with the Zener diode the turn On voltage was reduced. The IEC_61131-2 standard for a Type 3 input specifies 11V to 30V for a 'Signal 1' or logic high.


Silicon Labs Prototype Input Circuit
Silicon Labs Prototype Input Circuit 3 - Modified
Resistor R2 was reduced from 2k7 to 1k8 by placing a 5k62 resistor in parallel, as shown in the capture above. The same series of measurements were performed with the modified input circuit. Tabulated data with the modified input, 3 Mod, is shown below.


Input Circuit Measurement Data
Input Circuit Measurement Data
Using the 1k8 resistor was not ideal because the measured voltage for Turn On is close to the 11V required by the IEC standard. Changing R1 and R2 may provide a better result with respect to the requirements of the IEC standard.

PSoC SPI 
A PSoC Creator project was used to read data from the SI8380S using either SCB or UDB components. The default project settings could possibly be modified for faster performance of the SPI. System clock for example could be increase from 24MHz to the maximum 48MHz. 

For an example, a signal generator set at 10 kHz with a DC offset was used to drive the SI8380S. The green trace in the capture below shows the output of the signal generator. The yellow trace is an output pin on the PSoC which is driven in response to the SI830S data.


Silicon Labs SI8380S PSoC Signals - Turn ON Delay
Silicon Labs SI8380S PSoC Signals - Turn ON Delay

The listing below shows the code used for initial testing.



/*******************************************************************************
* File Name: main.c
*
* Version: 1.0
*
* Description:
* This example project demonstrates the use of the Silicon Labs SI8380S
* https://www.silabs.com/documents/public/data-sheets/Si838x-DataSheet.pdf
*
* Hardware Connections
* MOSI  P0.4
* MISO  P0.5
* SCK   P0.6
* SS    P0.7
*
*******************************************************************************/
#include <main.h>
#include <stdbool.h>

/* Defines for SI8380S registers */
#define SI8380_CHAN_STATUS      0x0             /* Status of the eight PLC inputs */          
#define SI8380_DBNC_MODE0       0x1             /* Mode control bits for the first four channel debounce filters */
#define SI8380_DBNC_MODE1       0x2             /* Mode control bits for the second four channel debounce filters */
#define SI8303_DBNC_DLY0        0x3             /* Delay control bits for the first four channel debounce filters */
#define SI8380_DBNC_DLY1        0x4             /* Delay control bits for the second four channel debounce filters */

/* Define bits used in control bytes */
#define DELAY_0MS               0x00
#define DELAY_10MS              0x01
#define DELAY_30MS              0x10
#define DELAY_100MS             0x11
#define DBNC_NO_FILTER          0x00
#define DBNC_LP_FILTER          0x01
#define DBNC_LEADEDGE_FILTER    0x10
#define SI8380S_BRCT            0x80            /* Broadcast = 1, Address a device = 0 */
#define SI8380S_RW              0x40            /* Read = 1, Write = 0 */

/* Define UDB or SCB */
#define SCB_BLOCK_USED                        /* 0.24 Mbps with x 10 sampling */
//#define UDB_SPI_BLOCK                           /* 6 Mbps max */
#define debug                                 /* Transmit only to terminal at 115200, 8, N, 1 */

/* SPI registers */
uint8 SI8380S_Control;
uint8 SI8380S_Address;
uint8 SI8380S_R_Data;
uint8 SI8380S_W_Data;


/* Function prototypes */
uint8 SI8380S_Read(uint8 spi_r_control, uint8 spi_r_address);
void SI8380S_Write(uint8 spi_w_control, uint8 spi_w_address, uint8 spi_w_data);


/*******************************************************************************
* Function Name: SI8380S_Read
*******************************************************************************/
uint8 SI8380S_Read(uint8 spi_r_control, uint8 spi_r_address)
{
    uint8 data_temp_buf;

    #ifdef SCB_BLOCK_USED
        SPIM_SpiUartWriteTxData(spi_r_control);
        SPIM_SpiUartWriteTxData(spi_r_address);
        SPIM_SpiUartWriteTxData(0x00);   
        // init task timeout
        while (SPIM_SpiUartGetRxBufferSize() == 0);                 /* Has any data been received */
        // reset task timeout
        data_temp_buf = SPIM_SpiUartReadRxData();
    #endif

    #ifdef UDB_SPI_BLOCK
        SPIM_WriteTxData(spi_r_control);
        // init task timeout
        while (!(SPIM_ReadTxStatus() & SPIM_STS_BYTE_COMPLETE));    /* Wait until byte complete to reassert Slave Select */
        // reset task timeout
        // init task timeout
        SPIM_WriteTxData(spi_r_address);
        while (!(SPIM_ReadTxStatus() & SPIM_STS_BYTE_COMPLETE));    /* Only continuous mode for a UDB component  */
        // reset task timeout
        // init task timeout
        SPIM_WriteTxData(0x00);
        while (!(SPIM_ReadTxStatus() & SPIM_STS_BYTE_COMPLETE));    /* SCB component may be more suitable */       
        // reset task timeout
        // init task timeout
        while (SPIM_GetRxBufferSize() == 0);                        /* Has any data been received */
        // reset task timeout
        data_temp_buf = SPIM_ReadRxData();   
    #endif

    return data_temp_buf;
}

/*******************************************************************************
* Function Name: SI8380S_Write
*******************************************************************************/
void SI8380S_Write(uint8 spi_w_control, uint8 spi_w_address, uint8 spi_w_data)
{
    #ifdef SCB_BLOCK_USED
        SPIM_SpiUartWriteTxData(spi_w_control);
        SPIM_SpiUartWriteTxData(spi_w_address);
        SPIM_SpiUartWriteTxData(spi_w_data);
        // init task timeout
        while (SPIM_SpiUartGetRxBufferSize() == 0);                 /* Has any data been received */
        // reset task timeout
    #endif

    #ifdef UDB_SPI_BLOCK
        // init task timeout
        SPIM_WriteTxData(spi_w_control);
        while (!(SPIM_ReadTxStatus() & SPIM_STS_BYTE_COMPLETE));
        // reset task timeout
        // init task timeout
        SPIM_WriteTxData(spi_w_address);
        while (!(SPIM_ReadTxStatus() & SPIM_STS_BYTE_COMPLETE));
        // reset task timeout
        // init task timeout
        SPIM_WriteTxData(spi_w_data);
        while (!(SPIM_ReadTxStatus() & SPIM_STS_BYTE_COMPLETE));
        // reset task timeout
    #endif
}

/*******************************************************************************
* Function Name: main
*******************************************************************************/
int main()
{
    /* Start components */
    spim_sck_Write(false);
    CyDelay(1);
    Spim_sck_Write(true);                                              /* Resync the SI8380 state machine */
    SPIM_Start();
    UART_Start();
    CyGlobalIntEnable;
    UART_PutString("Start\r\n");
    uint8 channel_data, channel_data_old = 0;
    for(;;)
    {
        channel_data = SI8380S_Read(SI8380S_RW, SI8380_CHAN_STATUS);    /* Update data */
        #ifdef debug
         if (channel_data != channel_data_old)
         {
            UART_PutChar(channel_data);      /* Read data continuously */
            CyDelay(250);
            channel_data = channel_data_old;
         }
        #endif
    }
}
/* [] END OF FILE */


Completed PCB 
The PCB was loaded with a single Schottky diode and the two resistors associated with the divider for each input.


Silicon Labs Prototype - Completed
Silicon Labs Prototype - Completed
Testing was conducted with RealTerm acting as the terminal monitor.


Silicon Labs Prototype - Serial Monitor Output
Silicon Labs Prototype - Serial Monitor Output
Each input was turned ON in sequence to prove operation.

Excessive Input Voltages
As a final destructive test the input voltage to the board was increased from 24V DC in 2V steps until system failure. All PLC inputs were configured as type 2, series diode and resistor divider only.

A Rigol DP832 was used to increase the voltage with voltage measurements performed at the PLC input connector of the prototype board. Results for the measurements are shown below.


Prototype PLC: Input Voltage vs SI8380S AHx Voltage
Prototype PLC: Input Voltage vs SI8380S AHx Voltage
Graphed results for the above measurements.


Prototype PLC: Graphed Input Voltage vs SI8380S AHx Voltage Results
Prototype PLC: Graphed Input Voltage vs SI8380S AHx Voltage Results
At some voltage above 62V DC the SI8380S ceased SPI communications with the Cypress controller. When the cause of failure could not be determined the SI8380S was replaced and operation was confirmed again at 24V DC. The second device was not provided with more than 60V DC consequently the SI8380S may operate with higher input voltages.

Summary
For a minimal external support component count, the range of Silicon Labs isolated PLC input isolators is an obvious rival to similar devices available in the market.

The limited testing in this blog showed more than acceptable performance with a single Silicon Labs SI8380S over a range of input voltages from 24V to 60V DC with the SPI interface. 

Isolation voltages were not tested or verified in this blog.

Downloads
PLC Input Schematic
PLC Input Schematic
PLC Input Gerbers
PLC Input Gerbers

PSoC Creator 4.2 Silicon Labs Project
PSoC Creator 4.2 Silicon Labs Project