Firmware configuration files
Firmware in version 1.0 to the great extent allows that the PSU parameters can be set and read using the SCPI commands or TFT touchscreen display as a local console. However, a large number of configuration parameters could be accessed only by using configuration files that could be altered during the compilation time. This article describe the content of the following configuration files:
We would not like to recommend changing any of the parameters defined in the first three of above mentioned files. Instead of that conf_user.h should be used to override existing values with a new one.
Basic firmware parameters are defined in conf.h. That includes definition of SPI peripherals installed on Arduino shield board but also used channel’s types defined with their programmable voltage and current ranges. The over-temperature protection (OTP) default values for the MAIN sensor are also defined here.
The SERIAL_SPEED is the only parameter that is used for serial communication configuration. Default is 9600 baud and it can be changed to any of the following speed: 300, 1200, 2400, 4800, 19200, 38400, 57600, 74880, 115200, 230400 or 250000.
This header file contains most of the parameters that are used for firmware configuration. That also includes the power supply’s identification used in *IDN? query (PSU_SERIAL, MANUFACTURER and FIRMWARE), DAC and ADC parameters, calibration parameters and over-temperature protection (OTP) values.
SCPI parser input buffer length (SCPI_PARSER_INPUT_BUFFER_LENGTH) is by default set to 48 and it can be increased to e.g. up to 255 but please note that will consume twice as much SRAM memory with each increment because two buffers was implemented: one for serial and one for Ethernet communication. That can generate problem during compilation on Arduino Mega in first place because it has only 8 Kb of SRAM.
The following three constants requires additional attention:
- CONF_WAIT_SERIAL – defines does serial communication is required to start firmware execution. It’s disabled by default. Keep in mind that if you enable it then nothing will happened when power is switched on without USB cable connected and a serial console (e.g. Arduino Serial Monitor) is up and running.
- CONF_DEBUG – determines if additional debug messages will be send to the serial console as an assistance in the development process since no real-time debugger is available in Arduino IDE. All debug messages started with ** and some examples are shown on Fig. Error: Reference source not found. This constant that is currently enabled by default could be disabled to decrease compiled sketch size.
- CONF_DEBUG_LATEST – represents additional condition for generating debug messages and it’s usually used as an assistance in debugging code that is recently added when additional reporting is required.
Channel specific information such as pin mapping used for each channel is defined in conf_channel.h. Additionally all possible variations of channel’s capabilities are listed here. Original file contain three voltage ranges (up to 30, 40 and 50 V) and two current ranges (up to 3.12 and 5 A) that has to match capabilities of the post-regulator board for proper operation. If one wants different voltage and current ranges e.g 0 – 25 V or 0 – 2 A it can be done here simply by adding new channel profile following the defined structure.
Together with mentioned voltage and current ranges that are represents with three values (MINimum, DEFault and MAXimum), channel profile contains information about voltage and current STEP change (see [SOURce[<n>]]:VOLTage:STEP and [SOURce[<n>]]:CURRent:STEP), calibration LEVels (see CALibration:VOLTage:LEVel and CALibration:CURRent:LEVel), OVP and OCP parameters.
Finally over-power protection (OPP) profiles are also defined here as a mix of above mentioned voltage and current profiles.
An example how to override channel’s profiles defined in conf.h is added into conf_user.h (change Power boards to r5B9):
#pragma once // Example: redefine channels #undef CHANNELS #define CHANNELS \ CHANNEL(1, CH_BOARD_REVISION_R5B9_PARAMS, CH_PINS_1, CH_PARAMS_40V_5A), \ CHANNEL(2, CH_BOARD_REVISION_R5B9_PARAMS, CH_PINS_2, CH_PARAMS_40V_5A) \
Procedure is simple: parameter that we want to change first needs to be undefined (#undef) when a new definition follows using the #define operator.
Above mentioned change can be checked with *IDN? or APPL? query:
EEZ,PSU 1/50/03-1/30/03 (Simulator),123456789,M1
CH1:50.00 V/3.12 A, 0.00, 0.00
CH1:30.00 V/3.12 A, 0.00, 0.00