Firmware description
UM1619
34/56
DocID024383 Rev 1
The data type for the “dongle.h” module; “stm32f10x_gpio” module are listed hereafter:
/* LED TYPE */
typedef enum
{
A_LED_ERROR,
A_LED_DATA,
A_LED_BOTH
}
DH_LedType_t
;
/* LED STATUS */
typedef enum
{
A_LED_ON,
A_LED_OFF,
A_LED_FLASH
}
DH_LedAction_t
;
/* PIN VALUE */
typedef enum
{
Bit_RESET = 0,
Bit_SET
}BitAction;
6.6
Firmware frame types
This paragraph describes all the frame type that are implemented in this firmware. In each
field there is also a description.
6.6.1 Data
Frames
Data frames are frames exchanged between two PLM modules or between a PLM module
and an external device connected to the COMM interface.
From the COMM interface module (SPI, USART, USB etc.)
buffer[0] = n + 10;
// Data frame payload length (n + 10)
buffer[1] = APP_DATA_FRAME | BROADCAST_FLAG;
// Data 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,..8+n-1] = user_data[n];
// User data (n bytes, at least 1)
buffer[8+n,8+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.)
frame.source = SOURCE_PLM / ...;
// Data source PLM, ...
frame.type = APP_SERVICE_FRAME;
// Data frame type
frame.len = n;
// Data 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[n] = service_data[n];
// User data (n bytes)