Skip to content

Commit b9ffe38

Browse files
committed
Merge branch 'develop'
2 parents e06840c + 8ea0a31 commit b9ffe38

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+846
-1624
lines changed

h/_root/generic/os_TaskManager.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,8 @@ typedef enum {
6161
OP_MODE_STANDBY = 0b1000000000000000 // Standby mode, all sub-modules are disabled and CPU is in low-power mode
6262
} SYSTEM_OPERATION_MODE_e;
6363

64+
#define SYSTEM_OPERATION_MODE_MASK 0b1100000000011111
65+
6466
typedef union {
6567
struct {
6668
volatile bool boot:1; // Bit #0: Operation mode during device start-up and system boot configuration

h/apl/resources/debug_uart/smpsDebugUART.h

Lines changed: 14 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,10 @@ extern "C" {
150150
* PROTOCOL STANDARD CID's
151151
* *********************************************************************************/
152152
#define DBGUART_CID_ACKNOWLEDGEMENT 0x0100 // Acknowledge-Bit for handshake CIDs
153+
#define DBGUART_CID_CRC_BYPASS 0x000F // All CIDs less than 15 do get CRC=0
153154

155+
#define DBGUART_CID_STRING_OUTPUT 0x0001 // Standard CID for sending strings to a terminal window (no CRC check)
156+
154157
#define DBGUART_CID_READ_FROM_ADDR 0xE000 // Standard CID for reading from a memory address
155158
#define DBGUART_CID_WRITE_TO_ADDR 0xE001 // Standard CID for writing to a memory address
156159
#define DBGUART_CID_AND_BIT_MASK 0xE002 // Standard CID for AND-ing a bit mask with a value at a memory address
@@ -161,40 +164,7 @@ extern "C" {
161164

162165
#define DBGUART_CID_PROPRIETARY 0x0003 // Return value for
163166

164-
// Index definition for CID 0x0100 (Ascalab GUI)
165-
166-
#define CID0100_RX_VOUT_CH1_INDEX 0
167-
#define CID0100_RX_IOUT_CH1_INDEX 2
168-
#define CID0100_RX_VOUT_CH2_INDEX 4
169-
#define CID0100_RX_IOUT_CH2_INDEX 6
170-
#define CID0100_RX_TEMPERATURE_INDEX 8
171-
#define CID0100_RX_CONFIG_BITS_INDEX 10
172-
173-
174-
// Bit masks
175-
#define CID0100_RX_ON_OFF_CH1_BIT (1<<0)
176-
#define CID0100_RX_ON_OFF_CH2_BIT (1<<1)
177-
#define CID0100_RX_USB_CH1_ENABLED (1<<2)
178-
#define CID0100_RX_USB_CH2_ENABLED (1<<3)
179-
#define CID0100_RX_TEMP_SIMULATION (1<<4)
180-
#define CID0100_RX_PWM_FREQ_JITTERING (1<<5)
181-
182-
183-
// From dsPIC to GUI
184-
185-
#define CID0100_TX_VIN_INDEX 0
186-
#define CID0100_TX_VOUT_CH1_INDEX 2
187-
#define CID0100_TX_IOUT_CH1_INDEX 4
188-
#define CID0100_TX_CONVERTER_STATUS 6
189-
#define CID0100_TX_CONVERTER_FAULT 8
190-
#define CID0100_TX_VOUT_CH2_INDEX 10
191-
#define CID0100_TX_IOUT_CH2_INDEX 12
192-
#define CID0100_TX_TEMPERATURE_INDEX 14
193-
#define CID0100_TX_UPD1_DEVICE_VID 16
194-
#define CID0100_TX_UPD1_DEVICE_PID 18
195-
#define CID0100_TX_UPD2_DEVICE_VID 20
196-
#define CID0100_TX_UPD2_DEVICE_PID 22
197-
167+
198168
/* *********************************************************************************
199169
* Digital Power Debugging UART Communication Frame
200170
* ================================================
@@ -303,7 +273,7 @@ extern "C" {
303273
volatile uint8_t dlh; // ID LOW-Byte
304274
} __attribute__((packed)) bytes; // 2x 8-bit wide data length access
305275
volatile uint16_t value; // 16-bit wide data length value
306-
}dlen;
276+
}dlen; // Data length of the data buffer
307277
volatile uint8_t* data; // Data buffer
308278
union{
309279
struct {
@@ -315,19 +285,26 @@ extern "C" {
315285
volatile uint8_t eof; // END_OF_FRAME byte
316286
} SMPS_DBGUART_DATA_FRAME_t; // SMPS Debug UART Protocol Communication Data Frame
317287

288+
typedef struct {
289+
volatile uint16_t counter; // built-in software timer TX period counter
290+
volatile uint16_t period; // built-in software timer TX period compare to send next message
291+
volatile uint16_t interval; // built-in software timer TX period compare to send next message
292+
}SMPS_DGBUART_TX_TIMER_t; // SMPS Debug UART Protocol software timer settings
293+
318294
typedef struct {
319295
volatile SMPS_DBGUART_DATA_FRAME_t frame; // Data frame object
320296
volatile SMPS_DBGUART_FRAME_STATUS_t status; // Parsing status of the data frame object
321297
volatile uint16_t pointer; // Pointer to recent frame buffer byte position
322-
} SMPS_DGBUART_FRAME_t;
298+
volatile SMPS_DGBUART_TX_TIMER_t tx_tmr; // Built-in transmission software timer settings
299+
} SMPS_DGBUART_FRAME_t; // SMPS Debug UART Protocol frame handler data buffer
323300

324301
typedef struct {
325302
volatile SMPS_DBGUART_STATUS_t status; // Common debugging UART object status
326303
volatile SMPS_DBGUART_FRAME_STATUS_t rx_status; // RECEIVE FRAME object status
327304
volatile uint16_t active_rx_dlen; // Most recent RECEIVE buffer data frame length
328305
volatile uint16_t active_rx_frame; // Most recent RECEIVE buffer index
329306
volatile uint16_t send_counter; // internal software timer period counter
330-
volatile uint16_t send_period; // internal software timer period to send next message
307+
volatile uint16_t send_period; // internal software timer period compare to send next message
331308
volatile uint16_t clear_counter; // internal software timer period counter
332309
volatile uint16_t clear_period; // internal software timer period to clear RECEIVE buffer
333310
} SMPS_DBGUART_t;

h/apl/resources/debug_uart/smpsDebugUART_UserCID.h

Lines changed: 77 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,85 @@ extern "C" {
4747
/* *********************************************************************************
4848
* Digital Power Debugging UART Protocol Global Defines
4949
* ********************************************************************************/
50+
51+
#define UART_RX_BUFFER_SIZE 256U // Size of the internal RECEIVE data buffer of the UART driver
52+
#define UART_TX_BUFFER_SIZE 4096U // Size of the internal TRANSMIT data buffer of the UART driver
53+
#define UART_TX_PACKAGE_SIZE 16U // Size of one data package transmitted at a time
5054

51-
#define DBGUART_CID_DSMPS_GUI 0x0100 // Standard CID for ASCALB GUI (DSMPS)
55+
/* *********************************************************************************
56+
* User Defined Data Frames
57+
* ********************************************************************************/
58+
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
59+
* Declaration of Debug UART Test-Frame 0x0100:
60+
* This frame was introduced to support GUIs developed by ASCALAB.
61+
* These GUIs load dedicated I/O masks for certain designs. Thus,
62+
* the data content is fully proprietary and needs to be defined
63+
* in user code.
64+
*
65+
* Message Frame Type: transmit/receive
66+
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
67+
68+
#define SMPS_DBGUART_CID0100_PERIOD (float)0.500 // 500 ms send interval
69+
70+
#define SMPS_DBGUART_CID0100 0x0100
71+
#define SMPS_DBGUART_CID0100_TX_DLEN 64U
72+
#define SMPS_DBGUART_CID0100_RX_DLEN 12U
73+
74+
extern volatile SMPS_DGBUART_FRAME_t tx_frame_cid0100;
75+
extern volatile uint8_t tx_data_cid0100[];
76+
extern volatile uint16_t tx_data_cid0100_size;
5277

78+
extern volatile uint8_t rx_data_cid0100[];
79+
extern volatile uint16_t rx_data_cid0100_size;
80+
81+
82+
// From dsPIC to GUI
83+
typedef struct {
84+
volatile uint16_t vin; // DBYTE[1:0] Most recent input voltage
85+
volatile uint16_t ch1_vout; // DBYTE[3:2] Most recent output voltage of channel #1
86+
volatile uint16_t ch1_iout; // DBYTE[5:4] Most recent output current of channel #1
87+
volatile uint16_t ch1_temp; // DBYTE[7:6] Most recent board temperature near channel #1
88+
volatile uint16_t ch1_status; // DBYTE[9:8] Most recent value of the system status flags
89+
volatile uint16_t ch2_vout; // DBYTE[11:10] Most recent output voltage of channel #2
90+
volatile uint16_t ch2_iout; // DBYTE[13:12] Most recent output current of channel #2
91+
volatile uint16_t ch2_temp; // DBYTE[15:14] Most recent board temperature near channel #2
92+
volatile uint16_t ch2_status; // DBYTE[17:16] Most recent value of the system status flags
93+
volatile uint16_t upd1_vid; // DBYTE[19:18] UPD350 #1: connected device VID
94+
volatile uint16_t upd1_pid; // DBYTE[21:20] UPD350 #1: connected device PID
95+
volatile uint16_t upd2_vid; // DBYTE[23:22] UPD350 #2: connected device VID
96+
volatile uint16_t upd2_pid; // DBYTE[25:24] UPD350 #2: connected device PID
97+
} __attribute__((packed)) CID0100_TX_t;
98+
99+
// From GUI to dsPIC
100+
101+
extern volatile SMPS_DGBUART_FRAME_t rx_frame_cid0100;
102+
extern volatile uint8_t rx_data_cid0100[];
103+
extern volatile uint16_t rx_data_cid0100_size;
104+
105+
// Set values and System Control Bits
106+
typedef union {
107+
struct {
108+
volatile bool ch1_pwr_enable : 1; // Bit [0]: enables/disables power supply channel #1
109+
volatile bool ch2_pwr_enable : 1; // Bit [1]: enables/disables power supply channel #2
110+
volatile bool ch1_usb_enable : 1; // Bit [2]: enables/disables USB control over channel #1
111+
volatile bool ch2_usb_enable : 1; // Bit [3]: enables/disables USB control over channel #2
112+
volatile bool temp_override : 1; // Bit [4]: enables/disables temperature override
113+
volatile bool pwm_dithering : 1; // Bit [5]: enables/disables PWM spread-spectrum modulation
114+
volatile unsigned : 10; // Bit [15:6]: (not used)
115+
} __attribute__((packed)) bits; // Configuration Bits bit-field
116+
volatile uint16_t value; // Configuration Bits value
117+
} CID0100_CONFIG_t;
118+
119+
typedef struct {
120+
volatile uint16_t ref_ch1_vout; // DBYTE[1:0] Output voltage reference for channel #1
121+
volatile uint16_t ref_ch1_iout; // DBYTE[3:2] Output current reference for channel #1
122+
volatile uint16_t ref_ch2_vout; // DBYTE[5:4] Output voltage reference for channel #2
123+
volatile uint16_t ref_ch2_iout; // DBYTE[7:6] Output current reference for channel #2
124+
volatile uint16_t ref_temp; // DBYTE[9:8] Simulation value for board temperature
125+
volatile CID0100_CONFIG_t config_bits; // DBYTE[11:10] System Control Bits
126+
} __attribute__((packed)) CID0100_RX_t;
127+
128+
53129
/* *********************************************************************************
54130
* Digital Power Debugging UART Protocol Function Prototypes
55131
* ********************************************************************************/

h/apl/resources/power_control/c4swbb_control.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,7 @@ typedef struct {
286286
volatile uint16_t v_in; // Power converter input voltage
287287
volatile uint16_t v_out; // Power converter output voltage
288288
volatile uint16_t v_ref; // Power converter output voltage reference (user setting)
289+
volatile uint16_t i_ref; // Power converter output current reference (user setting)
289290
volatile uint16_t temp; // Power converter board temperature
290291
} C4SWBB_DATA_t; // Power converter runtime data
291292

h/apl/resources/power_control/cha_iloop.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* ********************************************************************************
2-
* z-Domain Control Loop Designer, Version 0.9.0.77
2+
* z-Domain Control Loop Designer, Version 0.9.1.81
33
* ********************************************************************************
44
* 2p2z controller function declarations and compensation filter coefficients
55
* derived for following operating conditions:
@@ -12,11 +12,11 @@
1212
* Input Gain: 1
1313
*
1414
* *******************************************************************************
15-
* CGS Version: 1.0.0
16-
* CGS Date: 11/08/19
15+
* CGS Version: 1.1.1
16+
* CGS Date: 01/13/2020
1717
* *******************************************************************************
1818
* User: M91406
19-
* Date/Time: 01/08/2020 11:38:39 AM
19+
* Date/Time: 02/21/2020 1:13:23 AM
2020
* *******************************************************************************/
2121

2222
#ifndef __SPECIAL_FUNCTION_LAYER_CHA_ILOOP_H__
@@ -87,6 +87,6 @@ extern void cha_iloop_Update( // Calls the 2P2Z controller (Assembly)
8787
#endif // end of __SPECIAL_FUNCTION_LAYER_CHA_ILOOP_H__
8888

8989
//**********************************************************************************
90-
// https://areiter128.github.io/DCLD
90+
// Download latest version of this tool here: https://areiter128.github.io/DCLD
9191
//**********************************************************************************
9292

h/apl/resources/power_control/cha_vloop.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* ********************************************************************************
2-
* z-Domain Control Loop Designer, Version 0.9.0.77
2+
* z-Domain Control Loop Designer, Version 0.9.1.81
33
* ********************************************************************************
44
* 2p2z controller function declarations and compensation filter coefficients
55
* derived for following operating conditions:
@@ -12,11 +12,11 @@
1212
* Input Gain: 0.2
1313
*
1414
* *******************************************************************************
15-
* CGS Version: 1.0.0
16-
* CGS Date: 11/08/19
15+
* CGS Version: 1.1.1
16+
* CGS Date: 01/13/2020
1717
* *******************************************************************************
1818
* User: M91406
19-
* Date/Time: 01/08/2020 11:41:33 AM
19+
* Date/Time: 02/21/2020 1:10:22 AM
2020
* *******************************************************************************/
2121

2222
#ifndef __SPECIAL_FUNCTION_LAYER_CHA_VLOOP_H__
@@ -87,6 +87,6 @@ extern void cha_vloop_Update( // Calls the 2P2Z controller (Assembly)
8787
#endif // end of __SPECIAL_FUNCTION_LAYER_CHA_VLOOP_H__
8888

8989
//**********************************************************************************
90-
// https://areiter128.github.io/DCLD
90+
// Download latest version of this tool here: https://areiter128.github.io/DCLD
9191
//**********************************************************************************
9292

h/apl/resources/power_control/chb_iloop.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* ********************************************************************************
2-
* z-Domain Control Loop Designer, Version 0.9.0.77
2+
* z-Domain Control Loop Designer, Version 0.9.1.81
33
* ********************************************************************************
44
* 2p2z controller function declarations and compensation filter coefficients
55
* derived for following operating conditions:
@@ -12,11 +12,11 @@
1212
* Input Gain: 1
1313
*
1414
* *******************************************************************************
15-
* CGS Version: 1.0.0
16-
* CGS Date: 11/08/19
15+
* CGS Version: 1.1.1
16+
* CGS Date: 01/13/2020
1717
* *******************************************************************************
1818
* User: M91406
19-
* Date/Time: 01/08/2020 11:42:18 AM
19+
* Date/Time: 02/21/2020 1:13:02 AM
2020
* *******************************************************************************/
2121

2222
#ifndef __SPECIAL_FUNCTION_LAYER_CHB_ILOOP_H__
@@ -87,6 +87,6 @@ extern void chb_iloop_Update( // Calls the 2P2Z controller (Assembly)
8787
#endif // end of __SPECIAL_FUNCTION_LAYER_CHB_ILOOP_H__
8888

8989
//**********************************************************************************
90-
// https://areiter128.github.io/DCLD
90+
// Download latest version of this tool here: https://areiter128.github.io/DCLD
9191
//**********************************************************************************
9292

h/apl/resources/power_control/chb_vloop.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* ********************************************************************************
2-
* z-Domain Control Loop Designer, Version 0.9.0.77
2+
* z-Domain Control Loop Designer, Version 0.9.1.81
33
* ********************************************************************************
44
* 2p2z controller function declarations and compensation filter coefficients
55
* derived for following operating conditions:
@@ -12,11 +12,11 @@
1212
* Input Gain: 0.2
1313
*
1414
* *******************************************************************************
15-
* CGS Version: 1.0.0
16-
* CGS Date: 11/08/19
15+
* CGS Version: 1.1.1
16+
* CGS Date: 01/13/2020
1717
* *******************************************************************************
1818
* User: M91406
19-
* Date/Time: 01/08/2020 11:42:53 AM
19+
* Date/Time: 02/21/2020 1:09:40 AM
2020
* *******************************************************************************/
2121

2222
#ifndef __SPECIAL_FUNCTION_LAYER_CHB_VLOOP_H__
@@ -87,6 +87,6 @@ extern void chb_vloop_Update( // Calls the 2P2Z controller (Assembly)
8787
#endif // end of __SPECIAL_FUNCTION_LAYER_CHB_VLOOP_H__
8888

8989
//**********************************************************************************
90-
// https://areiter128.github.io/DCLD
90+
// Download latest version of this tool here: https://areiter128.github.io/DCLD
9191
//**********************************************************************************
9292

0 commit comments

Comments
 (0)