Firmware description
UM1619
40/56
DocID024383 Rev 1
6.6.6 Programming
Frames
The programming frames are frames containing service commands concerning both some
native module features (internal clock, general purpose inputs and outputs, etc.) and user
defined service frames. Native frames are managed directly by the application engine.
From the COMM interface module (SPI, USART, USB, etc.)
uint8_t *buffer;
buffer[0] = n + 11;
// Service frame payload length (n + 11)
buffer[1] = APP_SERVICE_FRAME | BROADCAST_FLAG;
// Service frame type
buffer[2,3] = target_module.group;
// Target device group (2 bytes)
buffer[4,5,6,7] = target_module.address;
// Target device address (4 bytes)
buffer[8] = (
APP_SER_CMD_t
)command;
// Service command
buffer[9,..9+n-1] = service_data[n];
// Service data
buffer[9+n, 9+n+1] = CRC16;
// CRC-16
/* BROADCAST_FLAG = 0x80 -> data sent in broadcast - BROADCAST_FLAG = 0x00 -> data sent in unicast
*/
From / to communication interface (PLM, SPI, USART, USB, etc.)
APP_userdata_t frame;
frame.source = SOURCE_PLM / ...;
// Data source PLM, ...
frame.type = APP_SERVICE_FRAME;
// Service frame type
frame.len = n + 1;
// Service frame payload length
frame.broadcast = TRUE / FALSE;
// TRUE = broadcast, FALSE = unicast
frame.group = target_module.group;
// Target device group (2 bytes)
frame.address = target_module.address;
// Target device address (4 bytes)
frame.data[0] = (
APP_SER_CMD_t
)command;
// Service command
frame.data[n] = service_data[n];
// Service data
Service commands list
/* NATIVE SERVICE COMMANDS */
0x00 = SERVICE_SOFTWARE_RESET
0x01 = SERVICE_HARDWARE_RESET
0x02 = SERVICE_PARAM_SET
0x03 = SERVICE_PARAM_GET
0x04 = SERVICE_INPUTS_GET
0x05 = SERVICE_OUTPUTS_SET
0x06 = SERVICE_FW_REL_GET
0x07 = SERVICE_PLM_CLOCK_SET
0x08 = SERVICE_PLM_CLOCK_GET
0x09 = SERVICE_IO_CONFIG_SET
0x0a = SERVICE_IO_CONFIG_GET
/* USER DEFINED SERVICE COMANDS */
0x.. = SERVICE_USER_CMD_xx
1) Module reset: software (reset the state machines), hardware (reset the module using the
watchdog)
uint8_t *buffer;
buffer[0] = 11;
buffer[1] = APP_SERVICE_FRAME;
buffer[2,3] = target_module.group;
buffer[4,5,6,7] = target_module.address;
/* FOR SOFTWARE RESET */
buffer[8] = SERVICE_SOFTWARE_RESET;
/* FOR HARDWARE RESET */
buffer[8] = SERVICE_HARDWARE_RESET;
buffer[9,10] = CRC16;