Electronic Load  1.0
Programmable Constant Current Sink
Data Structures | Functions
ftest.h File Reference
Include dependency graph for ftest.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  ftestPortsStruct
 Holds the test declarations for one Port. More...
 

Functions

bool FTest (void)
 Performs a simple Factory Test. More...
 
void FTest485 (void)
 

Function Documentation

◆ FTest()

bool FTest ( void  )

Performs a simple Factory Test.

This routine tries to test everything that can be tested without user intervention. It cannot detect all possible error conditions but will detect a lot of possible short circuits and other errors and can give valuable hints to the test personal.
This is done by performing a "Walking Zero" and a "Walking One" test i.e. all pins are set to 1 (or 0) and a single 0 (or 1) walks through all pins. As long only the currently tested pin is 0, everything is o.k., if another pin goes to 0, you have a short between these two pins. If a pin always stays at a fixed level, you have a short to VCC or GND.
A test mask defines which pins have to be tested. Bits set to 0 will not be touched and not be tested. Bits set to 1 will be programmed as output and tested against all other 1-pins and the supply.
A few rules have to be obeyed for the factory test to work:

  • All special function pins must be set to normal port I/O. Disable all timer outputs, SPIs, USARTS etc. except the interface to the host.
  • Some devices have a DIDR (digital input disable). Do not forget to enable digital inputs.
  • The host interface pins must be set to 0 and cannot be tested. But they are o.k. if the device is able to communicate with the host, anyway.
  • Lines with Chip Select functions should be left as output with Chip Select set to inactive but set to 0 in the test mask. So these pins will not be touched and the chips remain disabled throughout the test and do not interfere with the test sequence.
  • All lines to other chips that are disabled can be set to 1 if the connected chip leaves it tri state when disabled, even if they are input lines normally.

Since interrupts are disabled in the progress of this function and DDRs are modified, the calling routine should perform a watchdog reset to restart the device.
Do not try to restore previous state and continue normal operation, you will most likely forget something and there is nothing bad in willingly performing a reset...

Returns
True if no error detected, False if test fails
Here is the call graph for this function:

◆ FTest485()

void FTest485 ( void  )