Compare commits

...

No commits in common. "main" and "master" have entirely different histories.
main ... master

26 changed files with 1476 additions and 2280 deletions

View File

@ -0,0 +1,36 @@
// BOOTLOADER defines
// RCC defines
#define __RCC_UART_BOOT_CLK_ENABLE() __HAL_RCC_USART3_CLK_ENABLE()
#define __RCC_UART_PORT_CLK_ENABLE() __HAL_RCC_GPIOB_CLK_ENABLE()
#define __RCC_DMA_UART_CLK_ENABLE() __HAL_RCC_DMA1_CLK_ENABLE()
#define __RCC_DMA_SDIO_CLK_ENABLE() __HAL_RCC_DMA2_CLK_ENABLE()
#define __RCC_TIM_BOOT_CLK_ENABLE() __HAL_RCC_TIM7_CLK_ENABLE()
// USART defines
#define UART_BOOT USART3 // usart
#define UART_SPEED 256000
#define UART_BOOT_IRQn USART3_IRQn
#define UART_PORT GPIOB // usart port
#define UART_PIN_TX GPIO_PIN_10
#define UART_PIN_RX GPIO_PIN_11
// DMA defines
#define DMA_UART_Channel DMA1_Channel3
#define DMA_SDIO_Channel DMA2_Channel4
#define DMA_UART_IRQn DMA1_Channel3_IRQn
#define DMA_SDIO_IRQn DMA2_Channel4_5_IRQn
// TIM defines
#define TIM_BOOT TIM7
#define TIM_BOOT_Prescaler 64000 // set up for 1 tick - 1 ms (no decrement needed)
#define TIM_BOOT_IRQn TIM7_IRQn
// SDIO defines
#define SDIO_SDCard_In_PORT GPIOB
#define SDIO_SDCard_In_PIN GPIO_PIN_5
#define SDIO_SDCard_In_IRQn EXTI9_5_IRQn

9
Core/Inc/custom_flash.h Normal file
View File

@ -0,0 +1,9 @@
#include "main.h"
#define PAGE_SIZE 2048
HAL_StatusTypeDef FLASH_Write_Page(uint32_t *Address, uint8_t *Data, int Data_size);
HAL_StatusTypeDef FLASH_Write_Word(uint32_t Address, uint64_t Data);
HAL_StatusTypeDef FLASH_Erase_App(void);
uint8_t *FLASH_Read(uint32_t add);

View File

@ -0,0 +1,20 @@
#include "main.h"
#include "ff.h"
//#include "usart.h"
#define sizebuff 16
struct flags
{
unsigned writting:1;
};
extern struct flags flags_UART_FATFS;
FRESULT CreateAndOpenMessageFile(FIL *MessageFile, const TCHAR* path);
FRESULT OpenMessageFile(FIL *MessageFile, const TCHAR* path);
FRESULT WriteMessage(FIL *MessageFile, char *Message, UINT SizeOfMessage);
FRESULT CloseMessageFile(FIL *MessageFile);
void WriteFile(char *Data, int Num_of_Data);
void Check_USART(void);

20
Core/Inc/custom_usart.h Normal file
View File

@ -0,0 +1,20 @@
#include "main.h"
#define __USER_LINKDMA(__HANDLE__, __PPP_DMA_FIELD__, __DMA_HANDLE__) \
do{ \
(__HANDLE__)->__PPP_DMA_FIELD__ = (__DMA_HANDLE__); \
(__DMA_HANDLE__)->Parent = (__HANDLE__);} while(0U)
struct UARTSettings
{
USART_TypeDef *UARTx;
uint32_t UART_Speed;
GPIO_TypeDef *GPIOx;
uint16_t GPIO_PIN_RX;
uint16_t GPIO_PIN_TX;
DMA_Channel_TypeDef *DMAChannel; // DMAChannel = 0 if doesnt need
};
void User_UART_Init(UART_HandleTypeDef* huart, DMA_HandleTypeDef *DMAhuart, struct UARTSettings *uuart);
void UART_GPIO_Init(GPIO_TypeDef *GPIOx, uint16_t GPIO_PIN_RX, uint16_t GPIO_PIN_TX);
void UART_DMA_Init(UART_HandleTypeDef *huart, DMA_HandleTypeDef *hdma_rx, DMA_Channel_TypeDef *DMAhuart);

View File

@ -31,6 +31,7 @@ extern "C" {
/* Private includes ----------------------------------------------------------*/
/* USER CODE BEGIN Includes */
#include "boot_project_setup.h"
#include "requester.h"
/* USER CODE END Includes */

View File

@ -10,20 +10,8 @@
#define ONLINE 1;
#define OFFLINE 0;
// TIM defines
#define TIM_REQUESTER_Prescaler 64000
//CAN Settings
#define _HCAN hcan
//CAN Speed
#define CAN_SPEED_PRSC_1000KB 2
#define CAN_SPEED_PRSC_500KB 4
#define CAN_SPEED_PRSC_250KB 8
#define CAN_SPEED_PRSC_125KB 16
#define CAN_SPEED_PRSC_50KB 40
#define CAN_CURRENT_SPEED CAN_SPEED_PRSC_250KB
//CAN Filter
#define ID_MAIN_DEVICE 0x000
#define CURRENT_ID_DEVICE 0x002
@ -34,6 +22,19 @@
#define CAN_SENSOR_TYPE_FILTER 0x00F80000
#define CAN_SENSOR_ID_FILTER 0x0007FF00
void REQUESTER_Init(void);
void REQUESTER_MainWhile(void);
void Boot_SystemClock_Config(void);
void REQUESTER_AnalogProcessing(void);
void REQUESTER_BroadcastProcessing(void);
void REQUESTER_DiscreticProcessing(void);
void REQUESTER_ModbusProcessing(void);
void REQUESTER_RTC_SYNC(uint8_t *data);
void REQUESTER_Pulse_TIM_Handler(void);
void Boot_SystemClock_Config(void);
void REQUESTER_CAN_FILTERS(void);
union Byte{
struct bitfield{
unsigned bit0:1;
@ -74,26 +75,24 @@ _Bool IsLeapYear(uint8_t year);
#define DATA_TYPE_PULSE 0b1111
//Sensor Types for DATA_TYPE_BROADCAST
#define SENSOR_TYPE_BROADCAST_STATUS 0b00000
#define SENSOR_TYPE_BROADCAST_ONOFF 0b00001
#define SENSOR_TYPE_BROADCAST_RESTARTDEVICE 0b00010
#define SENSOR_TYPE_BROADCAST_RTCSETUP 0b00011
#define SENSOR_TYPE_STATUS 0b00000
#define SENSOR_TYPE_ONOFF 0b00001
#define SENSOR_TYPE_RTCSETUP 0b00010
//Sensor Types for DATA_TYPE_DISCRETE
#define SENSOR_TYPE_DISCRETE_ACCIDENT 0b00000
#define SENSOR_TYPE_DISCRETE_WARNING 0b00001
#define SENSOR_TYPE_DISCRETE_CONTROL_SIGNALS 0b00010
#define SENSOR_TYPE_DISCRETE_FLAGS 0b00011
#define SENSOR_TYPE_DISCRETE_RESET 0b00100
#define SENSOR_TYPE_DISCRETE_CHANGE_MODE 0b00101
#define SENSOR_TYPE_DISCRETE_REQUEST_LIST_OF_PARAMETERS 0b00110
#define SENSOR_TYPE_ACCIDENT 0b00000
#define SENSOR_TYPE_WARNING 0b00001
#define SENSOR_TYPE_CONTROL_SIGNALS 0b00010
#define SENSOR_TYPE_FLAGS 0b00011
#define SENSOR_TYPE_RESET 0b00100
#define SENSOR_TYPE_CHANGE_MODE 0b00101
#define SENSOR_TYPE_REQUEST_LIST_OF_PARAMETERS 0b00110
//Sensor Types for DATA_TYPE_ANALOG
#define SENSOR_TYPE_ANALOG_UNIVERSAL 0b00000
#define SENSOR_TYPE_ANALOG_USTAVKI 0b00001
#define SENSOR_TYPE_ANALOG_U 0b00010
#define SENSOR_TYPE_ANALOG_I 0b00011
#define SENSOR_TYPE_ANALOG_T 0b00100
#define SENSOR_TYPE_UNIVERSAL 0b00000
#define SENSOR_TYPE_U 0b00001
#define SENSOR_TYPE_I 0b00010
#define SENSOR_TYPE_T 0b00011
//Error Code
#define NONEXISTENT_ELEMENT 0x01
@ -107,7 +106,7 @@ struct controlflags{
};
//Device settings
/*union ext_ID{
union ext_ID{
struct ext_ID_fields{
unsigned DeviceID:8;
unsigned SensorID:11;
@ -124,33 +123,15 @@ union ext_ID_Modbus{
unsigned CountReg:8;
unsigned StrAdr:8;
unsigned DataType:4;
unsigned Route:1;
unsigned Route;
}Fields;
unsigned int BitAll:29;
};*/
typedef union _extID{
struct extID_Standard_Fields{
unsigned DeviceID:8;
unsigned SensorID:11;
unsigned SensorType:5;
unsigned DataType:4;
unsigned Route:1;
}StandardFields;
struct extID_Modbus_Fields{
unsigned DeviceID:8;
unsigned CountReg:8;
unsigned StrAdr:8;
unsigned DataType:4;
unsigned Route:1;
}ModbusFields;
unsigned int BitAll:29;
}extID;
};
struct device
{
unsigned Status:1;
extID ExtID;
union ext_ID ExtID;
unsigned TimeFromLastPulse;
unsigned LastPulseStep;
};
@ -180,7 +161,7 @@ struct data
};
struct received_request{
extID RequestedExtID;
union ext_ID RequestedExtID;
unsigned RequestedDLC;
uint8_t RxData[8];
@ -240,56 +221,4 @@ struct received_request{
unsigned ModbusFlag:1;
};
#define CAN_RX_BUFFER_SIZE 128
struct RXMsg{
struct INFO{
unsigned EXT:1;
unsigned RTR:1;
}info;
extID eID;
uint16_t DLC;
uint8_t Data[8];
};
uint16_t AvailableCanRxMsg(void);
void REQUESTER_Init(void);
void REQUESTER_MainWhile(void);
void Boot_SystemClock_Config(void);
void REQUESTER_AnalogProcessing(struct RXMsg _rxMsg);
HAL_StatusTypeDef CanRequestToAnalogUniversal(struct RXMsg _rxMsg);
HAL_StatusTypeDef CanRequestToAnalogUSTAVKI(struct RXMsg _rxMsg);
HAL_StatusTypeDef CanRequestToAnalogUSens(struct RXMsg _rxMsg);
HAL_StatusTypeDef CanRequestToAnalogISens(struct RXMsg _rxMsg);
HAL_StatusTypeDef CanRequestToAnalogTSens(struct RXMsg _rxMsg);
void REQUESTER_BroadcastProcessing(struct RXMsg _rxMsg);
HAL_StatusTypeDef CanRequestToBroadcastStatus(struct RXMsg _rxMsg);
void CanRequestToBroadcastOnOff(struct RXMsg _rxMsg);
void CanRequestToBroadcastRestart(struct RXMsg _rxMsg);
void CanRequestToBroadcastRtcSetup(struct RXMsg _rxMsg);
void REQUESTER_DiscreticProcessing(struct RXMsg _rxMsg);
void CanRequestToDiscreteAccident(struct RXMsg _rxMsg);
void CanRequestToDiscreteWarning(struct RXMsg _rxMsg);
void CanRequestToDiscreteControlSignals(struct RXMsg _rxMsg);
void CanRequestToDiscreteFlags(struct RXMsg _rxMsg);
void CanRequestToDiscreteReset(struct RXMsg _rxMsg);
void CanRequestToDiscreteChangeMode(struct RXMsg _rxMsg);
void CanRequestToDiscreteRequestListOfParameters(struct RXMsg _rxMsg);
void REQUESTER_ModbusProcessing(struct RXMsg _rxMsg);
void CanRequestToModbusCoil(struct RXMsg _rxMsg);
void CanRequestToModbusDiscrete(struct RXMsg _rxMsg);
void CanRequestToModbusHolding(struct RXMsg _rxMsg);
void CanRequestToModbusInput(struct RXMsg _rxMsg);
void REQUESTER_RTC_SYNC(uint8_t *data);
void REQUESTER_Pulse_TIM_Handler(void);
void Boot_SystemClock_Config(void);
void REQUESTER_CAN_FILTERS(void);
#endif

614
Core/Src/bootloader.c Normal file
View File

@ -0,0 +1,614 @@
#include "bootloader.h"
#include "custom_receive_and_write.h"
extern FLASH_EraseInitTypeDef EraseInitStruct;
struct flag FLAGS;
struct Bootloader_Errors_Counters BOOTLOADER_ERRORS_COUNTERS;
struct Bootloader_Errors BOOTLOADER_ERRORS;
uint32_t app_current_add; // address for writing pages
int cnt_tim_reset = 0; // WD Tim counter
uint8_t ReceiveDataUART[4]; // buffer for CMD
uint8_t Data2Write[PAGE_SIZE*2]; // DMA buffer for application
uint8_t CAN_Data[8];
CAN_TxHeaderTypeDef TxHeader;
CAN_RxHeaderTypeDef RxHeader;
uint32_t TxMailBox = 0; // num of used mail
extern UART_HandleTypeDef huart_boot; // uart handler for boot uart
extern DMA_HandleTypeDef hdma_usart_boot_rx; // dma handler for boot uart
struct UARTSettings UARTSet; // settings for uart
void Bootloader_Init(void)
{
HAL_Init();
Boot_SystemClock_Config();
MX_DMA_Init();
//Если используется ЮСАРТ - инициализация
#ifdef __USART_H__
UARTSet.UARTx = UART_BOOT;
UARTSet.UART_Speed = UART_SPEED;
UARTSet.GPIOx = UART_PORT;
UARTSet.GPIO_PIN_RX = UART_PIN_RX;
UARTSet.GPIO_PIN_TX = UART_PIN_TX;
UARTSet.DMAChannel = DMA_UART_Channel;
User_UART_Init(&huart_boot, &hdma_usart_boot_rx, &UARTSet);
#endif
//Если используется SD-карта - инициализация
#ifdef __SDIO_H__
BSP_SD_ITConfig();
#endif
#ifdef __CAN_H__
MX_CAN_Init();
#endif
//Инициализация светодиодов
MX_GPIO_Init();
MX_TIM7_Init();
}
HAL_StatusTypeDef res_hal;
void Bootloader_main(void) // main function, that defines bootloader behaviour
{
/*
// Настройка доступной переферии с помощью define
Bootloader_Init();
*/
/* START APPLICATION */
if (ReadKey() == BL_KEY_APP_WRITTEN)
{
// jump to main app
//Задаётся адрес программы со смещением от начала вектора прерываний
uint32_t app_jump_adr;
app_jump_adr=*((volatile uint32_t*)(MAIN_APP_START_ADR+4));
void(*GoToApp)(void);
//Деинициализация HAL
HAL_DeInit();
GoToApp = (void (*) (void)) app_jump_adr;
//Перенос вектора прерываний на начало зашитой программы
__disable_irq();
__set_MSP(*((volatile uint32_t*)MAIN_APP_START_ADR));
__enable_irq();
//Переход к выполнению зашитой программы
GoToApp();
}
else /* START PROGRAMMING MCU */
{
/* MCU Configuration for bootloader-------------------------------------------*/
/* Reset of all peripherals, Initializes the Flash BootloaderCMD and the Systick. */
Bootloader_Init();
FLAGS.InitOrWait = 0;
// waif for commant for programming
do{
res_hal=HAL_UART_Receive_IT(&huart_boot, ReceiveDataUART, sizeof(ReceiveDataUART));
if(res_hal!=HAL_OK){
BOOTLOADER_ERRORS_COUNTERS.USART_RECEIVE++;
BOOTLOADER_ERRORS.USART_RECEIVE=1;
}
}while(res_hal!=HAL_OK); // if usart err - try start receive again
HAL_CAN_Start(&hcan);
HAL_CAN_ActivateNotification(&hcan, CAN_IT_RX_FIFO0_MSG_PENDING);
CAN_FilterTypeDef canFilterConfig;
canFilterConfig.FilterBank = 0;
canFilterConfig.FilterMode = CAN_FILTERMODE_IDMASK;
canFilterConfig.FilterScale = CAN_FILTERSCALE_32BIT;
canFilterConfig.FilterIdHigh = 0x0000;
canFilterConfig.FilterIdLow = 0x0000;
canFilterConfig.FilterMaskIdHigh = 0x0000;
canFilterConfig.FilterMaskIdLow = 0x0000;
canFilterConfig.FilterFIFOAssignment = CAN_RX_FIFO0;
canFilterConfig.FilterActivation = ENABLE;
canFilterConfig.SlaveStartFilterBank = 14;
HAL_CAN_ConfigFilter(&hcan, &canFilterConfig);
// FLAGS.StartInit=1;
// FLAGS.reInitMCU=1;
// FLAGS.BootloaderCMD = 2;
app_current_add = MAIN_APP_START_ADR;
// HAL_CAN_Start(&hcan);
/* Infinite loop */
while (1)
{
// HAL_Delay(10);
// HAL_UART_Transmit(&huart_boot, (uint8_t *)"000000", 6, HAL_MAX_DELAY);
// choose interface for programming
if (FLAGS.StartInit)
{
if (FLAGS.reInitMCU) // if its reInit request - erase outdate app
{
GPIOB->ODR^=0x2000;
res_hal=FLASH_Erase_App();
if(res_hal!=HAL_OK)
{
FLAGS.StartInit=1;
BOOTLOADER_ERRORS.FLASH_ERASE = 1;
continue;
}
BOOTLOADER_ERRORS.FLASH_ERASE = 0;
GPIOB->ODR^=0x2000;
FLAGS.reInitMCU = 0;
}
FLAGS.StartInit = 0;
HAL_UART_AbortReceive_IT(&huart_boot);
HAL_CAN_Stop(&hcan);
HAL_CAN_DeactivateNotification(&hcan, CAN_IT_RX_FIFO0_MSG_PENDING);
switch ((int)FLAGS.BootloaderCMD)
{
// UART
#ifdef __USART_H__
case 1:/* UART */
FLAGS.InitBootPeriph = 1;
// start receiving app.bin
res_hal = HAL_UART_Receive_DMA(&huart_boot, Data2Write, PAGE_SIZE*2);
if(res_hal!=HAL_OK)
{
FLAGS.StartInit=1;
BOOTLOADER_ERRORS_COUNTERS.USART_RECEIVE++;
BOOTLOADER_ERRORS.USART_RECEIVE = 1;
break;
}
// code of writing app in flash in callbacks functions:
// HAL_UART_RxHalfCpltCallback and HAL_UART_RxCpltCallback
break;
#endif
#ifdef __CAN_H__
// CAN
case 2: /* CAN */
// activate can and start receiving app.bin
FLAGS.InitOrWait=1;
res_hal = HAL_CAN_Start(&hcan);
res_hal = HAL_CAN_ActivateNotification(&hcan, CAN_IT_RX_FIFO0_MSG_PENDING | CAN_IT_ERROR | CAN_IT_BUSOFF | CAN_IT_LAST_ERROR_CODE);
// code of writing app in flash in callback functions:
// HAL_CAN_RxFifo0MsgPendingCallback
break;
#endif
// SD
#ifdef __SDIO_H__
case 3: /* SD */
if (FLAGS.SDCardIn==0) // wait for sd-card
{
FLAGS.StartInit=1; // if there is no card, exit programmator and go in again
BOOTLOADER_ERRORS.SD_CARD_NOT_INSERTED = 1;
//Ошибка SD карты. Начать приём новой cmd
break;
}
HAL_Delay(100); // wait for inputting SD Card
if (FLAGS.SDCardIn==0)
{
FLAGS.StartInit=1;
BOOTLOADER_ERRORS.SD_CARD_NOT_INSERTED = 1;
break;
}
FRESULT res_fresult;
SD_Programming(&res_fresult, &res_hal); // programming from sd card
// res_fresual - status for sd card read // res_hal - status for flash write
//Если всё удачно - выполнить код ниже. Если нет - StartInit = 1, break
if(res_fresult!=FR_OK || res_hal!=HAL_OK)
{
FLAGS.StartInit=1;
if(res_fresult!=FR_OK){
BOOTLOADER_ERRORS_COUNTERS.SD_CARD_READ++;
BOOTLOADER_ERRORS.SD_CARD_READ = 1;
}
if(res_hal!=HAL_OK){
BOOTLOADER_ERRORS_COUNTERS.FLASH_WRITE++;
BOOTLOADER_ERRORS.FLASH_WRITE = 1;
}
break;
}
// write Key: application in Flash, and reset MCU
{
ResetKey();
SetKey();
NVIC_SystemReset();
}// reset mcu
break;
#endif
default: // if command is incorrect - wait CMD
BOOTLOADER_ERRORS_COUNTERS.CMD_INVALID++; // uncorrect command
BOOTLOADER_ERRORS.CMD_INVALID=1;
do
{
res_hal=HAL_UART_Receive_IT(&huart_boot, ReceiveDataUART, sizeof(ReceiveDataUART));
if(res_hal!=HAL_OK){
BOOTLOADER_ERRORS_COUNTERS.USART_RECEIVE++; // err when initialize uart
BOOTLOADER_ERRORS.USART_RECEIVE=1;}
}while(res_hal!=HAL_OK);
HAL_CAN_Start(&hcan);
HAL_CAN_ActivateNotification(&hcan, CAN_IT_RX_FIFO0_MSG_PENDING);
}
}
// TxHeader.StdId = 0x200; // ID OF MESSAGE
// TxHeader.ExtId = 0; // STANDART FRAME (NOT EXTENTED)
// TxHeader.RTR = CAN_RTR_DATA; // TRANSMIT DATA OR
// TxHeader.IDE = CAN_ID_STD; // STANDART FRAME
// TxHeader.DLC = 8; // DATA SIZE
// TxHeader.TransmitGlobalTime = DISABLE; //THIS MODE IS NOT USED, SO DISABLE
// uint8_t asd[8] = "ABCDEFGL";
// while(HAL_CAN_GetTxMailboxesFreeLevel(&hcan) == 0); // wait for free mail box
// res_hal = HAL_CAN_AddTxMessage(&hcan, &TxHeader, asd, &TxMailBox); // add to mail for transmit
// HAL_Delay(1000);
}
}
}
void SD_Programming(FRESULT *res_fresult, HAL_StatusTypeDef *res_hal)
{
// init peripth
MX_FATFS_Init();
MX_SDIO_SD_Init();
FIL MFile;
int SizeApp;
int AppCount;
// mount disk
uint8_t MOUNT=1;
*res_fresult = f_mount(&SDFatFS, (TCHAR const*)SDPath, 1);
if(*res_fresult != FR_OK) return;
// name of the application file
static char path[8] = "app.bin";
path[7] = '\0';
// OPEN AND READ
*res_fresult = f_open(&MFile, (const TCHAR*)path, FA_READ);
if (*res_fresult == FR_OK)
{
SizeApp = MFile.fsize;
AppCount = 0; // counter of written bytes
unsigned int bytesRead;
// reading and writing two pages
while(SizeApp - AppCount >= PAGE_SIZE*2) // read while count of rest bytes more than size of two pages
{
*res_fresult = f_read(&MFile, Data2Write, PAGE_SIZE*2, &bytesRead);
if(*res_fresult != FR_OK) return;
AppCount += PAGE_SIZE*2;
*res_hal = FLASH_Write_Page(&app_current_add, Data2Write, PAGE_SIZE*2);
if(*res_hal != HAL_OK) return;
GPIOB->ODR^=0x2000; // indicate written two pages
}
// reading and writing rest bytes (less than two pages)
if(SizeApp != AppCount)
{
int NumOfLastBytes = SizeApp - AppCount;
*res_fresult = f_read(&MFile, Data2Write, NumOfLastBytes, &bytesRead);
if(*res_fresult != FR_OK) return;
AppCount += PAGE_SIZE*2;
*res_hal = FLASH_Write_Page(&app_current_add, Data2Write, NumOfLastBytes);
if(*res_hal != HAL_OK) return;
GPIOB->ODR^=0x2000;
}
*res_fresult = f_close(&MFile); // indicate written two pages
}
}
void HAL_UART_RxHalfCpltCallback(UART_HandleTypeDef *huart) // writing first half of dma buffer (1 page)
{
if (huart->Instance == UART_BOOT)
{
if (FLAGS.InitOrWait)
{
HAL_StatusTypeDef res_hal;
if (FLAGS.InitBootPeriph) // if its first received page
{
//HAL_TIM_Base_Start_IT(&htim_boot); // start "wd" timer
FLAGS.InitBootPeriph = 0; // 5 sec silent on RX - mcu reset
}
res_hal = FLASH_Write_Page(&app_current_add, Data2Write, PAGE_SIZE);
if (res_hal != HAL_OK)
{
BOOTLOADER_ERRORS_COUNTERS.FLASH_WRITE++; // err when initialize uart
BOOTLOADER_ERRORS.FLASH_WRITE=1;
}
// HAL_UART_DMAStop(&huart_boot);
// HAL_UART_AbortReceive_IT(&huart_boot);
// HAL_UART_AbortReceive(&huart_boot);
FLAGS.HalfOfWrite = 1; // switch unwritten half of DMA buffer
cnt_tim_reset = 0; // upd WD Tim
GPIOB->ODR^=0x2000; // indicate written page
}
}
}
void HAL_UART_RxCpltCallback(UART_HandleTypeDef *huart) // writing second half of dma buffer (1 page)
{
if (huart->Instance == UART_BOOT)
{
if (FLAGS.InitOrWait == 0) // if its wait mode (not writting app)
{
// set Init mode, start WDTim after receiving first page
Check_CMD_USART(ReceiveDataUART); // check received uart data
FLAGS.InitOrWait = 1;
FLAGS.StartInit = 1;
FLAGS.InitBootPeriph = 1;
app_current_add = MAIN_APP_START_ADR; // set adress for app
}
else
{
HAL_StatusTypeDef res_hal;
res_hal = FLASH_Write_Page(&app_current_add, Data2Write+PAGE_SIZE, PAGE_SIZE);
if (res_hal != HAL_OK)
{
BOOTLOADER_ERRORS_COUNTERS.FLASH_WRITE++; // err when initialize uart
BOOTLOADER_ERRORS.FLASH_WRITE=1;
}
FLAGS.HalfOfWrite = 0; // switch unwritten half of DMA buffer
cnt_tim_reset = 0; // upd WD Tim
GPIOB->ODR^=0x2000; // indicate written page
}
}
}
uint32_t temp_app_cur_add;
int app_size;
/*void HAL_CAN_RxFifo0MsgPendingCallback(CAN_HandleTypeDef *hcan)
{
if(HAL_CAN_GetRxMessage(hcan, CAN_RX_FIFO0, &RxHeader, CAN_Data) == HAL_OK)
{
#ifdef _CAN_PUSH_ID_TO_ADDR_
if(FLAGS.InitOrWait)
{ // if its 1 - Init: writting app.bin in flash
temp_app_cur_add = app_current_add+(RxHeader.ExtId&(0x0000FFFF));
FLASH_Write_Page(&temp_app_cur_add, CAN_Data, 8);
app_size-=8; // decrease app_size
if (app_size<=0) // when its gone - reset system and go to the app
{
__ASM("");
NVIC_SystemReset();
}
}
else
{ // if its 0 - Wait: parsing address to writting and size of app.bin
app_current_add = Data2Write[0]<<24 | Data2Write[1]<<16 | Data2Write[2]<<8 | Data2Write[3];
app_size = Data2Write[4]<<24 | Data2Write[5]<<16 | Data2Write[6]<<8 | Data2Write[7];
FLAGS.InitOrWait = 1; // switch to firmware (init)
}
#endif
if(FLAGS.InitOrWait)
{
if (FLAGS.InitBootPeriph) // if its first received page
{
HAL_TIM_Base_Start_IT(&htim_boot); // start "wd" timer
FLAGS.InitBootPeriph = 0; // 5 sec silent on RX - mcu reset
}
FLASH_Write_Page(&app_current_add, CAN_Data, 8);
cnt_tim_reset=0;
}
else
{
app_current_add = MAIN_APP_START_ADR; // set adress for app
Check_CMD_USART(CAN_Data);
FLAGS.InitBootPeriph=1;
FLAGS.InitOrWait = 1;
FLAGS.StartInit = 1;
}
}
}
*/
void HAL_CAN_ErrorCallback(CAN_HandleTypeDef *hcan)
{
uint32_t er;
er = HAL_CAN_GetError(hcan);
__ASM("");
}
void Bootloader_TIM_Handler(void) // reset mcu after writing application is done
{ // add this to the TIM handler that is used (TIMx is seting up in project_setup.h)
HAL_StatusTypeDef res_fresult;
cnt_tim_reset++;
if (cnt_tim_reset > 5) // writing is done if there is silence on Rx for 5 second
{
if(FLAGS.BootloaderCMD==1)
{
FLAGS.InitMCUReady = 1;
ResetKey();
SetKey(); // write key for going to application
int NumOfLastBytes = (PAGE_SIZE - DMA1_Channel3->CNDTR%PAGE_SIZE); // read size of new data in dma buffer
if (NumOfLastBytes != 0)
{
res_fresult = FLASH_Write_Page(&app_current_add, Data2Write+PAGE_SIZE*FLAGS.HalfOfWrite, NumOfLastBytes); // writing last data
}
NVIC_SystemReset(); // reset mcu
}
else if(FLAGS.BootloaderCMD==2)
{
FLAGS.InitMCUReady = 1;
ResetKey();
SetKey();
NVIC_SystemReset();
}
}
}
void Check_CMD_USART(uint8_t *DataUART) // choose CMD (interface)
{ // 4 byte: 0xFF - erase app, else - just write app
//USART
if ((DataUART[0]|
DataUART[1]<<8|
DataUART[2]<<16) == 0xFFFFFF)
{
FLAGS.BootloaderCMD = 1;
}
//CAN
else if ((DataUART[0]|
DataUART[1]<<8|
DataUART[2]<<16) == 0xAAAFFF)
{
FLAGS.BootloaderCMD = 2;
}
//SDIO
else if ((DataUART[0]|
DataUART[1]<<8|
DataUART[2]<<16) == 0xAAFAFF)
{
FLAGS.BootloaderCMD = 3;
BSP_SD_DetectIT();
}
if (DataUART[3]== 0xFF)
{
FLAGS.reInitMCU = 1;
}
else
{
FLAGS.reInitMCU = 0;
}
}
// reset/set key function
void SetKey(void)
{
HAL_FLASH_Unlock();
HAL_FLASH_Program(FLASH_TYPEPROGRAM_WORD, BOOTLOADER_KEY_ADR, BL_KEY_APP_WRITTEN);
HAL_FLASH_Lock();
}
uint32_t ReadKey(void)
{
return (*(__IO uint32_t*)BOOTLOADER_KEY_ADR);
}
void ResetKey(void)
{
HAL_FLASH_Unlock();
uint32_t PageError = 0x00;
EraseInitStruct.TypeErase = FLASH_TYPEERASE_PAGES;// erase pages
EraseInitStruct.PageAddress = BOOTLOADER_KEY_ADR; //address
EraseInitStruct.NbPages = 0x01;// num of erased pages
HAL_FLASHEx_Erase(&EraseInitStruct, &PageError);
HAL_FLASH_Lock();
}
HAL_StatusTypeDef BSP_SD_ITConfig(void)
{
/* Code to be updated by the user or replaced by one from the FW pack (in a stmxxxx_sd.c file) */
GPIO_InitTypeDef gpio_init_structure;
/* Configure Interrupt mode for SD detection pin */
gpio_init_structure.Pin = SDIO_SDCard_In_PIN;
gpio_init_structure.Pull = GPIO_PULLUP;
gpio_init_structure.Speed = GPIO_SPEED_HIGH;
gpio_init_structure.Mode = GPIO_MODE_IT_RISING_FALLING;
HAL_GPIO_Init(SDIO_SDCard_In_PORT, &gpio_init_structure);
/* Enable and set SD detect EXTI Interrupt to the lowest priority */
HAL_NVIC_SetPriority((SDIO_SDCard_In_IRQn), 0x00, 0x00);
HAL_NVIC_EnableIRQ((SDIO_SDCard_In_IRQn));
return HAL_OK;
// return (uint8_t)0;
}
void BSP_SD_DetectIT(void)
{ // add this to the EXTI handler that is used (EXTIx (GPIO_PIN_x) is seting up in project_setup.h)
if(SDIO_SDCard_In_PORT->IDR&SDIO_SDCard_In_PIN)
FLAGS.SDCardIn = 0;
else
FLAGS.SDCardIn = 1;
}
void Boot_SystemClock_Config(void)
{
RCC_OscInitTypeDef RCC_OscInitStruct = {0};
RCC_ClkInitTypeDef RCC_ClkInitStruct = {0};
/** Initializes the RCC Oscillators according to the specified parameters
* in the RCC_OscInitTypeDef structure.
*/
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI;
RCC_OscInitStruct.HSIState = RCC_HSI_ON;
RCC_OscInitStruct.HSICalibrationValue = RCC_HSICALIBRATION_DEFAULT;
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSI_DIV2;
RCC_OscInitStruct.PLL.PLLMUL = RCC_PLL_MUL16;
if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK)
{
Error_Handler();
}
/** Initializes the CPU, AHB and APB buses clocks
*/
RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK
|RCC_CLOCKTYPE_PCLK1|RCC_CLOCKTYPE_PCLK2;
RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK;
RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1;
RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV2;
RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV1;
if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_2) != HAL_OK)
{
Error_Handler();
}
HAL_RCC_MCOConfig(RCC_MCO, RCC_MCO1SOURCE_PLLCLK, RCC_MCODIV_1);
}

View File

@ -38,7 +38,7 @@ void MX_CAN_Init(void)
/* USER CODE END CAN_Init 1 */
hcan.Instance = CAN1;
hcan.Init.Prescaler = CAN_CURRENT_SPEED;
hcan.Init.Prescaler = 2;
hcan.Init.Mode = CAN_MODE_NORMAL;
hcan.Init.SyncJumpWidth = CAN_SJW_1TQ;
hcan.Init.TimeSeg1 = CAN_BS1_13TQ;

94
Core/Src/custom_flash.c Normal file
View File

@ -0,0 +1,94 @@
#include "custom_flash.h"
#include "bootloader.h"
FLASH_EraseInitTypeDef EraseInitStruct;
//uint32_t PAGE_OFFSET = ((uint32_t)((4-1) * 0x0400));
uint32_t PAGE_NUMB = 127;
uint8_t *FLASH_Read(uint32_t add)
{
return (uint8_t *)add;
}
HAL_StatusTypeDef FLASH_Write_Word(uint32_t Address, uint64_t Data) //Куда записывать
{
HAL_StatusTypeDef res;
res = HAL_FLASH_Unlock();
if (res != HAL_OK) return res;
res = HAL_FLASH_Program(FLASH_TYPEPROGRAM_WORD, Address, (uint32_t)(Data));
if (res != HAL_OK) return res;
res = HAL_FLASH_Lock();
return res;
}
uint32_t word_data;
HAL_StatusTypeDef FLASH_Write_Page(uint32_t *Address, uint8_t *Data, int Data_size)
{
//GPIOB->ODR^=(0x2000);
// GPIOB->ODR|=0x4000;
HAL_StatusTypeDef res;
int data_cnt = 0;
uint32_t adr;
res = HAL_FLASH_Unlock();
if (res != HAL_OK) return res;
for (adr = *Address; adr < *Address + Data_size; adr = adr+4)
{
word_data = (
Data[data_cnt]|
Data[data_cnt+1]<<8|
Data[data_cnt+2]<<16|
Data[data_cnt+3]<<24);
res = HAL_FLASH_Program(FLASH_TYPEPROGRAM_WORD, adr, word_data);
if (res != HAL_OK) return res;
data_cnt +=4;
}
*Address += Data_size;
res = HAL_FLASH_Lock();
return res;
}
HAL_StatusTypeDef FLASH_Erase_App(void) //
{
HAL_StatusTypeDef res;
uint32_t PageError = 0x00;
res = HAL_FLASH_Unlock();
if (res != HAL_OK) return res;
EraseInitStruct.TypeErase = FLASH_TYPEERASE_PAGES;// erase pages
EraseInitStruct.Banks = 1;
EraseInitStruct.PageAddress = MAIN_APP_START_ADR; //address
EraseInitStruct.NbPages = MAIN_APP_NUM_OF_PAGE;// num of erased pages
res = HAL_FLASHEx_Erase(&EraseInitStruct, &PageError);
if (res != HAL_OK) return res;
res = HAL_FLASH_Lock();
return res;
}

View File

@ -0,0 +1,105 @@
#include "custom_receive_and_write.h"
extern UART_HandleTypeDef huart3;
struct flags flags_UART_FATFS;
extern FIL SDFile;
uint8_t bytescnt;
char Char_Shift = 0x41;
FIL MFile;
uint8_t Message[sizebuff] = "";
uint8_t path_uart[5] = "A.txt";
//void MountSD(void)
//{
// if((f_mount(&SDFatFS, (TCHAR const*)SDPath, MOUNT)) ==FR_OK)
// {
// for (int i=0;i<5;i++)
// {
// GPIOB->ODR^=1<<14;
// HAL_Delay(500);
// }
// GPIOB->ODR&=~(1<<14); \
// }
//}
FRESULT CreateAndOpenMessageFile(FIL *MessageFile, const TCHAR* Path)
{
return f_open(MessageFile, Path, FA_WRITE | FA_CREATE_ALWAYS);
}
FRESULT OpenMessageFile(FIL *MessageFile, const TCHAR* Path)
{
return f_open(MessageFile, Path, FA_READ);
}
FRESULT WriteMessage(FIL *MessageFile, char *Message, UINT SizeOfMessage)
{
FRESULT ResultOfOperation;
uint32_t WrittenBytes;
ResultOfOperation = f_lseek(MessageFile,f_size(MessageFile));
ResultOfOperation = f_write(MessageFile, Message, SizeOfMessage, &WrittenBytes);
if (WrittenBytes!=SizeOfMessage) return FR_INVALID_PARAMETER;
//GPIOB->ODR^=0xf000;
return ResultOfOperation;
}
FRESULT CloseMessageFile(FIL *MessageFile)
{
return f_close(MessageFile);
}
void WriteFile(char *Data, int Num_of_Data)
{
static int FileOpen = 0;
OpenMessageFile(&MFile, (const TCHAR*)path_uart);
WriteMessage(&MFile, Data, Num_of_Data);
CloseMessageFile(&MFile);
// Char_Shift++;
// path_uart[0] = (char)Char_Shift;
}
void Check_USART(void)
{
uint8_t res;
static FIL MessageFile;
if (flags_UART_FATFS.writting==0)
{ switch((int)Message[0])
{
case 1:
flags_UART_FATFS.writting = 1;
Message[bytescnt] = '\0';
res = CreateAndOpenMessageFile(&MessageFile, (const TCHAR*)(Message+1));
break;
case 2:
flags_UART_FATFS.writting = 1;
res = OpenMessageFile(&MessageFile, (const TCHAR*)path_uart);
break;
}
}
else
{
if (Message[0] == 0x03)
{
flags_UART_FATFS.writting = 0;
res = CloseMessageFile(&MessageFile);
}
else
{
res = WriteMessage(&MessageFile, (char *)Message, bytescnt);
}
}
HAL_UART_AbortReceive_IT(&huart3);
HAL_UART_Receive_IT(&huart3, Message, sizeof(Message));
bytescnt = 0;
for(int i = 0; i<sizebuff; i++)
{
Message[i] = 0x00;
}
}

125
Core/Src/custom_usart.c Normal file
View File

@ -0,0 +1,125 @@
#ifndef _CUSTOM_USART_
#define _CUSTOM_USART_
#include "custom_usart.h"
UART_HandleTypeDef huart_boot;
DMA_HandleTypeDef hdma_usart_boot_rx;
// CUSTOM UART INIT
// DMA INIT (RCC, NVIC) SHOULD BE ADDED IN DMA.C
void User_UART_Init(UART_HandleTypeDef* huart, DMA_HandleTypeDef *DMAhuart, struct UARTSettings *uuart)
{ // function takes uart handler, dma handler and setting structure for init
// get setting for uart from UARTSettings structure
huart->Instance = uuart->UARTx;
huart->Init.BaudRate = uuart->UART_Speed;
// everything else is default (for now, maybe this settings would be added in UARTSettings structure later)
huart->Init.WordLength = UART_WORDLENGTH_8B;
huart->Init.StopBits = UART_STOPBITS_1;
huart->Init.Parity = UART_PARITY_NONE;
huart->Init.Mode = UART_MODE_TX_RX;
huart->Init.HwFlowCtl = UART_HWCONTROL_NONE;
huart->Init.OverSampling = UART_OVERSAMPLING_16;
if (HAL_UART_Init(huart) != HAL_OK)
{
Error_Handler();
}
// init gpio from UARTSettings structure
UART_GPIO_Init(uuart->GPIOx, uuart->GPIO_PIN_RX, uuart->GPIO_PIN_TX);
// init dma from UARTSettings structure if need
if (uuart->DMAChannel != 0)
UART_DMA_Init(huart, DMAhuart, uuart->DMAChannel);
}
void UART_GPIO_Init(GPIO_TypeDef *GPIOx, uint16_t GPIO_PIN_RX, uint16_t GPIO_PIN_TX)
{ // function takes port and pins (for rx and tx)
GPIO_InitTypeDef GPIO_InitStruct = {0};
// choose port for enable clock
if (GPIOx==GPIOA)
__HAL_RCC_GPIOA_CLK_ENABLE();
else if (GPIOx==GPIOB)
__HAL_RCC_GPIOB_CLK_ENABLE();
else if (GPIOx==GPIOC)
__HAL_RCC_GPIOC_CLK_ENABLE();
else if (GPIOx==GPIOD)
__HAL_RCC_GPIOD_CLK_ENABLE();
// USART3 GPIO Configuration
//GPIO_PIN_TX ------> USART_TX
GPIO_InitStruct.Pin = GPIO_PIN_TX;
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH;
HAL_GPIO_Init(GPIOx, &GPIO_InitStruct);
// GPIO_PIN_RX ------> USART_RX
GPIO_InitStruct.Pin = GPIO_PIN_RX;
GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
GPIO_InitStruct.Pull = GPIO_NOPULL;
HAL_GPIO_Init(GPIOx, &GPIO_InitStruct);
}
void UART_DMA_Init(UART_HandleTypeDef *huart, DMA_HandleTypeDef *hdma_rx, DMA_Channel_TypeDef *DMAhuart)
{ // function takes uart and dma handlers and dmachannel for uart
// for now only dma rx is supported, tx maybe later if needed
/* USART3 DMA Init */
/* USART3_RX Init */
hdma_rx->Instance = DMAhuart;
hdma_rx->Init.Direction = DMA_PERIPH_TO_MEMORY;
hdma_rx->Init.PeriphInc = DMA_PINC_DISABLE;
hdma_rx->Init.MemInc = DMA_MINC_ENABLE;
hdma_rx->Init.PeriphDataAlignment = DMA_PDATAALIGN_BYTE;
hdma_rx->Init.MemDataAlignment = DMA_MDATAALIGN_BYTE;
hdma_rx->Init.Mode = DMA_CIRCULAR;
hdma_rx->Init.Priority = DMA_PRIORITY_LOW;
if (HAL_DMA_Init(hdma_rx) != HAL_OK)
{
Error_Handler();
}
__USER_LINKDMA(huart,hdmarx,hdma_rx);
// __USER_LINKDMA is need because __HAL_LINKDMA is written for global defined hdma_rx
// so you get error because hal uses . insted of ->
}
void HAL_UART_MspInit(UART_HandleTypeDef* huart) // redefine hal function
{ // left only rcc and interrupt init for USART_1,2,3 (maybe UART_4,5 need to be added)
// GPIO and DMA init was move to their own functions
if(huart->Instance==USART3)
{
/* USART3 clock enable */
__HAL_RCC_USART3_CLK_ENABLE();
/* USART3 interrupt Init */
HAL_NVIC_SetPriority(USART3_IRQn, 0, 0);
HAL_NVIC_EnableIRQ(USART3_IRQn);
}
else if(huart->Instance==USART2)
{
/* USART3 clock enable */
__HAL_RCC_USART2_CLK_ENABLE();
/* USART3 interrupt Init */
HAL_NVIC_SetPriority(USART2_IRQn, 0, 0);
HAL_NVIC_EnableIRQ(USART2_IRQn);
}
else if(huart->Instance==USART1)
{
/* USART3 clock enable */
__HAL_RCC_USART1_CLK_ENABLE();
/* USART3 interrupt Init */
HAL_NVIC_SetPriority(USART1_IRQn, 0, 0);
HAL_NVIC_EnableIRQ(USART1_IRQn);
}
}
#endif

View File

@ -23,13 +23,14 @@
/* Private includes ----------------------------------------------------------*/
/* USER CODE BEGIN Includes */
#include "custom_flash.h"
#include "gpio.h"
//#include "bootloader.h"
/* USER CODE END Includes */
/* Private typedef -----------------------------------------------------------*/
/* USER CODE BEGIN PTD */
int friman=0;
/* USER CODE END PTD */
/* Private define ------------------------------------------------------------*/
@ -56,7 +57,19 @@
/* Private user code ---------------------------------------------------------*/
/* USER CODE BEGIN 0 */
//uint32_t programBytes2Read;
//uint32_t programBytesCounter;
//uint32_t currentAddress;
//UINT readBytes;
//FRESULT result;
//extern uint8_t ReceiveDataUART[4];
//extern uint8_t Data2Write[PAGE_SIZE*2];
//extern struct flag FLAGS;
//uint8_t *FLASH_Read(uint32_t add)
//{
// return (uint8_t *)add;
//}
/* USER CODE END 0 */
/**

View File

@ -13,10 +13,6 @@ struct data Data;
struct controlflags ControlFlags;
struct received_request ReceivedRequest;
uint8_t CurrentStep = 0;
uint8_t LastStep = 0;
struct RXMsg rxMsg[CAN_RX_BUFFER_SIZE];
#define MAX_NUM_OF_DEVICES_PER_LINE 4
#define MAX_NUM_OF_REGISTERS_IN_DEVICE 255
@ -30,11 +26,6 @@ _Bool IsLeapYear(uint8_t year)
return (year%400==0)||((year%4==0)&&(year%100!=0));
}
uint16_t AvailableCanRxMsg(void)
{
return ((uint16_t)(CAN_RX_BUFFER_SIZE + LastStep - CurrentStep))%CAN_RX_BUFFER_SIZE;
}
/**
* @brief Инициализация переферии
* @details Инициализация HAL, CAN, TIM7, RTC.
@ -44,9 +35,9 @@ void REQUESTER_Init(void)
{
HAL_Init();
MX_CAN_Init();
HAL_CAN_Start(&_HCAN);
HAL_CAN_Start(&hcan);
REQUESTER_CAN_FILTERS();
HAL_CAN_ActivateNotification(&_HCAN, CAN_IT_RX_FIFO0_MSG_PENDING);
HAL_CAN_ActivateNotification(&hcan, CAN_IT_RX_FIFO0_MSG_PENDING);
ControlFlags.IsPulse = 1;
MX_TIM7_Init();
MX_RTC_Init();
@ -86,59 +77,45 @@ void REQUESTER_MainWhile(void)
CAN_TxHeaderTypeDef TxHeader;
uint32_t TxMailBox = 0;
uint8_t data[8];
extID eID;
eID.BitAll = 0;
eID.StandardFields.DeviceID = 2;
eID.StandardFields.DataType = DATA_TYPE_ANALOG;
eID.StandardFields.SensorType = 0x1F;
eID.StandardFields.SensorID = 0;
eID.StandardFields.Route = ROUTE_SLAVE;
TxHeader.IDE = CAN_ID_EXT;
union ext_ID eID;
eID.Fields.DeviceID = 16;
eID.Fields.DataType = DATA_TYPE_ANALOG;
eID.Fields.SensorType = 0x1F;
eID.Fields.SensorID = 0;
eID.Fields.Route = ROUTE_SLAVE;
TxHeader.TransmitGlobalTime = DISABLE;
TxHeader.RTR = CAN_RTR_DATA;
TxHeader.ExtId = eID.BitAll;
int TxTest = 0;
HAL_TIM_Base_Start_IT(&htim7);
while(1)
{
if(AvailableCanRxMsg())
if(ReceivedRequest.AnalogFlags.AllFlags)
{
if(rxMsg[CurrentStep].eID.StandardFields.DataType == DATA_TYPE_ANALOG)
REQUESTER_AnalogProcessing();
}
if(ReceivedRequest.BroadcastFlags.AllFlags)
{
REQUESTER_AnalogProcessing(rxMsg[CurrentStep]);
REQUESTER_BroadcastProcessing();
}
else if(rxMsg[CurrentStep].eID.StandardFields.DataType == DATA_TYPE_BROADCAST)
if(ReceivedRequest.DiscreticFlags.AllFlags)
{
REQUESTER_BroadcastProcessing(rxMsg[CurrentStep]);
REQUESTER_DiscreticProcessing();
}
else if(rxMsg[CurrentStep].eID.StandardFields.DataType == DATA_TYPE_DISCRETE)
if(ReceivedRequest.ModbusFlags.AllFlags)
{
REQUESTER_DiscreticProcessing(rxMsg[CurrentStep]);
REQUESTER_ModbusProcessing();
}
else if(rxMsg[CurrentStep].eID.StandardFields.DataType == DATA_TYPE_MODBUS_COIL ||
rxMsg[CurrentStep].eID.StandardFields.DataType == DATA_TYPE_MODBUS_DISCRETE ||
rxMsg[CurrentStep].eID.StandardFields.DataType == DATA_TYPE_MODBUS_HOLDING ||
rxMsg[CurrentStep].eID.StandardFields.DataType == DATA_TYPE_MODBUS_INPUT)
{
REQUESTER_ModbusProcessing(rxMsg[CurrentStep]);
}
CurrentStep = (uint16_t)(CurrentStep + 1) % CAN_RX_BUFFER_SIZE;
}
/*
while(HAL_CAN_GetTxMailboxesFreeLevel(&hcan) == 0);
TxHeader.ExtId = eID.BitAll;
if(HAL_CAN_AddTxMessage(&hcan, &TxHeader, data, &TxMailBox)!= HAL_OK)
{
ProverkaArbitors++;
}
*/
// eID.Fields.SensorID++;
// if(eID.Fields.SensorID>10)
//{
// eID.Fields.SensorID = 0;
// }
eID.Fields.SensorID++;
if(eID.Fields.SensorID>100)
{
eID.Fields.SensorID = 0;
}
}
}
@ -146,98 +123,29 @@ void REQUESTER_MainWhile(void)
* @brief Функция обработки аналоговых запросов.
* @details Функция, формирующая и отправляющая ответ на запросы. Типы запросов: Универсальный, Уставки, Напряжение, Ток, Температура
*/
void REQUESTER_AnalogProcessing(struct RXMsg _rxMsg)
{
switch (_rxMsg.eID.StandardFields.SensorType)
{
case SENSOR_TYPE_ANALOG_UNIVERSAL:
{
CanRequestToAnalogUniversal(_rxMsg);
break;
}
case SENSOR_TYPE_ANALOG_USTAVKI:
{
CanRequestToAnalogUSTAVKI(_rxMsg);
break;
}
case SENSOR_TYPE_ANALOG_U:
{
CanRequestToAnalogUSens(_rxMsg);
break;
}
case SENSOR_TYPE_ANALOG_I:
{
CanRequestToAnalogISens(_rxMsg);
break;
}
case SENSOR_TYPE_ANALOG_T:
{
CanRequestToAnalogTSens(_rxMsg);
break;
}
default:
//RESERVE SENSOR TYPE
break;
}
}
__weak HAL_StatusTypeDef CanRequestToAnalogUniversal(struct RXMsg _rxMsg)
void REQUESTER_AnalogProcessing()
{
CAN_TxHeaderTypeDef TxHeader;
uint32_t TxMailBox = 0;
uint8_t data[8];
TxHeader.IDE = CAN_ID_EXT;
TxHeader.TransmitGlobalTime = DISABLE;
TxHeader.RTR = CAN_RTR_DATA;
extID tmp_eID;
tmp_eID.BitAll = _rxMsg.eID.BitAll;
tmp_eID.StandardFields.Route = ROUTE_SLAVE;
TxHeader.ExtId = tmp_eID.BitAll;
TxHeader.DLC = 6;
data[0] = 'U';
data[1] = 'N';
data[2] = 'I';
data[3] = 'V';
data[4] = 'E';
data[5] = 'R';
return HAL_CAN_AddTxMessage(&_HCAN, &TxHeader, data, &TxMailBox);
}
__weak HAL_StatusTypeDef CanRequestToAnalogUSTAVKI(struct RXMsg _rxMsg)
if(ReceivedRequest.AnalogFlags.AnalogType.Request_Universal_Sens)
{
CAN_TxHeaderTypeDef TxHeader;
uint32_t TxMailBox = 0;
uint8_t data[8];
TxHeader.IDE = CAN_ID_EXT;
TxHeader.TransmitGlobalTime = DISABLE;
TxHeader.RTR = CAN_RTR_DATA;
extID tmp_eID;
tmp_eID.BitAll = _rxMsg.eID.BitAll;
tmp_eID.StandardFields.Route = ROUTE_SLAVE;
TxHeader.ExtId = tmp_eID.BitAll;
TxHeader.DLC = 7;
data[0] = 'U';
data[1] = 'S';
data[2] = 'T';
data[3] = 'A';
data[4] = 'V';
data[5] = 'K';
data[6] = 'I';
return HAL_CAN_AddTxMessage(&_HCAN, &TxHeader, data, &TxMailBox);
ReceivedRequest.AnalogFlags.AnalogType.Request_Universal_Sens = 0;
}
__weak HAL_StatusTypeDef CanRequestToAnalogUSens(struct RXMsg _rxMsg)
if(ReceivedRequest.AnalogFlags.AnalogType.Request_U_Sens)
{
CAN_TxHeaderTypeDef TxHeader;
uint32_t TxMailBox = 0;
uint8_t data[8];
//Запрос на данные датчика напряжения.
//В дальнейшем реализовать отправку настоящих данных.
//А пока - тестовое сообщение, нужное для отладки.
//Расширенный ID
TxHeader.IDE=CAN_ID_EXT;
TxHeader.TransmitGlobalTime = DISABLE;
TxHeader.RTR = CAN_RTR_DATA;
extID tmp_eID;
tmp_eID.BitAll = _rxMsg.eID.BitAll;
tmp_eID.StandardFields.Route = ROUTE_SLAVE;
TxHeader.ExtId = tmp_eID.BitAll;
//Ответ на запрос осуществляется по тому-же ID,
//с которым был отправлен запрос.
union ext_ID eID;
eID.BitAll = ReceivedRequest.RequestedExtID.BitAll;
eID.Fields.Route = ROUTE_SLAVE;
TxHeader.ExtId = eID.BitAll;
//Выставляется количество передаваемых байтов. (Макс. 8)
TxHeader.DLC = 6;
data[0] = 'U';
data[1] = ' ';
@ -245,21 +153,16 @@ __weak HAL_StatusTypeDef CanRequestToAnalogUSens(struct RXMsg _rxMsg)
data[3] = 'e';
data[4] = 'n';
data[5] = 's';
return HAL_CAN_AddTxMessage(&_HCAN, &TxHeader, data, &TxMailBox);
HAL_CAN_AddTxMessage(&hcan, &TxHeader, data, &TxMailBox);
ReceivedRequest.AnalogFlags.AnalogType.Request_U_Sens=0;
}
__weak HAL_StatusTypeDef CanRequestToAnalogISens(struct RXMsg _rxMsg)
if(ReceivedRequest.AnalogFlags.AnalogType.Request_I_Sens)
{
CAN_TxHeaderTypeDef TxHeader;
uint32_t TxMailBox = 0;
uint8_t data[8];
TxHeader.IDE=CAN_ID_EXT;
TxHeader.TransmitGlobalTime = DISABLE;
TxHeader.RTR = CAN_RTR_DATA;
extID tmp_eID;
tmp_eID.BitAll = _rxMsg.eID.BitAll;
tmp_eID.StandardFields.Route = ROUTE_SLAVE;
TxHeader.ExtId = tmp_eID.BitAll;
union ext_ID eID;
eID.BitAll = ReceivedRequest.RequestedExtID.BitAll;
eID.Fields.Route = ROUTE_SLAVE;
TxHeader.ExtId = eID.BitAll;
TxHeader.DLC = 6;
data[0] = 'I';
data[1] = ' ';
@ -267,21 +170,16 @@ __weak HAL_StatusTypeDef CanRequestToAnalogISens(struct RXMsg _rxMsg)
data[3] = 'e';
data[4] = 'n';
data[5] = 's';
return HAL_CAN_AddTxMessage(&_HCAN, &TxHeader, data, &TxMailBox);
HAL_CAN_AddTxMessage(&hcan, &TxHeader, data, &TxMailBox);
ReceivedRequest.AnalogFlags.AnalogType.Request_I_Sens=0;
}
__weak HAL_StatusTypeDef CanRequestToAnalogTSens(struct RXMsg _rxMsg)
if(ReceivedRequest.AnalogFlags.AnalogType.Request_T_Sens)
{
CAN_TxHeaderTypeDef TxHeader;
uint32_t TxMailBox = 0;
uint8_t data[8];
TxHeader.IDE=CAN_ID_EXT;
TxHeader.TransmitGlobalTime = DISABLE;
TxHeader.RTR = CAN_RTR_DATA;
extID tmp_eID;
tmp_eID.BitAll = _rxMsg.eID.BitAll;
tmp_eID.StandardFields.Route = ROUTE_SLAVE;
TxHeader.ExtId = tmp_eID.BitAll;
union ext_ID eID;
eID.BitAll = ReceivedRequest.RequestedExtID.BitAll;
eID.Fields.Route = ROUTE_SLAVE;
TxHeader.ExtId = eID.BitAll;
TxHeader.DLC = 6;
data[0] = 'T';
data[1] = ' ';
@ -289,107 +187,28 @@ __weak HAL_StatusTypeDef CanRequestToAnalogTSens(struct RXMsg _rxMsg)
data[3] = 'e';
data[4] = 'n';
data[5] = 's';
return HAL_CAN_AddTxMessage(&_HCAN, &TxHeader, data, &TxMailBox);
HAL_CAN_AddTxMessage(&hcan, &TxHeader, data, &TxMailBox);
ReceivedRequest.AnalogFlags.AnalogType.Request_T_Sens=0;
}
}
/**
* @brief Функция обработки широковещательных запросов.
* @details Функция, выполняющая команды, переданные в широковещательном формате с головного (master) устройства. Типы команд: Запрос статуса, запрос на включение или выключение, рестарт устройств, установка времени.
*/
void REQUESTER_BroadcastProcessing(struct RXMsg _rxMsg)
void REQUESTER_BroadcastProcessing()
{
switch(_rxMsg.eID.StandardFields.SensorType)
{
case SENSOR_TYPE_BROADCAST_STATUS:
{
//Обработка запроса статуса устройства
CanRequestToBroadcastStatus(_rxMsg);
break;
}
case SENSOR_TYPE_BROADCAST_ONOFF:
if(ReceivedRequest.BroadcastFlags.BroadcastType.Request_OnOff)
{
//Обработка запроса на вкл/выкл
CanRequestToBroadcastOnOff(_rxMsg);
break;
ControlFlags.IsPulse = !ControlFlags.IsPulse;
ReceivedRequest.BroadcastFlags.BroadcastType.Request_OnOff = 0;
}
case SENSOR_TYPE_BROADCAST_RESTARTDEVICE:
{
CanRequestToBroadcastRestart(_rxMsg);
break;
}
case SENSOR_TYPE_BROADCAST_RTCSETUP:
if(ReceivedRequest.BroadcastFlags.BroadcastType.Request_RTC_Setup)
{
//Обработка запроса на синхронизацию времени
//С головным устройством
CanRequestToBroadcastRtcSetup(_rxMsg);
break;;
}
default:
//RESERVE SENSOR TYPE.
break;
}
}
__weak HAL_StatusTypeDef CanRequestToBroadcastStatus(struct RXMsg _rxMsg)
{
CAN_TxHeaderTypeDef TxHeader;
uint32_t TxMailBox = 0;
uint8_t data[8];
TxHeader.IDE = CAN_ID_EXT;
TxHeader.DLC = 7;
TxHeader.TransmitGlobalTime = DISABLE;
TxHeader.RTR = CAN_RTR_DATA;
extID tmp_eID;
tmp_eID.BitAll = _rxMsg.eID.BitAll;
tmp_eID.StandardFields.Route = ROUTE_SLAVE;
tmp_eID.StandardFields.DeviceID = CURRENT_ID_DEVICE;
TxHeader.ExtId = tmp_eID.BitAll;
RTC_TimeTypeDef sTime = {0};
HAL_RTC_GetTime(&hrtc, &sTime, RTC_FORMAT_BIN);
data[0] = sTime.Hours;
data[1] = sTime.Minutes;
data[2] = sTime.Seconds;
RTC_DateTypeDef DateToUpdate = {0};
HAL_RTC_GetDate(&hrtc, &DateToUpdate, RTC_FORMAT_BIN);
data[3] = DateToUpdate.Year;
data[4] = DateToUpdate.Month;
data[5] = DateToUpdate.Date;
data[6] = DateToUpdate.WeekDay;
return HAL_CAN_AddTxMessage(&_HCAN, &TxHeader, data, &TxMailBox);
}
__weak void CanRequestToBroadcastOnOff(struct RXMsg _rxMsg)
{
ControlFlags.IsPulse = !ControlFlags.IsPulse;
}
__weak void CanRequestToBroadcastRestart(struct RXMsg _rxMsg)
{
if(_rxMsg.DLC == 0)
{
return;
}
if(_rxMsg.eID.StandardFields.SensorID == (CURRENT_ID_DEVICE / (_rxMsg.DLC*8)))
{
uint64_t page = 0;
for(int i = 0; i < _rxMsg.DLC; i++)
{
page+=(_rxMsg.Data[i]<<(i*8));
}
if((page>>CURRENT_ID_DEVICE)&0b1)
{
NVIC_SystemReset();
}
}
return;
}
__weak void CanRequestToBroadcastRtcSetup(struct RXMsg _rxMsg)
{
if(_rxMsg.DLC > 7)
if(ReceivedRequest.RequestedDLC > 7)
{
//ERROR
}
@ -397,21 +216,52 @@ __weak void CanRequestToBroadcastRtcSetup(struct RXMsg _rxMsg)
{
int DaysCount_Normal[2][12] = {{31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31},
{31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}};
if (_rxMsg.Data[0]>23 ||
_rxMsg.Data[1]>59 ||
_rxMsg.Data[2]>59 ||
_rxMsg.Data[3]>99 ||
_rxMsg.Data[4]>12 ||
_rxMsg.Data[5] > DaysCount_Normal[IsLeapYear(_rxMsg.Data[3])][_rxMsg.Data[4]] ||
_rxMsg.Data[6]>6)
if (ReceivedRequest.RxData[0]>23 ||
ReceivedRequest.RxData[1]>59 ||
ReceivedRequest.RxData[2]>59 ||
ReceivedRequest.RxData[3]>99 ||
ReceivedRequest.RxData[4]>12 ||
ReceivedRequest.RxData[5] > DaysCount_Normal[IsLeapYear(ReceivedRequest.RxData[3])][ReceivedRequest.RxData[4]] ||
ReceivedRequest.RxData[6]>6)
{
//ERROR
}
else
{
REQUESTER_RTC_SYNC(_rxMsg.Data);
REQUESTER_RTC_SYNC(ReceivedRequest.RxData);
}
}
ReceivedRequest.BroadcastFlags.BroadcastType.Request_RTC_Setup = 0;
}
if(ReceivedRequest.BroadcastFlags.BroadcastType.Request_Status)
{
//Обработка запроса статуса устройства
RTC_TimeTypeDef sTime = {0};
RTC_DateTypeDef DateToUpdate = {0};
HAL_RTC_GetTime(&hrtc, &sTime, RTC_FORMAT_BIN);
CAN_TxHeaderTypeDef TxHeader;
uint32_t TxMailBox = 0;
uint8_t data[8];
TxHeader.IDE=CAN_ID_EXT;
union ext_ID eID;
eID.BitAll = ReceivedRequest.RequestedExtID.BitAll;
eID.Fields.Route = ROUTE_SLAVE;
TxHeader.ExtId = eID.BitAll;
TxHeader.DLC = 7;
data[0] = sTime.Hours;
data[1] = sTime.Minutes;
data[2] = sTime.Seconds;
HAL_RTC_GetDate(&hrtc, &DateToUpdate, RTC_FORMAT_BIN);
data[3] = DateToUpdate.Year;
data[4] = DateToUpdate.Month;
data[5] = DateToUpdate.Date;
data[6] = DateToUpdate.WeekDay;
HAL_CAN_AddTxMessage(&hcan, &TxHeader, data, &TxMailBox);
ReceivedRequest.AnalogFlags.AnalogType.Request_T_Sens=0;
ReceivedRequest.BroadcastFlags.BroadcastType.Request_Status = 0;
}
}
/**
@ -419,136 +269,51 @@ __weak void CanRequestToBroadcastRtcSetup(struct RXMsg _rxMsg)
* @details Функция, формирующая и отправляющая ответ на запросы. Типы запросов: Аварии, Предупреждения, Управляющие сигналы, Флаги, Рестарт устройства, Изменение режима работы устройства, Запрос на устройство.
* @note Запрос на устройство. Головное (master) устройство запрашивает некоторое колличество параметров. В Data - 64 битовых адресса параметров, тип которых задаётся в Sensor ID. Имеется возможность запрашивать непоследовательные параметры.
*/
void REQUESTER_DiscreticProcessing(struct RXMsg _rxMsg)
void REQUESTER_DiscreticProcessing()
{
switch(_rxMsg.eID.StandardFields.SensorType){
case SENSOR_TYPE_DISCRETE_ACCIDENT:
if(ReceivedRequest.DiscreticFlags.DiscreticType.Request_Accident)
{
CanRequestToDiscreteAccident(_rxMsg);
break;
ReceivedRequest.DiscreticFlags.DiscreticType.Request_Accident = 0;
}
case SENSOR_TYPE_DISCRETE_WARNING:
if(ReceivedRequest.DiscreticFlags.DiscreticType.Request_Control_Signals)
{
CanRequestToDiscreteWarning(_rxMsg);
break;
ReceivedRequest.DiscreticFlags.DiscreticType.Request_Control_Signals = 0;
}
case SENSOR_TYPE_DISCRETE_CONTROL_SIGNALS:
if(ReceivedRequest.DiscreticFlags.DiscreticType.Request_Flags)
{
CanRequestToDiscreteControlSignals(_rxMsg);
break;
ReceivedRequest.DiscreticFlags.DiscreticType.Request_Flags = 0;
}
case SENSOR_TYPE_DISCRETE_FLAGS:
if(ReceivedRequest.DiscreticFlags.DiscreticType.Request_Warning)
{
CanRequestToDiscreteFlags(_rxMsg);
break;
ReceivedRequest.DiscreticFlags.DiscreticType.Request_Warning = 0;
}
case SENSOR_TYPE_DISCRETE_RESET:
{
CanRequestToDiscreteReset(_rxMsg);
break;
}
case SENSOR_TYPE_DISCRETE_CHANGE_MODE:
{
CanRequestToDiscreteChangeMode(_rxMsg);
break;
}
case SENSOR_TYPE_DISCRETE_REQUEST_LIST_OF_PARAMETERS:
{
CanRequestToDiscreteRequestListOfParameters(_rxMsg);
break;
}
default:
//RESERVE SENSOR TYPE.
break;
}
}
__weak void CanRequestToDiscreteAccident(struct RXMsg _rxMsg)
{
return;
}
__weak void CanRequestToDiscreteWarning(struct RXMsg _rxMsg)
{
return;
}
__weak void CanRequestToDiscreteControlSignals(struct RXMsg _rxMsg)
{
return;
}
__weak void CanRequestToDiscreteFlags(struct RXMsg _rxMsg)
{
return;
}
__weak void CanRequestToDiscreteReset(struct RXMsg _rxMsg)
if(ReceivedRequest.DiscreticFlags.DiscreticType.Request_Reset)
{
ReceivedRequest.DiscreticFlags.DiscreticType.Request_Reset = 0;
NVIC_SystemReset();
}
__weak void CanRequestToDiscreteChangeMode(struct RXMsg _rxMsg)
if(ReceivedRequest.DiscreticFlags.DiscreticType.Request_List_of_Parameters)
{
return;
ReceivedRequest.DiscreticFlags.DiscreticType.Request_List_of_Parameters = 0;
for(int Current_byte = 0; Current_byte < 8; Current_byte++)
{
for(int Current_bit = 0; Current_bit < 8; Current_bit++)
{
if((ReceivedRequest.RxData[Current_byte]>>Current_bit)&0b1)
{
_GET_MODBUS_ADR(ReceivedRequest.RequestedExtID.Fields.SensorID, Current_byte, Current_bit);
}
}
}
}
__weak void CanRequestToDiscreteRequestListOfParameters(struct RXMsg _rxMsg)
{
return;
}
/**
* @brief Функция обработки Modbus запросов.
* @details Функция, формирующая и отправляющая ответ на запросы.
*/
void REQUESTER_ModbusProcessing(struct RXMsg _rxMsg)
void REQUESTER_ModbusProcessing()
{
switch(_rxMsg.eID.ModbusFields.DataType)
{
case DATA_TYPE_MODBUS_COIL:
{
CanRequestToModbusCoil(_rxMsg);
break;
}
case DATA_TYPE_MODBUS_DISCRETE:
{
CanRequestToModbusDiscrete(_rxMsg);
break;
}
case DATA_TYPE_MODBUS_HOLDING:
{
CanRequestToModbusHolding(_rxMsg);
break;
}
case DATA_TYPE_MODBUS_INPUT:
{
CanRequestToModbusInput(_rxMsg);
break;
}
default:
//ERROR
break;
}
}
__weak void CanRequestToModbusCoil(struct RXMsg _rxMsg)
{
return;
}
__weak void CanRequestToModbusDiscrete(struct RXMsg _rxMsg)
{
return;
}
__weak void CanRequestToModbusHolding(struct RXMsg _rxMsg)
{
return;
}
__weak void CanRequestToModbusInput(struct RXMsg _rxMsg)
{
return;
}
/* СТАРЫЙ УЖАСНЫЙ МОДБАС
if((ReceivedRequest.SensorToModbus.Modbus.StrAdr>=0) && (ReceivedRequest.SensorToModbus.Modbus.StrAdr<=127))
{
//Обращение к существующему в устройстве модбас регистру
@ -567,11 +332,11 @@ __weak void CanRequestToModbusInput(struct RXMsg _rxMsg)
)
{
TxHeader.DLC = 0;
extID eID;
union ext_ID eID;
eID.BitAll = ReceivedRequest.RequestedExtID.BitAll;
eID.StandardFields.Route = ROUTE_SLAVE;
eID.StandardFields.SensorType = RequestFromDLC>>11;
eID.StandardFields.SensorID = RequestFromDLC;
eID.Fields.Route = ROUTE_SLAVE;
eID.Fields.SensorType = RequestFromDLC>>11;
eID.Fields.SensorID = RequestFromDLC;
TxHeader.ExtId = eID.BitAll;
for(int DataFor = 0; DataFor < 8; DataFor+=2)
{
@ -588,17 +353,16 @@ __weak void CanRequestToModbusInput(struct RXMsg _rxMsg)
while(HAL_CAN_GetTxMailboxesFreeLevel(&hcan) == 0);
HAL_CAN_AddTxMessage(&hcan, &TxHeader, data, &TxMailBox);
}
extID emID;
emID.BitAll = 0;
emID.ModbusFields.DeviceID = CURRENT_ID_DEVICE;
emID.ModbusFields.DataType = DATA_TYPE_ERROR;
emID.ModbusFields.CountReg = NONEXISTENT_ELEMENT;
emID.ModbusFields.Route = ROUTE_SLAVE;
union ext_ID_Modbus extID;
extID.Fields.DeviceID = CURRENT_ID_DEVICE;
extID.Fields.DataType = DATA_TYPE_ERROR;
extID.Fields.CountReg = NONEXISTENT_ELEMENT;
extID.Fields.Route = ROUTE_SLAVE;
TxHeader.DLC = 0;
for(;(RequestFromDLC-ReceivedRequest.SensorToModbus.Modbus.StrAdr)<ReceivedRequest.SensorToModbus.Modbus.Count; RequestFromDLC++)
{
emID.ModbusFields.StrAdr = RequestFromDLC;
TxHeader.ExtId = emID.BitAll;
extID.Fields.StrAdr = RequestFromDLC;
TxHeader.ExtId = extID.BitAll;
while(HAL_CAN_GetTxMailboxesFreeLevel(&hcan) == 0);
HAL_CAN_AddTxMessage(&hcan, &TxHeader, data, &TxMailBox);
}
@ -606,26 +370,8 @@ __weak void CanRequestToModbusInput(struct RXMsg _rxMsg)
return;
}
ReceivedRequest.ModbusFlags.AllFlags = 0;
*/
void TakeRxMsgToBuffer(extID tmp_eID, uint32_t tmp_IDE, uint32_t tmp_RTR, uint32_t tmp_DLC, uint8_t *tmp_DATA, uint16_t tmp_LastStep)
{
rxMsg[tmp_LastStep].eID.BitAll = tmp_eID.BitAll;
rxMsg[tmp_LastStep].info.EXT = tmp_IDE;
rxMsg[tmp_LastStep].info.RTR = tmp_RTR;
rxMsg[tmp_LastStep].DLC = tmp_DLC;
for(int i = 0; i < tmp_DLC; i++)
{
rxMsg[tmp_LastStep].Data[i] = tmp_DATA[i];
}
LastStep = tmp_LastStep;
}
/**
* @brief Callback-Функция обработки приёма.
* @details Функция, сигнализирующая через флаги в бесконечный цикл REQUESTER_MainWhile о приёме запроса.
*/
void HAL_CAN_RxFifo0MsgPendingCallback(CAN_HandleTypeDef *hcan)
{
CAN_RxHeaderTypeDef RxHeader;
@ -634,62 +380,131 @@ void HAL_CAN_RxFifo0MsgPendingCallback(CAN_HandleTypeDef *hcan)
//Расширенный ID
if(RxHeader.IDE == CAN_ID_EXT)
{
uint16_t tmp_LastStep = (uint16_t)(LastStep + 1) % CAN_RX_BUFFER_SIZE;
if(tmp_LastStep == CurrentStep)
{
return;
}
extID ExtID_Of_RX_MSG;
union ext_ID ExtID_Of_RX_MSG;
ExtID_Of_RX_MSG.BitAll = RxHeader.ExtId;
//Полученное сообщение - широковещательное
if (ExtID_Of_RX_MSG.StandardFields.DeviceID == ID_MAIN_DEVICE)
if (ExtID_Of_RX_MSG.Fields.DeviceID == ID_MAIN_DEVICE)
{
if(ExtID_Of_RX_MSG.StandardFields.DataType == DATA_TYPE_BROADCAST)
if(ExtID_Of_RX_MSG.Fields.DataType == DATA_TYPE_BROADCAST)
{
TakeRxMsgToBuffer(ExtID_Of_RX_MSG, RxHeader.IDE, RxHeader.RTR, RxHeader.DLC, RCAN_Data, tmp_LastStep);
switch(ExtID_Of_RX_MSG.Fields.SensorType)
{
case SENSOR_TYPE_STATUS:
ReceivedRequest.BroadcastFlags.BroadcastType.Request_Status = 1;
break;
case SENSOR_TYPE_ONOFF:
ReceivedRequest.BroadcastFlags.BroadcastType.Request_OnOff = 1;
break;
case SENSOR_TYPE_RTCSETUP:
ReceivedRequest.RequestedDLC = RxHeader.DLC;
ReceivedRequest.RxData[0] = RCAN_Data[0];
ReceivedRequest.RxData[1] = RCAN_Data[1];
ReceivedRequest.RxData[2] = RCAN_Data[2];
ReceivedRequest.RxData[3] = RCAN_Data[3];
ReceivedRequest.RxData[4] = RCAN_Data[4];
ReceivedRequest.RxData[5] = RCAN_Data[5];
ReceivedRequest.RxData[6] = RCAN_Data[6];
ReceivedRequest.BroadcastFlags.BroadcastType.Request_RTC_Setup = 1;
break;
default:
break;
}
return;
}
}
//Если ID запроса соответствует ID устройства
if(ExtID_Of_RX_MSG.StandardFields.DeviceID == (CURRENT_ID_DEVICE))
if(ExtID_Of_RX_MSG.Fields.DeviceID == (CURRENT_ID_DEVICE))
{
if(ExtID_Of_RX_MSG.StandardFields.DataType == DATA_TYPE_DISCRETE)
if(ExtID_Of_RX_MSG.Fields.DataType == DATA_TYPE_DISCRETE)
{
TakeRxMsgToBuffer(ExtID_Of_RX_MSG, RxHeader.IDE, RxHeader.RTR, RxHeader.DLC, RCAN_Data, tmp_LastStep);
return;
switch(ExtID_Of_RX_MSG.Fields.SensorType)
{
case SENSOR_TYPE_ACCIDENT:
break;
case SENSOR_TYPE_WARNING:
break;
case SENSOR_TYPE_CONTROL_SIGNALS:
break;
case SENSOR_TYPE_FLAGS:
break;
case SENSOR_TYPE_RESET:
ReceivedRequest.DiscreticFlags.DiscreticType.Request_Reset = 1;
break;
case SENSOR_TYPE_CHANGE_MODE:
ControlFlags.IsRtrMode = !ControlFlags.IsRtrMode;
break;
case SENSOR_TYPE_REQUEST_LIST_OF_PARAMETERS:
ReceivedRequest.DiscreticFlags.DiscreticType.Request_List_of_Parameters = 1;
break;
}
if(ExtID_Of_RX_MSG.StandardFields.DataType == DATA_TYPE_ANALOG)
}
if(ExtID_Of_RX_MSG.Fields.DataType == DATA_TYPE_ANALOG)
{
//Является ли полученное сообщение - запросом
if(RxHeader.RTR)
{
TakeRxMsgToBuffer(ExtID_Of_RX_MSG, RxHeader.IDE, RxHeader.RTR, RxHeader.DLC, RCAN_Data, tmp_LastStep);
return;
}
}
if(ExtID_Of_RX_MSG.StandardFields.DataType == DATA_TYPE_MODBUS_COIL ||
ExtID_Of_RX_MSG.StandardFields.DataType == DATA_TYPE_MODBUS_DISCRETE ||
ExtID_Of_RX_MSG.StandardFields.DataType == DATA_TYPE_MODBUS_HOLDING ||
ExtID_Of_RX_MSG.StandardFields.DataType == DATA_TYPE_MODBUS_INPUT)
ReceivedRequest.RequestedExtID.BitAll = ExtID_Of_RX_MSG.BitAll;
ReceivedRequest.RequestedDLC = RxHeader.DLC;
//Определяется запрашиваемая информация
switch(ExtID_Of_RX_MSG.Fields.SensorType)
{
TakeRxMsgToBuffer(ExtID_Of_RX_MSG, RxHeader.IDE, RxHeader.RTR, RxHeader.DLC, RCAN_Data, tmp_LastStep);
return;
case SENSOR_TYPE_UNIVERSAL:
{
ReceivedRequest.AnalogFlags.AnalogType.Request_Universal_Sens=1;
break;
}
case SENSOR_TYPE_U:
{
ReceivedRequest.AnalogFlags.AnalogType.Request_U_Sens=1;
break;
}
case SENSOR_TYPE_I:
{
ReceivedRequest.AnalogFlags.AnalogType.Request_I_Sens=1;
break;
}
case SENSOR_TYPE_T:
{
ReceivedRequest.AnalogFlags.AnalogType.Request_T_Sens=1;
break;
}
}
}
}
if(ExtID_Of_RX_MSG.Fields.DataType == DATA_TYPE_MODBUS_COIL)
{
ReceivedRequest.RequestedExtID.BitAll = ExtID_Of_RX_MSG.BitAll;
ReceivedRequest.SensorToModbus.Sensor = SensorToModbusRegister(ReceivedRequest.RequestedExtID.Fields.SensorType, ReceivedRequest.RequestedExtID.Fields.SensorID);
ReceivedRequest.ModbusFlags.ModbusType.Coil = 1;
}
if(ExtID_Of_RX_MSG.Fields.DataType == DATA_TYPE_MODBUS_DISCRETE)
{
ReceivedRequest.RequestedExtID.BitAll = ExtID_Of_RX_MSG.BitAll;
ReceivedRequest.SensorToModbus.Sensor = SensorToModbusRegister(ReceivedRequest.RequestedExtID.Fields.SensorType, ReceivedRequest.RequestedExtID.Fields.SensorID);
ReceivedRequest.ModbusFlags.ModbusType.Discrete = 1;
}
if(ExtID_Of_RX_MSG.Fields.DataType == DATA_TYPE_MODBUS_HOLDING)
{
ReceivedRequest.RequestedExtID.BitAll = ExtID_Of_RX_MSG.BitAll;
ReceivedRequest.SensorToModbus.Sensor = SensorToModbusRegister(ReceivedRequest.RequestedExtID.Fields.SensorType, ReceivedRequest.RequestedExtID.Fields.SensorID);
ReceivedRequest.ModbusFlags.ModbusType.Holding = 1;
}
if(ExtID_Of_RX_MSG.Fields.DataType == DATA_TYPE_MODBUS_INPUT)
{
ReceivedRequest.RequestedExtID.BitAll = ExtID_Of_RX_MSG.BitAll;
ReceivedRequest.SensorToModbus.Sensor = SensorToModbusRegister(ReceivedRequest.RequestedExtID.Fields.SensorType, ReceivedRequest.RequestedExtID.Fields.SensorID);
ReceivedRequest.ModbusFlags.ModbusType.Input = 1;
}
}
//Полученное сообщение - пульс устройств в сети
if (ExtID_Of_RX_MSG.StandardFields.DataType == DATA_TYPE_PULSE)
if (ExtID_Of_RX_MSG.Fields.DataType == DATA_TYPE_PULSE)
{
Device_on_the_Network[ExtID_Of_RX_MSG.StandardFields.DeviceID].Status = ONLINE;
Device_on_the_Network[ExtID_Of_RX_MSG.StandardFields.DeviceID].TimeFromLastPulse = 0;
Device_on_the_Network[ExtID_Of_RX_MSG.Fields.DeviceID].Status = ONLINE;
Device_on_the_Network[ExtID_Of_RX_MSG.Fields.DeviceID].TimeFromLastPulse = 0;
}
}
}
/**
* @brief Функция отправки пульса устройства.
* @details Пульс устройства. Есть возможность отключить пульс по запросу.
*/
void REQUESTER_Pulse_TIM_Handler()
{
if(ControlFlags.IsPulse)
@ -697,11 +512,11 @@ void REQUESTER_Pulse_TIM_Handler()
static unsigned PulseStage = 0;
CAN_TxHeaderTypeDef TxHeader;
uint32_t TxMailBox = 0;
extID currentID;
union ext_ID currentID;
currentID.BitAll = 0;
currentID.StandardFields.DeviceID = CURRENT_ID_DEVICE;
currentID.StandardFields.DataType = DATA_TYPE_PULSE;
currentID.StandardFields.Route = ROUTE_SLAVE;
currentID.Fields.DeviceID = CURRENT_ID_DEVICE;
currentID.Fields.DataType = DATA_TYPE_PULSE;
currentID.Fields.Route = ROUTE_SLAVE;
TxHeader.ExtId = currentID.BitAll;
uint8_t data[8];
TxHeader.IDE = CAN_ID_EXT;
@ -713,14 +528,10 @@ void REQUESTER_Pulse_TIM_Handler()
PulseStage = 0;
}
data[0] = PulseStage++;
HAL_CAN_AddTxMessage(&_HCAN, &TxHeader, data, &TxMailBox);
HAL_CAN_AddTxMessage(&hcan, &TxHeader, data, &TxMailBox);
}
}
/**
* @brief Функция установки в RTC полученной даты/время из запроса.
* @param Байтовый массив, 7 элементов. [0] - Часы. [1] - Минуты. [2] - Секунды. [3] - Год. [4] - Месяц. [5] - Дата. [6] - День недели.
*/
void REQUESTER_RTC_SYNC(uint8_t *data)
{
__HAL_RTC_WRITEPROTECTION_DISABLE(&hrtc);
@ -747,10 +558,6 @@ void REQUESTER_RTC_SYNC(uint8_t *data)
__HAL_RTC_WRITEPROTECTION_ENABLE(&hrtc);
}
/**
* @brief Функция настройки фильтров CAN.
* @details Настройка фильтров. Фильр для приёма сообщений с главного устройства. Фильтр для приёма на текущее устройство. Фильтр для приёма пульса других устройств в сети.
*/
void REQUESTER_CAN_FILTERS()
{
//MAIN DEVICE
@ -768,7 +575,7 @@ void REQUESTER_CAN_FILTERS()
canFilterConfig.FilterFIFOAssignment = CAN_RX_FIFO0;
canFilterConfig.FilterActivation = ENABLE;
canFilterConfig.SlaveStartFilterBank = 14;
if(HAL_CAN_ConfigFilter(&_HCAN, &canFilterConfig) != HAL_OK)
if(HAL_CAN_ConfigFilter(&hcan, &canFilterConfig) != HAL_OK)
{
Error_Handler();
}
@ -782,7 +589,7 @@ void REQUESTER_CAN_FILTERS()
/*Маска 1.1111.1110.<...>. Нули - любые символы. Единицы - точное соответствие фильтру выше.*/
canFilterConfig.FilterMaskIdHigh = (uint16_t)(CAN_DEVICE_ID_FILTER>>13);
canFilterConfig.FilterMaskIdLow = (uint16_t)(CAN_DEVICE_ID_FILTER<<3) | CAN_IDE_32;
if(HAL_CAN_ConfigFilter(&_HCAN, &canFilterConfig) != HAL_OK)
if(HAL_CAN_ConfigFilter(&hcan, &canFilterConfig) != HAL_OK)
{
Error_Handler();
}
@ -793,7 +600,7 @@ void REQUESTER_CAN_FILTERS()
canFilterConfig.FilterIdLow = (uint16_t)(0x03000000<<5) | CAN_IDE_32;
canFilterConfig.FilterMaskIdHigh = (uint16_t)(CAN_DATA_TYPE_FILTER>>13); // we're checking only high 13 bits, that contained "key"
canFilterConfig.FilterMaskIdLow = (uint16_t)(CAN_DATA_TYPE_FILTER<<3) | CAN_IDE_32; // 1<<2 - set IDE bit
if(HAL_CAN_ConfigFilter(&_HCAN, &canFilterConfig) != HAL_OK)
if(HAL_CAN_ConfigFilter(&hcan, &canFilterConfig) != HAL_OK)
{
Error_Handler();
}
@ -805,18 +612,7 @@ void REQUESTER_CAN_FILTERS()
canFilterConfig.FilterIdLow = (uint16_t)(HighIdFilter(DATA_TYPE_PULSE)<<5) | CAN_IDE_32;
canFilterConfig.FilterMaskIdHigh = (uint16_t)(CAN_DATA_TYPE_FILTER>>13); // we're checking only high 13 bits, that contained "key"
canFilterConfig.FilterMaskIdLow = (uint16_t)(CAN_DATA_TYPE_FILTER<<3) | CAN_IDE_32; // 1<<2 - set IDE bit
if(HAL_CAN_ConfigFilter(&_HCAN, &canFilterConfig) != HAL_OK)
{
Error_Handler();
}
//DEBUG FILTER "ALL IDE WELCOME"
canFilterConfig.FilterBank = 4;
canFilterConfig.FilterIdHigh = (uint16_t)(HighIdFilter(0)>>13);
canFilterConfig.FilterIdLow = (uint16_t)(HighIdFilter(0)<<5) | CAN_IDE_32;
canFilterConfig.FilterMaskIdHigh = (uint16_t)(0>>13); // we're checking only high 13 bits, that contained "key"
canFilterConfig.FilterMaskIdLow = (uint16_t)(0<<3) | CAN_IDE_32; // 1<<2 - set IDE bit
if(HAL_CAN_ConfigFilter(&_HCAN, &canFilterConfig) != HAL_OK)
if(HAL_CAN_ConfigFilter(&hcan, &canFilterConfig) != HAL_OK)
{
Error_Handler();
}

View File

@ -22,6 +22,7 @@
#include "stm32f1xx_it.h"
/* Private includes ----------------------------------------------------------*/
/* USER CODE BEGIN Includes */
#include "custom_flash.h"
#include "requester.h"
/* USER CODE END Includes */
@ -64,7 +65,10 @@ extern UART_HandleTypeDef huart3;
extern TIM_HandleTypeDef htim8;
/* USER CODE BEGIN EV */
extern uint8_t Data2Write[PAGE_SIZE*2];
extern uint8_t ReceiveDataUART[4];
extern struct flag FLAGS;
extern int cnt_tim_reset;
/* USER CODE END EV */
/******************************************************************************/

View File

@ -1,776 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<ProjectOpt xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="project_optx.xsd">
<SchemaVersion>1.0</SchemaVersion>
<Header>### uVision Project, (C) Keil Software</Header>
<Extensions>
<cExt>*.c</cExt>
<aExt>*.s*; *.src; *.a*</aExt>
<oExt>*.obj; *.o</oExt>
<lExt>*.lib</lExt>
<tExt>*.txt; *.h; *.inc; *.md</tExt>
<pExt>*.plm</pExt>
<CppX>*.cpp</CppX>
<nMigrate>0</nMigrate>
</Extensions>
<DaveTm>
<dwLowDateTime>0</dwLowDateTime>
<dwHighDateTime>0</dwHighDateTime>
</DaveTm>
<Target>
<TargetName>CAN_Request-Response_protocol</TargetName>
<ToolsetNumber>0x4</ToolsetNumber>
<ToolsetName>ARM-ADS</ToolsetName>
<TargetOption>
<CLKADS>8000000</CLKADS>
<OPTTT>
<gFlags>1</gFlags>
<BeepAtEnd>1</BeepAtEnd>
<RunSim>0</RunSim>
<RunTarget>1</RunTarget>
<RunAbUc>0</RunAbUc>
</OPTTT>
<OPTHX>
<HexSelection>1</HexSelection>
<FlashByte>65535</FlashByte>
<HexRangeLowAddress>0</HexRangeLowAddress>
<HexRangeHighAddress>0</HexRangeHighAddress>
<HexOffset>0</HexOffset>
</OPTHX>
<OPTLEX>
<PageWidth>79</PageWidth>
<PageLength>66</PageLength>
<TabStop>8</TabStop>
<ListingPath></ListingPath>
</OPTLEX>
<ListingPage>
<CreateCListing>1</CreateCListing>
<CreateAListing>1</CreateAListing>
<CreateLListing>1</CreateLListing>
<CreateIListing>0</CreateIListing>
<AsmCond>1</AsmCond>
<AsmSymb>1</AsmSymb>
<AsmXref>0</AsmXref>
<CCond>1</CCond>
<CCode>0</CCode>
<CListInc>0</CListInc>
<CSymb>0</CSymb>
<LinkerCodeListing>0</LinkerCodeListing>
</ListingPage>
<OPTXL>
<LMap>1</LMap>
<LComments>1</LComments>
<LGenerateSymbols>1</LGenerateSymbols>
<LLibSym>1</LLibSym>
<LLines>1</LLines>
<LLocSym>1</LLocSym>
<LPubSym>1</LPubSym>
<LXref>0</LXref>
<LExpSel>0</LExpSel>
</OPTXL>
<OPTFL>
<tvExp>1</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<IsCurrentTarget>1</IsCurrentTarget>
</OPTFL>
<CpuCode>18</CpuCode>
<DebugOpt>
<uSim>0</uSim>
<uTrg>1</uTrg>
<sLdApp>1</sLdApp>
<sGomain>1</sGomain>
<sRbreak>1</sRbreak>
<sRwatch>1</sRwatch>
<sRmem>1</sRmem>
<sRfunc>1</sRfunc>
<sRbox>1</sRbox>
<tLdApp>1</tLdApp>
<tGomain>1</tGomain>
<tRbreak>1</tRbreak>
<tRwatch>1</tRwatch>
<tRmem>1</tRmem>
<tRfunc>1</tRfunc>
<tRbox>1</tRbox>
<tRtrace>1</tRtrace>
<sRSysVw>1</sRSysVw>
<tRSysVw>1</tRSysVw>
<sRunDeb>0</sRunDeb>
<sLrtime>0</sLrtime>
<bEvRecOn>1</bEvRecOn>
<bSchkAxf>0</bSchkAxf>
<bTchkAxf>0</bTchkAxf>
<nTsel>4</nTsel>
<sDll></sDll>
<sDllPa></sDllPa>
<sDlgDll></sDlgDll>
<sDlgPa></sDlgPa>
<sIfile></sIfile>
<tDll></tDll>
<tDllPa></tDllPa>
<tDlgDll></tDlgDll>
<tDlgPa></tDlgPa>
<tIfile></tIfile>
<pMon>Segger\JL2CM3.dll</pMon>
</DebugOpt>
<TargetDriverDllRegistry>
<SetRegEntry>
<Number>0</Number>
<Key>ARMRTXEVENTFLAGS</Key>
<Name>-L70 -Z18 -C0 -M0 -T1</Name>
</SetRegEntry>
<SetRegEntry>
<Number>0</Number>
<Key>DLGTARM</Key>
<Name>(1010=-1,-1,-1,-1,0)(1007=-1,-1,-1,-1,0)(1008=-1,-1,-1,-1,0)(1009=-1,-1,-1,-1,0)</Name>
</SetRegEntry>
<SetRegEntry>
<Number>0</Number>
<Key>ARMDBGFLAGS</Key>
<Name></Name>
</SetRegEntry>
<SetRegEntry>
<Number>0</Number>
<Key>JL2CM3</Key>
<Name>-U -O14 -S2 -ZTIFSpeedSel5000 -A0 -C0 -JU1 -JI127.0.0.1 -JP0 -RST0 -N00("ARM CoreSight JTAG-DP") -D00(4BA00477) -L00(4) -TO18 -TC10000000 -TP21 -TDS8007 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -TB1 -TFE0 -FO7 -FD20000000 -FC1000 -FN1 -FF0STM32F10x_1024.FLM -FS08000000 -FL0100000 -FP0($$Device:STM32F103RG$Flash\STM32F10x_1024.FLM)</Name>
</SetRegEntry>
<SetRegEntry>
<Number>0</Number>
<Key>DLGUARM</Key>
</SetRegEntry>
<SetRegEntry>
<Number>0</Number>
<Key>UL2CM3</Key>
<Name>UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000 -FN1 -FF0STM32F10x_1024 -FS08000000 -FL0100000 -FP0($$Device:STM32F103RG$Flash\STM32F10x_1024.FLM))</Name>
</SetRegEntry>
<SetRegEntry>
<Number>0</Number>
<Key>ST-LINKIII-KEIL_SWO</Key>
<Name>-U-O142 -O2254 -S0 -C0 -N00("ARM CoreSight SW-DP") -D00(2BA01477) -L00(0) -TO18 -TC10000000 -TP21 -TDS8007 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -FO7 -FD20000000 -FC800 -FN1 -FF0STM32F10x_1024 -FS08000000 -FL0100000 -FP0($$Device:STM32F103RG$Flash\STM32F10x_1024.FLM)</Name>
</SetRegEntry>
</TargetDriverDllRegistry>
<Breakpoint/>
<Tracepoint>
<THDelay>0</THDelay>
</Tracepoint>
<DebugFlag>
<trace>0</trace>
<periodic>1</periodic>
<aLwin>1</aLwin>
<aCover>0</aCover>
<aSer1>0</aSer1>
<aSer2>0</aSer2>
<aPa>0</aPa>
<viewmode>1</viewmode>
<vrSel>0</vrSel>
<aSym>0</aSym>
<aTbox>0</aTbox>
<AscS1>0</AscS1>
<AscS2>0</AscS2>
<AscS3>0</AscS3>
<aSer3>0</aSer3>
<eProf>0</eProf>
<aLa>0</aLa>
<aPa1>0</aPa1>
<AscS4>0</AscS4>
<aSer4>0</aSer4>
<StkLoc>1</StkLoc>
<TrcWin>0</TrcWin>
<newCpu>0</newCpu>
<uProt>0</uProt>
</DebugFlag>
<LintExecutable></LintExecutable>
<LintConfigFile></LintConfigFile>
<bLintAuto>0</bLintAuto>
<bAutoGenD>0</bAutoGenD>
<LntExFlags>0</LntExFlags>
<pMisraName></pMisraName>
<pszMrule></pszMrule>
<pSingCmds></pSingCmds>
<pMultCmds></pMultCmds>
<pMisraNamep></pMisraNamep>
<pszMrulep></pszMrulep>
<pSingCmdsp></pSingCmdsp>
<pMultCmdsp></pMultCmdsp>
<DebugDescription>
<Enable>1</Enable>
<EnableFlashSeq>1</EnableFlashSeq>
<EnableLog>0</EnableLog>
<Protocol>2</Protocol>
<DbgClock>10000000</DbgClock>
</DebugDescription>
</TargetOption>
</Target>
<Group>
<GroupName>Application/MDK-ARM</GroupName>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<cbSel>0</cbSel>
<RteFlg>0</RteFlg>
<File>
<GroupNumber>1</GroupNumber>
<FileNumber>1</FileNumber>
<FileType>2</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>startup_stm32f103xg.s</PathWithFileName>
<FilenameWithoutPath>startup_stm32f103xg.s</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
</Group>
<Group>
<GroupName>Application/User/Core</GroupName>
<tvExp>1</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<cbSel>0</cbSel>
<RteFlg>0</RteFlg>
<File>
<GroupNumber>2</GroupNumber>
<FileNumber>2</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>../Core/Src/main.c</PathWithFileName>
<FilenameWithoutPath>main.c</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
<File>
<GroupNumber>2</GroupNumber>
<FileNumber>3</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>../Core/Src/gpio.c</PathWithFileName>
<FilenameWithoutPath>gpio.c</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
<File>
<GroupNumber>2</GroupNumber>
<FileNumber>4</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>../Core/Src/can.c</PathWithFileName>
<FilenameWithoutPath>can.c</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
<File>
<GroupNumber>2</GroupNumber>
<FileNumber>5</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>../Core/Src/dma.c</PathWithFileName>
<FilenameWithoutPath>dma.c</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
<File>
<GroupNumber>2</GroupNumber>
<FileNumber>6</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>../Core/Src/rtc.c</PathWithFileName>
<FilenameWithoutPath>rtc.c</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
<File>
<GroupNumber>2</GroupNumber>
<FileNumber>7</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>../Core/Src/sdio.c</PathWithFileName>
<FilenameWithoutPath>sdio.c</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
<File>
<GroupNumber>2</GroupNumber>
<FileNumber>8</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>../Core/Src/tim.c</PathWithFileName>
<FilenameWithoutPath>tim.c</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
<File>
<GroupNumber>2</GroupNumber>
<FileNumber>9</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>../Core/Src/usart.c</PathWithFileName>
<FilenameWithoutPath>usart.c</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
<File>
<GroupNumber>2</GroupNumber>
<FileNumber>10</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>../Core/Src/stm32f1xx_it.c</PathWithFileName>
<FilenameWithoutPath>stm32f1xx_it.c</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
<File>
<GroupNumber>2</GroupNumber>
<FileNumber>11</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>../Core/Src/stm32f1xx_hal_msp.c</PathWithFileName>
<FilenameWithoutPath>stm32f1xx_hal_msp.c</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
<File>
<GroupNumber>2</GroupNumber>
<FileNumber>12</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>../Core/Src/stm32f1xx_hal_timebase_tim.c</PathWithFileName>
<FilenameWithoutPath>stm32f1xx_hal_timebase_tim.c</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
<File>
<GroupNumber>2</GroupNumber>
<FileNumber>13</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>..\Core\Src\requester.c</PathWithFileName>
<FilenameWithoutPath>requester.c</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
<File>
<GroupNumber>2</GroupNumber>
<FileNumber>14</FileNumber>
<FileType>5</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>..\Core\Inc\requester.h</PathWithFileName>
<FilenameWithoutPath>requester.h</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
</Group>
<Group>
<GroupName>Application/User/FATFS/Target</GroupName>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<cbSel>0</cbSel>
<RteFlg>0</RteFlg>
<File>
<GroupNumber>3</GroupNumber>
<FileNumber>15</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>../FATFS/Target/bsp_driver_sd.c</PathWithFileName>
<FilenameWithoutPath>bsp_driver_sd.c</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
<File>
<GroupNumber>3</GroupNumber>
<FileNumber>16</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>../FATFS/Target/fatfs_platform.c</PathWithFileName>
<FilenameWithoutPath>fatfs_platform.c</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
</Group>
<Group>
<GroupName>Application/User/FATFS/App</GroupName>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<cbSel>0</cbSel>
<RteFlg>0</RteFlg>
<File>
<GroupNumber>4</GroupNumber>
<FileNumber>17</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>../FATFS/App/fatfs.c</PathWithFileName>
<FilenameWithoutPath>fatfs.c</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
</Group>
<Group>
<GroupName>Drivers/STM32F1xx_HAL_Driver</GroupName>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<cbSel>0</cbSel>
<RteFlg>0</RteFlg>
<File>
<GroupNumber>5</GroupNumber>
<FileNumber>18</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.c</PathWithFileName>
<FilenameWithoutPath>stm32f1xx_hal_gpio_ex.c</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
<File>
<GroupNumber>5</GroupNumber>
<FileNumber>19</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_can.c</PathWithFileName>
<FilenameWithoutPath>stm32f1xx_hal_can.c</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
<File>
<GroupNumber>5</GroupNumber>
<FileNumber>20</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.c</PathWithFileName>
<FilenameWithoutPath>stm32f1xx_hal.c</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
<File>
<GroupNumber>5</GroupNumber>
<FileNumber>21</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.c</PathWithFileName>
<FilenameWithoutPath>stm32f1xx_hal_rcc.c</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
<File>
<GroupNumber>5</GroupNumber>
<FileNumber>22</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.c</PathWithFileName>
<FilenameWithoutPath>stm32f1xx_hal_rcc_ex.c</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
<File>
<GroupNumber>5</GroupNumber>
<FileNumber>23</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.c</PathWithFileName>
<FilenameWithoutPath>stm32f1xx_hal_gpio.c</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
<File>
<GroupNumber>5</GroupNumber>
<FileNumber>24</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.c</PathWithFileName>
<FilenameWithoutPath>stm32f1xx_hal_dma.c</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
<File>
<GroupNumber>5</GroupNumber>
<FileNumber>25</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.c</PathWithFileName>
<FilenameWithoutPath>stm32f1xx_hal_cortex.c</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
<File>
<GroupNumber>5</GroupNumber>
<FileNumber>26</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.c</PathWithFileName>
<FilenameWithoutPath>stm32f1xx_hal_pwr.c</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
<File>
<GroupNumber>5</GroupNumber>
<FileNumber>27</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.c</PathWithFileName>
<FilenameWithoutPath>stm32f1xx_hal_flash.c</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
<File>
<GroupNumber>5</GroupNumber>
<FileNumber>28</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.c</PathWithFileName>
<FilenameWithoutPath>stm32f1xx_hal_flash_ex.c</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
<File>
<GroupNumber>5</GroupNumber>
<FileNumber>29</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_exti.c</PathWithFileName>
<FilenameWithoutPath>stm32f1xx_hal_exti.c</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
<File>
<GroupNumber>5</GroupNumber>
<FileNumber>30</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rtc.c</PathWithFileName>
<FilenameWithoutPath>stm32f1xx_hal_rtc.c</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
<File>
<GroupNumber>5</GroupNumber>
<FileNumber>31</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rtc_ex.c</PathWithFileName>
<FilenameWithoutPath>stm32f1xx_hal_rtc_ex.c</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
<File>
<GroupNumber>5</GroupNumber>
<FileNumber>32</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_sdmmc.c</PathWithFileName>
<FilenameWithoutPath>stm32f1xx_ll_sdmmc.c</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
<File>
<GroupNumber>5</GroupNumber>
<FileNumber>33</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_sd.c</PathWithFileName>
<FilenameWithoutPath>stm32f1xx_hal_sd.c</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
<File>
<GroupNumber>5</GroupNumber>
<FileNumber>34</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.c</PathWithFileName>
<FilenameWithoutPath>stm32f1xx_hal_tim.c</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
<File>
<GroupNumber>5</GroupNumber>
<FileNumber>35</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.c</PathWithFileName>
<FilenameWithoutPath>stm32f1xx_hal_tim_ex.c</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
<File>
<GroupNumber>5</GroupNumber>
<FileNumber>36</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_uart.c</PathWithFileName>
<FilenameWithoutPath>stm32f1xx_hal_uart.c</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
</Group>
<Group>
<GroupName>Drivers/CMSIS</GroupName>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<cbSel>0</cbSel>
<RteFlg>0</RteFlg>
<File>
<GroupNumber>6</GroupNumber>
<FileNumber>37</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>../Core/Src/system_stm32f1xx.c</PathWithFileName>
<FilenameWithoutPath>system_stm32f1xx.c</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
</Group>
<Group>
<GroupName>Middlewares/FatFs</GroupName>
<tvExp>1</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<cbSel>0</cbSel>
<RteFlg>0</RteFlg>
<File>
<GroupNumber>7</GroupNumber>
<FileNumber>38</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>../Middlewares/Third_Party/FatFs/src/diskio.c</PathWithFileName>
<FilenameWithoutPath>diskio.c</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
<File>
<GroupNumber>7</GroupNumber>
<FileNumber>39</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>../Middlewares/Third_Party/FatFs/src/ff.c</PathWithFileName>
<FilenameWithoutPath>ff.c</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
<File>
<GroupNumber>7</GroupNumber>
<FileNumber>40</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>../Middlewares/Third_Party/FatFs/src/ff_gen_drv.c</PathWithFileName>
<FilenameWithoutPath>ff_gen_drv.c</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
<File>
<GroupNumber>7</GroupNumber>
<FileNumber>41</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>../Middlewares/Third_Party/FatFs/src/option/syscall.c</PathWithFileName>
<FilenameWithoutPath>syscall.c</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
<File>
<GroupNumber>7</GroupNumber>
<FileNumber>42</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>../Middlewares/Third_Party/FatFs/src/drivers/sd_diskio.c</PathWithFileName>
<FilenameWithoutPath>sd_diskio.c</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
</Group>
<Group>
<GroupName>::CMSIS</GroupName>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<cbSel>0</cbSel>
<RteFlg>1</RteFlg>
</Group>
</ProjectOpt>

View File

@ -1,650 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<Project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="project_projx.xsd">
<SchemaVersion>2.1</SchemaVersion>
<Header>### uVision Project, (C) Keil Software</Header>
<Targets>
<Target>
<TargetName>CAN_Request-Response_protocol</TargetName>
<ToolsetNumber>0x4</ToolsetNumber>
<ToolsetName>ARM-ADS</ToolsetName>
<pArmCC>6190000::V6.19::ARMCLANG</pArmCC>
<pCCUsed>6190000::V6.19::ARMCLANG</pCCUsed>
<uAC6>1</uAC6>
<TargetOption>
<TargetCommonOption>
<Device>STM32F103RG</Device>
<Vendor>STMicroelectronics</Vendor>
<PackID>Keil.STM32F1xx_DFP.2.4.0</PackID>
<PackURL>http://www.keil.com/pack/</PackURL>
<Cpu>IRAM(0x20000000-0x20017FFF) IROM(0x8000000-0x80FFFFF) CLOCK(8000000) CPUTYPE("Cortex-M3") TZ</Cpu>
<FlashUtilSpec></FlashUtilSpec>
<StartupFile></StartupFile>
<FlashDriverDll></FlashDriverDll>
<DeviceId>0</DeviceId>
<RegisterFile></RegisterFile>
<MemoryEnv></MemoryEnv>
<Cmp></Cmp>
<Asm></Asm>
<Linker></Linker>
<OHString></OHString>
<InfinionOptionDll></InfinionOptionDll>
<SLE66CMisc></SLE66CMisc>
<SLE66AMisc></SLE66AMisc>
<SLE66LinkerMisc></SLE66LinkerMisc>
<SFDFile>$$Device:STM32F103RG$SVD\STM32F103xx.svd</SFDFile>
<bCustSvd>0</bCustSvd>
<UseEnv>0</UseEnv>
<BinPath></BinPath>
<IncludePath></IncludePath>
<LibPath></LibPath>
<RegisterFilePath></RegisterFilePath>
<DBRegisterFilePath></DBRegisterFilePath>
<TargetStatus>
<Error>0</Error>
<ExitCodeStop>0</ExitCodeStop>
<ButtonStop>0</ButtonStop>
<NotGenerated>0</NotGenerated>
<InvalidFlash>1</InvalidFlash>
</TargetStatus>
<OutputDirectory>CAN_Request-Response_protocol\</OutputDirectory>
<OutputName>CAN_Request-Response_protocol</OutputName>
<CreateExecutable>1</CreateExecutable>
<CreateLib>0</CreateLib>
<CreateHexFile>1</CreateHexFile>
<DebugInformation>1</DebugInformation>
<BrowseInformation>1</BrowseInformation>
<ListingPath></ListingPath>
<HexFormatSelection>1</HexFormatSelection>
<Merge32K>0</Merge32K>
<CreateBatchFile>0</CreateBatchFile>
<BeforeCompile>
<RunUserProg1>0</RunUserProg1>
<RunUserProg2>0</RunUserProg2>
<UserProg1Name></UserProg1Name>
<UserProg2Name></UserProg2Name>
<UserProg1Dos16Mode>0</UserProg1Dos16Mode>
<UserProg2Dos16Mode>0</UserProg2Dos16Mode>
<nStopU1X>0</nStopU1X>
<nStopU2X>0</nStopU2X>
</BeforeCompile>
<BeforeMake>
<RunUserProg1>0</RunUserProg1>
<RunUserProg2>0</RunUserProg2>
<UserProg1Name></UserProg1Name>
<UserProg2Name></UserProg2Name>
<UserProg1Dos16Mode>0</UserProg1Dos16Mode>
<UserProg2Dos16Mode>0</UserProg2Dos16Mode>
<nStopB1X>0</nStopB1X>
<nStopB2X>0</nStopB2X>
</BeforeMake>
<AfterMake>
<RunUserProg1>1</RunUserProg1>
<RunUserProg2>0</RunUserProg2>
<UserProg1Name>fromelf.exe --bin --output .\Listings\@L.bin !L</UserProg1Name>
<UserProg2Name></UserProg2Name>
<UserProg1Dos16Mode>0</UserProg1Dos16Mode>
<UserProg2Dos16Mode>0</UserProg2Dos16Mode>
<nStopA1X>0</nStopA1X>
<nStopA2X>0</nStopA2X>
</AfterMake>
<SelectedForBatchBuild>1</SelectedForBatchBuild>
<SVCSIdString></SVCSIdString>
</TargetCommonOption>
<CommonProperty>
<UseCPPCompiler>0</UseCPPCompiler>
<RVCTCodeConst>0</RVCTCodeConst>
<RVCTZI>0</RVCTZI>
<RVCTOtherData>0</RVCTOtherData>
<ModuleSelection>0</ModuleSelection>
<IncludeInBuild>1</IncludeInBuild>
<AlwaysBuild>0</AlwaysBuild>
<GenerateAssemblyFile>0</GenerateAssemblyFile>
<AssembleAssemblyFile>0</AssembleAssemblyFile>
<PublicsOnly>0</PublicsOnly>
<StopOnExitCode>3</StopOnExitCode>
<CustomArgument></CustomArgument>
<IncludeLibraryModules></IncludeLibraryModules>
<ComprImg>0</ComprImg>
</CommonProperty>
<DllOption>
<SimDllName>SARMCM3.DLL</SimDllName>
<SimDllArguments>-REMAP</SimDllArguments>
<SimDlgDll>DCM.DLL</SimDlgDll>
<SimDlgDllArguments>-pCM3</SimDlgDllArguments>
<TargetDllName>SARMCM3.DLL</TargetDllName>
<TargetDllArguments></TargetDllArguments>
<TargetDlgDll>TCM.DLL</TargetDlgDll>
<TargetDlgDllArguments>-pCM3</TargetDlgDllArguments>
</DllOption>
<DebugOption>
<OPTHX>
<HexSelection>1</HexSelection>
<HexRangeLowAddress>0</HexRangeLowAddress>
<HexRangeHighAddress>0</HexRangeHighAddress>
<HexOffset>0</HexOffset>
<Oh166RecLen>16</Oh166RecLen>
</OPTHX>
</DebugOption>
<Utilities>
<Flash1>
<UseTargetDll>1</UseTargetDll>
<UseExternalTool>0</UseExternalTool>
<RunIndependent>0</RunIndependent>
<UpdateFlashBeforeDebugging>1</UpdateFlashBeforeDebugging>
<Capability>1</Capability>
<DriverSelection>4101</DriverSelection>
</Flash1>
<bUseTDR>1</bUseTDR>
<Flash2>BIN\UL2V8M.DLL</Flash2>
<Flash3>"" ()</Flash3>
<Flash4></Flash4>
<pFcarmOut></pFcarmOut>
<pFcarmGrp></pFcarmGrp>
<pFcArmRoot></pFcArmRoot>
<FcArmLst>0</FcArmLst>
</Utilities>
<TargetArmAds>
<ArmAdsMisc>
<GenerateListings>0</GenerateListings>
<asHll>1</asHll>
<asAsm>1</asAsm>
<asMacX>1</asMacX>
<asSyms>1</asSyms>
<asFals>1</asFals>
<asDbgD>1</asDbgD>
<asForm>1</asForm>
<ldLst>0</ldLst>
<ldmm>1</ldmm>
<ldXref>1</ldXref>
<BigEnd>0</BigEnd>
<AdsALst>1</AdsALst>
<AdsACrf>1</AdsACrf>
<AdsANop>0</AdsANop>
<AdsANot>0</AdsANot>
<AdsLLst>1</AdsLLst>
<AdsLmap>1</AdsLmap>
<AdsLcgr>1</AdsLcgr>
<AdsLsym>1</AdsLsym>
<AdsLszi>1</AdsLszi>
<AdsLtoi>1</AdsLtoi>
<AdsLsun>1</AdsLsun>
<AdsLven>1</AdsLven>
<AdsLsxf>1</AdsLsxf>
<RvctClst>0</RvctClst>
<GenPPlst>0</GenPPlst>
<AdsCpuType>"Cortex-M3"</AdsCpuType>
<RvctDeviceName></RvctDeviceName>
<mOS>0</mOS>
<uocRom>0</uocRom>
<uocRam>0</uocRam>
<hadIROM>1</hadIROM>
<hadIRAM>1</hadIRAM>
<hadXRAM>0</hadXRAM>
<uocXRam>0</uocXRam>
<RvdsVP>0</RvdsVP>
<RvdsMve>0</RvdsMve>
<RvdsCdeCp>0</RvdsCdeCp>
<nBranchProt>0</nBranchProt>
<hadIRAM2>0</hadIRAM2>
<hadIROM2>0</hadIROM2>
<StupSel>8</StupSel>
<useUlib>0</useUlib>
<EndSel>0</EndSel>
<uLtcg>0</uLtcg>
<nSecure>0</nSecure>
<RoSelD>3</RoSelD>
<RwSelD>4</RwSelD>
<CodeSel>0</CodeSel>
<OptFeed>0</OptFeed>
<NoZi1>0</NoZi1>
<NoZi2>0</NoZi2>
<NoZi3>0</NoZi3>
<NoZi4>0</NoZi4>
<NoZi5>0</NoZi5>
<Ro1Chk>0</Ro1Chk>
<Ro2Chk>0</Ro2Chk>
<Ro3Chk>0</Ro3Chk>
<Ir1Chk>1</Ir1Chk>
<Ir2Chk>0</Ir2Chk>
<Ra1Chk>0</Ra1Chk>
<Ra2Chk>0</Ra2Chk>
<Ra3Chk>0</Ra3Chk>
<Im1Chk>1</Im1Chk>
<Im2Chk>1</Im2Chk>
<OnChipMemories>
<Ocm1>
<Type>0</Type>
<StartAddress>0x0</StartAddress>
<Size>0x0</Size>
</Ocm1>
<Ocm2>
<Type>0</Type>
<StartAddress>0x0</StartAddress>
<Size>0x0</Size>
</Ocm2>
<Ocm3>
<Type>0</Type>
<StartAddress>0x0</StartAddress>
<Size>0x0</Size>
</Ocm3>
<Ocm4>
<Type>0</Type>
<StartAddress>0x0</StartAddress>
<Size>0x0</Size>
</Ocm4>
<Ocm5>
<Type>0</Type>
<StartAddress>0x0</StartAddress>
<Size>0x0</Size>
</Ocm5>
<Ocm6>
<Type>0</Type>
<StartAddress>0x0</StartAddress>
<Size>0x0</Size>
</Ocm6>
<IRAM>
<Type>0</Type>
<StartAddress>0x20000000</StartAddress>
<Size>0x18000</Size>
</IRAM>
<IROM>
<Type>1</Type>
<StartAddress>0x8000000</StartAddress>
<Size>0x100000</Size>
</IROM>
<XRAM>
<Type>0</Type>
<StartAddress>0x0</StartAddress>
<Size>0x0</Size>
</XRAM>
<OCR_RVCT1>
<Type>1</Type>
<StartAddress>0x0</StartAddress>
<Size>0x0</Size>
</OCR_RVCT1>
<OCR_RVCT2>
<Type>1</Type>
<StartAddress>0x0</StartAddress>
<Size>0x0</Size>
</OCR_RVCT2>
<OCR_RVCT3>
<Type>1</Type>
<StartAddress>0x0</StartAddress>
<Size>0x0</Size>
</OCR_RVCT3>
<OCR_RVCT4>
<Type>1</Type>
<StartAddress>0x8000000</StartAddress>
<Size>0x400000</Size>
</OCR_RVCT4>
<OCR_RVCT5>
<Type>1</Type>
<StartAddress>0x0</StartAddress>
<Size>0x0</Size>
</OCR_RVCT5>
<OCR_RVCT6>
<Type>0</Type>
<StartAddress>0x0</StartAddress>
<Size>0x0</Size>
</OCR_RVCT6>
<OCR_RVCT7>
<Type>0</Type>
<StartAddress>0x0</StartAddress>
<Size>0x0</Size>
</OCR_RVCT7>
<OCR_RVCT8>
<Type>0</Type>
<StartAddress>0x0</StartAddress>
<Size>0x0</Size>
</OCR_RVCT8>
<OCR_RVCT9>
<Type>0</Type>
<StartAddress>0x20000000</StartAddress>
<Size>0x18000</Size>
</OCR_RVCT9>
<OCR_RVCT10>
<Type>0</Type>
<StartAddress>0x20018000</StartAddress>
<Size>0x1000</Size>
</OCR_RVCT10>
</OnChipMemories>
<RvctStartVector></RvctStartVector>
</ArmAdsMisc>
<Cads>
<interw>1</interw>
<Optim>1</Optim>
<oTime>0</oTime>
<SplitLS>0</SplitLS>
<OneElfS>1</OneElfS>
<Strict>0</Strict>
<EnumInt>0</EnumInt>
<PlainCh>0</PlainCh>
<Ropi>0</Ropi>
<Rwpi>0</Rwpi>
<wLevel>3</wLevel>
<uThumb>0</uThumb>
<uSurpInc>0</uSurpInc>
<uC99>1</uC99>
<uGnu>0</uGnu>
<useXO>1</useXO>
<v6Lang>3</v6Lang>
<v6LangP>5</v6LangP>
<vShortEn>1</vShortEn>
<vShortWch>1</vShortWch>
<v6Lto>0</v6Lto>
<v6WtE>0</v6WtE>
<v6Rtti>0</v6Rtti>
<VariousControls>
<MiscControls></MiscControls>
<Define>USE_HAL_DRIVER,STM32F103xG</Define>
<Undefine></Undefine>
<IncludePath>../Core/Inc;../FATFS/Target;../FATFS/App;../Drivers/STM32F1xx_HAL_Driver/Inc;../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy;../Middlewares/Third_Party/FatFs/src;../Middlewares/Third_Party/FatFs/src/drivers;../Drivers/CMSIS/Device/ST/STM32F1xx/Include;../Drivers/CMSIS/Include</IncludePath>
</VariousControls>
</Cads>
<Aads>
<interw>1</interw>
<Ropi>0</Ropi>
<Rwpi>0</Rwpi>
<thumb>0</thumb>
<SplitLS>0</SplitLS>
<SwStkChk>0</SwStkChk>
<NoWarn>0</NoWarn>
<uSurpInc>0</uSurpInc>
<useXO>0</useXO>
<ClangAsOpt>1</ClangAsOpt>
<VariousControls>
<MiscControls></MiscControls>
<Define></Define>
<Undefine></Undefine>
<IncludePath></IncludePath>
</VariousControls>
</Aads>
<LDads>
<umfTarg>1</umfTarg>
<Ropi>0</Ropi>
<Rwpi>0</Rwpi>
<noStLib>0</noStLib>
<RepFail>1</RepFail>
<useFile>0</useFile>
<TextAddressRange></TextAddressRange>
<DataAddressRange></DataAddressRange>
<pXoBase></pXoBase>
<ScatterFile></ScatterFile>
<IncludeLibs></IncludeLibs>
<IncludeLibsPath></IncludeLibsPath>
<Misc></Misc>
<LinkerInputFile></LinkerInputFile>
<DisabledWarnings></DisabledWarnings>
</LDads>
</TargetArmAds>
</TargetOption>
<Groups>
<Group>
<GroupName>Application/MDK-ARM</GroupName>
<Files>
<File>
<FileName>startup_stm32f103xg.s</FileName>
<FileType>2</FileType>
<FilePath>startup_stm32f103xg.s</FilePath>
</File>
</Files>
</Group>
<Group>
<GroupName>Application/User/Core</GroupName>
<Files>
<File>
<FileName>main.c</FileName>
<FileType>1</FileType>
<FilePath>../Core/Src/main.c</FilePath>
</File>
<File>
<FileName>gpio.c</FileName>
<FileType>1</FileType>
<FilePath>../Core/Src/gpio.c</FilePath>
</File>
<File>
<FileName>can.c</FileName>
<FileType>1</FileType>
<FilePath>../Core/Src/can.c</FilePath>
</File>
<File>
<FileName>dma.c</FileName>
<FileType>1</FileType>
<FilePath>../Core/Src/dma.c</FilePath>
</File>
<File>
<FileName>rtc.c</FileName>
<FileType>1</FileType>
<FilePath>../Core/Src/rtc.c</FilePath>
</File>
<File>
<FileName>sdio.c</FileName>
<FileType>1</FileType>
<FilePath>../Core/Src/sdio.c</FilePath>
</File>
<File>
<FileName>tim.c</FileName>
<FileType>1</FileType>
<FilePath>../Core/Src/tim.c</FilePath>
</File>
<File>
<FileName>usart.c</FileName>
<FileType>1</FileType>
<FilePath>../Core/Src/usart.c</FilePath>
</File>
<File>
<FileName>stm32f1xx_it.c</FileName>
<FileType>1</FileType>
<FilePath>../Core/Src/stm32f1xx_it.c</FilePath>
</File>
<File>
<FileName>stm32f1xx_hal_msp.c</FileName>
<FileType>1</FileType>
<FilePath>../Core/Src/stm32f1xx_hal_msp.c</FilePath>
</File>
<File>
<FileName>stm32f1xx_hal_timebase_tim.c</FileName>
<FileType>1</FileType>
<FilePath>../Core/Src/stm32f1xx_hal_timebase_tim.c</FilePath>
</File>
<File>
<FileName>requester.c</FileName>
<FileType>1</FileType>
<FilePath>..\Core\Src\requester.c</FilePath>
</File>
<File>
<FileName>requester.h</FileName>
<FileType>5</FileType>
<FilePath>..\Core\Inc\requester.h</FilePath>
</File>
</Files>
</Group>
<Group>
<GroupName>Application/User/FATFS/Target</GroupName>
<Files>
<File>
<FileName>bsp_driver_sd.c</FileName>
<FileType>1</FileType>
<FilePath>../FATFS/Target/bsp_driver_sd.c</FilePath>
</File>
<File>
<FileName>fatfs_platform.c</FileName>
<FileType>1</FileType>
<FilePath>../FATFS/Target/fatfs_platform.c</FilePath>
</File>
</Files>
</Group>
<Group>
<GroupName>Application/User/FATFS/App</GroupName>
<Files>
<File>
<FileName>fatfs.c</FileName>
<FileType>1</FileType>
<FilePath>../FATFS/App/fatfs.c</FilePath>
</File>
</Files>
</Group>
<Group>
<GroupName>Drivers/STM32F1xx_HAL_Driver</GroupName>
<Files>
<File>
<FileName>stm32f1xx_hal_gpio_ex.c</FileName>
<FileType>1</FileType>
<FilePath>../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.c</FilePath>
</File>
<File>
<FileName>stm32f1xx_hal_can.c</FileName>
<FileType>1</FileType>
<FilePath>../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_can.c</FilePath>
</File>
<File>
<FileName>stm32f1xx_hal.c</FileName>
<FileType>1</FileType>
<FilePath>../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.c</FilePath>
</File>
<File>
<FileName>stm32f1xx_hal_rcc.c</FileName>
<FileType>1</FileType>
<FilePath>../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.c</FilePath>
</File>
<File>
<FileName>stm32f1xx_hal_rcc_ex.c</FileName>
<FileType>1</FileType>
<FilePath>../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.c</FilePath>
</File>
<File>
<FileName>stm32f1xx_hal_gpio.c</FileName>
<FileType>1</FileType>
<FilePath>../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.c</FilePath>
</File>
<File>
<FileName>stm32f1xx_hal_dma.c</FileName>
<FileType>1</FileType>
<FilePath>../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.c</FilePath>
</File>
<File>
<FileName>stm32f1xx_hal_cortex.c</FileName>
<FileType>1</FileType>
<FilePath>../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.c</FilePath>
</File>
<File>
<FileName>stm32f1xx_hal_pwr.c</FileName>
<FileType>1</FileType>
<FilePath>../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.c</FilePath>
</File>
<File>
<FileName>stm32f1xx_hal_flash.c</FileName>
<FileType>1</FileType>
<FilePath>../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.c</FilePath>
</File>
<File>
<FileName>stm32f1xx_hal_flash_ex.c</FileName>
<FileType>1</FileType>
<FilePath>../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.c</FilePath>
</File>
<File>
<FileName>stm32f1xx_hal_exti.c</FileName>
<FileType>1</FileType>
<FilePath>../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_exti.c</FilePath>
</File>
<File>
<FileName>stm32f1xx_hal_rtc.c</FileName>
<FileType>1</FileType>
<FilePath>../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rtc.c</FilePath>
</File>
<File>
<FileName>stm32f1xx_hal_rtc_ex.c</FileName>
<FileType>1</FileType>
<FilePath>../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rtc_ex.c</FilePath>
</File>
<File>
<FileName>stm32f1xx_ll_sdmmc.c</FileName>
<FileType>1</FileType>
<FilePath>../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_sdmmc.c</FilePath>
</File>
<File>
<FileName>stm32f1xx_hal_sd.c</FileName>
<FileType>1</FileType>
<FilePath>../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_sd.c</FilePath>
</File>
<File>
<FileName>stm32f1xx_hal_tim.c</FileName>
<FileType>1</FileType>
<FilePath>../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.c</FilePath>
</File>
<File>
<FileName>stm32f1xx_hal_tim_ex.c</FileName>
<FileType>1</FileType>
<FilePath>../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.c</FilePath>
</File>
<File>
<FileName>stm32f1xx_hal_uart.c</FileName>
<FileType>1</FileType>
<FilePath>../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_uart.c</FilePath>
</File>
</Files>
</Group>
<Group>
<GroupName>Drivers/CMSIS</GroupName>
<Files>
<File>
<FileName>system_stm32f1xx.c</FileName>
<FileType>1</FileType>
<FilePath>../Core/Src/system_stm32f1xx.c</FilePath>
</File>
</Files>
</Group>
<Group>
<GroupName>Middlewares/FatFs</GroupName>
<Files>
<File>
<FileName>diskio.c</FileName>
<FileType>1</FileType>
<FilePath>../Middlewares/Third_Party/FatFs/src/diskio.c</FilePath>
</File>
<File>
<FileName>ff.c</FileName>
<FileType>1</FileType>
<FilePath>../Middlewares/Third_Party/FatFs/src/ff.c</FilePath>
</File>
<File>
<FileName>ff_gen_drv.c</FileName>
<FileType>1</FileType>
<FilePath>../Middlewares/Third_Party/FatFs/src/ff_gen_drv.c</FilePath>
</File>
<File>
<FileName>syscall.c</FileName>
<FileType>1</FileType>
<FilePath>../Middlewares/Third_Party/FatFs/src/option/syscall.c</FilePath>
</File>
<File>
<FileName>sd_diskio.c</FileName>
<FileType>1</FileType>
<FilePath>../Middlewares/Third_Party/FatFs/src/drivers/sd_diskio.c</FilePath>
</File>
</Files>
</Group>
<Group>
<GroupName>::CMSIS</GroupName>
</Group>
</Groups>
</Target>
</Targets>
<RTE>
<apis/>
<components>
<component Cclass="CMSIS" Cgroup="CORE" Cvendor="ARM" Cversion="5.6.0" condition="ARMv6_7_8-M Device">
<package name="CMSIS" schemaVersion="1.7.7" url="http://www.keil.com/pack/" vendor="ARM" version="5.9.0"/>
<targetInfos>
<targetInfo name="CAN_Request-Response_protocol"/>
</targetInfos>
</component>
</components>
<files/>
</RTE>
</Project>

View File

@ -1,19 +0,0 @@
; *************************************************************
; *** Scatter-Loading Description File generated by uVision ***
; *************************************************************
LR_IROM1 0x08000000 0x00400000 { ; load region size_region
ER_IROM1 0x08000000 0x00400000 { ; load address = execution address
*.o (RESET, +First)
*(InRoot$$Sections)
.ANY (+RO)
.ANY (+XO)
}
RW_IRAM1 0x20000000 0x00018000 { ; RW data
.ANY (+RW +ZI)
}
RW_IRAM2 0x20018000 0x00001000 {
.ANY (+RW +ZI)
}
}

View File

@ -1,36 +0,0 @@
// File: STM32F101_102_103_105_107.dbgconf
// Version: 1.0.0
// Note: refer to STM32F101xx STM32F102xx STM32F103xx STM32F105xx STM32F107xx Reference manual (RM0008)
// STM32F101xx STM32F102xx STM32F103xx STM32F105xx STM32F107xx datasheets
// <<< Use Configuration Wizard in Context Menu >>>
// <h> Debug MCU configuration register (DBGMCU_CR)
// <i> Reserved bits must be kept at reset value
// <o.30> DBG_TIM11_STOP <i> TIM11 counter stopped when core is halted
// <o.29> DBG_TIM10_STOP <i> TIM10 counter stopped when core is halted
// <o.28> DBG_TIM9_STOP <i> TIM9 counter stopped when core is halted
// <o.27> DBG_TIM14_STOP <i> TIM14 counter stopped when core is halted
// <o.26> DBG_TIM13_STOP <i> TIM13 counter stopped when core is halted
// <o.25> DBG_TIM12_STOP <i> TIM12 counter stopped when core is halted
// <o.21> DBG_CAN2_STOP <i> Debug CAN2 stopped when core is halted
// <o.20> DBG_TIM7_STOP <i> TIM7 counter stopped when core is halted
// <o.19> DBG_TIM6_STOP <i> TIM6 counter stopped when core is halted
// <o.18> DBG_TIM5_STOP <i> TIM5 counter stopped when core is halted
// <o.17> DBG_TIM8_STOP <i> TIM8 counter stopped when core is halted
// <o.16> DBG_I2C2_SMBUS_TIMEOUT <i> SMBUS timeout mode stopped when core is halted
// <o.15> DBG_I2C1_SMBUS_TIMEOUT <i> SMBUS timeout mode stopped when core is halted
// <o.14> DBG_CAN1_STOP <i> Debug CAN1 stopped when Core is halted
// <o.13> DBG_TIM4_STOP <i> TIM4 counter stopped when core is halted
// <o.12> DBG_TIM3_STOP <i> TIM3 counter stopped when core is halted
// <o.11> DBG_TIM2_STOP <i> TIM2 counter stopped when core is halted
// <o.10> DBG_TIM1_STOP <i> TIM1 counter stopped when core is halted
// <o.9> DBG_WWDG_STOP <i> Debug window watchdog stopped when core is halted
// <o.8> DBG_IWDG_STOP <i> Debug independent watchdog stopped when core is halted
// <o.2> DBG_STANDBY <i> Debug standby mode
// <o.1> DBG_STOP <i> Debug stop mode
// <o.0> DBG_SLEEP <i> Debug sleep mode
// </h>
DbgMCU_CR = 0x00000007;
// <<< end of configuration section >>>

View File

@ -1,36 +0,0 @@
// File: STM32F101_102_103_105_107.dbgconf
// Version: 1.0.0
// Note: refer to STM32F101xx STM32F102xx STM32F103xx STM32F105xx STM32F107xx Reference manual (RM0008)
// STM32F101xx STM32F102xx STM32F103xx STM32F105xx STM32F107xx datasheets
// <<< Use Configuration Wizard in Context Menu >>>
// <h> Debug MCU configuration register (DBGMCU_CR)
// <i> Reserved bits must be kept at reset value
// <o.30> DBG_TIM11_STOP <i> TIM11 counter stopped when core is halted
// <o.29> DBG_TIM10_STOP <i> TIM10 counter stopped when core is halted
// <o.28> DBG_TIM9_STOP <i> TIM9 counter stopped when core is halted
// <o.27> DBG_TIM14_STOP <i> TIM14 counter stopped when core is halted
// <o.26> DBG_TIM13_STOP <i> TIM13 counter stopped when core is halted
// <o.25> DBG_TIM12_STOP <i> TIM12 counter stopped when core is halted
// <o.21> DBG_CAN2_STOP <i> Debug CAN2 stopped when core is halted
// <o.20> DBG_TIM7_STOP <i> TIM7 counter stopped when core is halted
// <o.19> DBG_TIM6_STOP <i> TIM6 counter stopped when core is halted
// <o.18> DBG_TIM5_STOP <i> TIM5 counter stopped when core is halted
// <o.17> DBG_TIM8_STOP <i> TIM8 counter stopped when core is halted
// <o.16> DBG_I2C2_SMBUS_TIMEOUT <i> SMBUS timeout mode stopped when core is halted
// <o.15> DBG_I2C1_SMBUS_TIMEOUT <i> SMBUS timeout mode stopped when core is halted
// <o.14> DBG_CAN1_STOP <i> Debug CAN1 stopped when Core is halted
// <o.13> DBG_TIM4_STOP <i> TIM4 counter stopped when core is halted
// <o.12> DBG_TIM3_STOP <i> TIM3 counter stopped when core is halted
// <o.11> DBG_TIM2_STOP <i> TIM2 counter stopped when core is halted
// <o.10> DBG_TIM1_STOP <i> TIM1 counter stopped when core is halted
// <o.9> DBG_WWDG_STOP <i> Debug window watchdog stopped when core is halted
// <o.8> DBG_IWDG_STOP <i> Debug independent watchdog stopped when core is halted
// <o.2> DBG_STANDBY <i> Debug standby mode
// <o.1> DBG_STOP <i> Debug stop mode
// <o.0> DBG_SLEEP <i> Debug sleep mode
// </h>
DbgMCU_CR = 0x00000007;
// <<< end of configuration section >>>

View File

@ -1,21 +0,0 @@
/*
* Auto generated Run-Time-Environment Configuration File
* *** Do not modify ! ***
*
* Project: 'CAN_Request-Response_protocol'
* Target: 'CAN_Request-Response_protocol'
*/
#ifndef RTE_COMPONENTS_H
#define RTE_COMPONENTS_H
/*
* Define the Device Header File:
*/
#define CMSIS_device_header "stm32f10x.h"
#endif /* RTE_COMPONENTS_H */

View File

@ -1,21 +0,0 @@
/*
* Auto generated Run-Time-Environment Configuration File
* *** Do not modify ! ***
*
* Project: 'stm32f103rgtx_bootloader'
* Target: 'stm32f103rgtx_CAN_Request_Response_protocol'
*/
#ifndef RTE_COMPONENTS_H
#define RTE_COMPONENTS_H
/*
* Define the Device Header File:
*/
#define CMSIS_device_header "stm32f10x.h"
#endif /* RTE_COMPONENTS_H */

View File

@ -22,7 +22,7 @@
</DaveTm>
<Target>
<TargetName>stm32f103rgtx_CAN_Request_Response_protocol</TargetName>
<TargetName>stm32f103rgtx_bootloader</TargetName>
<ToolsetNumber>0x4</ToolsetNumber>
<ToolsetName>ARM-ADS</ToolsetName>
<TargetOption>
@ -327,6 +327,42 @@
<File>
<GroupNumber>2</GroupNumber>
<FileNumber>2</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>..\Core\Src\custom_flash.c</PathWithFileName>
<FilenameWithoutPath>custom_flash.c</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
<File>
<GroupNumber>2</GroupNumber>
<FileNumber>3</FileNumber>
<FileType>5</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>..\Core\Inc\custom_flash.h</PathWithFileName>
<FilenameWithoutPath>custom_flash.h</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
<File>
<GroupNumber>2</GroupNumber>
<FileNumber>4</FileNumber>
<FileType>5</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>..\Core\Inc\boot_project_setup.h</PathWithFileName>
<FilenameWithoutPath>boot_project_setup.h</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
<File>
<GroupNumber>2</GroupNumber>
<FileNumber>5</FileNumber>
<FileType>5</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
@ -338,7 +374,7 @@
</File>
<File>
<GroupNumber>2</GroupNumber>
<FileNumber>3</FileNumber>
<FileNumber>6</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
@ -350,9 +386,9 @@
</File>
<File>
<GroupNumber>2</GroupNumber>
<FileNumber>4</FileNumber>
<FileNumber>7</FileNumber>
<FileType>1</FileType>
<tvExp>1</tvExp>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>../Core/Src/main.c</PathWithFileName>
@ -362,7 +398,7 @@
</File>
<File>
<GroupNumber>2</GroupNumber>
<FileNumber>5</FileNumber>
<FileNumber>8</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
@ -374,7 +410,7 @@
</File>
<File>
<GroupNumber>2</GroupNumber>
<FileNumber>6</FileNumber>
<FileNumber>9</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
@ -386,7 +422,7 @@
</File>
<File>
<GroupNumber>2</GroupNumber>
<FileNumber>7</FileNumber>
<FileNumber>10</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
@ -398,7 +434,7 @@
</File>
<File>
<GroupNumber>2</GroupNumber>
<FileNumber>8</FileNumber>
<FileNumber>11</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
@ -410,7 +446,7 @@
</File>
<File>
<GroupNumber>2</GroupNumber>
<FileNumber>9</FileNumber>
<FileNumber>12</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
@ -422,7 +458,7 @@
</File>
<File>
<GroupNumber>2</GroupNumber>
<FileNumber>10</FileNumber>
<FileNumber>13</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
@ -434,7 +470,7 @@
</File>
<File>
<GroupNumber>2</GroupNumber>
<FileNumber>11</FileNumber>
<FileNumber>14</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
@ -446,7 +482,7 @@
</File>
<File>
<GroupNumber>2</GroupNumber>
<FileNumber>12</FileNumber>
<FileNumber>15</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
@ -458,7 +494,7 @@
</File>
<File>
<GroupNumber>2</GroupNumber>
<FileNumber>13</FileNumber>
<FileNumber>16</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
@ -470,7 +506,7 @@
</File>
<File>
<GroupNumber>2</GroupNumber>
<FileNumber>14</FileNumber>
<FileNumber>17</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
@ -490,7 +526,7 @@
<RteFlg>0</RteFlg>
<File>
<GroupNumber>3</GroupNumber>
<FileNumber>15</FileNumber>
<FileNumber>18</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
@ -502,7 +538,7 @@
</File>
<File>
<GroupNumber>3</GroupNumber>
<FileNumber>16</FileNumber>
<FileNumber>19</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
@ -522,7 +558,7 @@
<RteFlg>0</RteFlg>
<File>
<GroupNumber>4</GroupNumber>
<FileNumber>17</FileNumber>
<FileNumber>20</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
@ -542,7 +578,7 @@
<RteFlg>0</RteFlg>
<File>
<GroupNumber>5</GroupNumber>
<FileNumber>18</FileNumber>
<FileNumber>21</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
@ -554,7 +590,7 @@
</File>
<File>
<GroupNumber>5</GroupNumber>
<FileNumber>19</FileNumber>
<FileNumber>22</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
@ -566,7 +602,7 @@
</File>
<File>
<GroupNumber>5</GroupNumber>
<FileNumber>20</FileNumber>
<FileNumber>23</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
@ -578,7 +614,7 @@
</File>
<File>
<GroupNumber>5</GroupNumber>
<FileNumber>21</FileNumber>
<FileNumber>24</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
@ -590,7 +626,7 @@
</File>
<File>
<GroupNumber>5</GroupNumber>
<FileNumber>22</FileNumber>
<FileNumber>25</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
@ -602,7 +638,7 @@
</File>
<File>
<GroupNumber>5</GroupNumber>
<FileNumber>23</FileNumber>
<FileNumber>26</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
@ -614,7 +650,7 @@
</File>
<File>
<GroupNumber>5</GroupNumber>
<FileNumber>24</FileNumber>
<FileNumber>27</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
@ -626,7 +662,7 @@
</File>
<File>
<GroupNumber>5</GroupNumber>
<FileNumber>25</FileNumber>
<FileNumber>28</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
@ -638,7 +674,7 @@
</File>
<File>
<GroupNumber>5</GroupNumber>
<FileNumber>26</FileNumber>
<FileNumber>29</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
@ -650,7 +686,7 @@
</File>
<File>
<GroupNumber>5</GroupNumber>
<FileNumber>27</FileNumber>
<FileNumber>30</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
@ -662,7 +698,7 @@
</File>
<File>
<GroupNumber>5</GroupNumber>
<FileNumber>28</FileNumber>
<FileNumber>31</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
@ -674,7 +710,7 @@
</File>
<File>
<GroupNumber>5</GroupNumber>
<FileNumber>29</FileNumber>
<FileNumber>32</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
@ -686,7 +722,7 @@
</File>
<File>
<GroupNumber>5</GroupNumber>
<FileNumber>30</FileNumber>
<FileNumber>33</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
@ -698,7 +734,7 @@
</File>
<File>
<GroupNumber>5</GroupNumber>
<FileNumber>31</FileNumber>
<FileNumber>34</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
@ -710,7 +746,7 @@
</File>
<File>
<GroupNumber>5</GroupNumber>
<FileNumber>32</FileNumber>
<FileNumber>35</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
@ -722,7 +758,7 @@
</File>
<File>
<GroupNumber>5</GroupNumber>
<FileNumber>33</FileNumber>
<FileNumber>36</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
@ -734,7 +770,7 @@
</File>
<File>
<GroupNumber>5</GroupNumber>
<FileNumber>34</FileNumber>
<FileNumber>37</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
@ -746,7 +782,7 @@
</File>
<File>
<GroupNumber>5</GroupNumber>
<FileNumber>35</FileNumber>
<FileNumber>38</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
@ -758,7 +794,7 @@
</File>
<File>
<GroupNumber>5</GroupNumber>
<FileNumber>36</FileNumber>
<FileNumber>39</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
@ -778,7 +814,7 @@
<RteFlg>0</RteFlg>
<File>
<GroupNumber>6</GroupNumber>
<FileNumber>37</FileNumber>
<FileNumber>40</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
@ -798,7 +834,7 @@
<RteFlg>0</RteFlg>
<File>
<GroupNumber>7</GroupNumber>
<FileNumber>38</FileNumber>
<FileNumber>41</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
@ -810,7 +846,7 @@
</File>
<File>
<GroupNumber>7</GroupNumber>
<FileNumber>39</FileNumber>
<FileNumber>42</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
@ -822,7 +858,7 @@
</File>
<File>
<GroupNumber>7</GroupNumber>
<FileNumber>40</FileNumber>
<FileNumber>43</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
@ -834,7 +870,7 @@
</File>
<File>
<GroupNumber>7</GroupNumber>
<FileNumber>41</FileNumber>
<FileNumber>44</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
@ -846,7 +882,7 @@
</File>
<File>
<GroupNumber>7</GroupNumber>
<FileNumber>42</FileNumber>
<FileNumber>45</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>

View File

@ -7,7 +7,7 @@
<Targets>
<Target>
<TargetName>stm32f103rgtx_CAN_Request_Response_protocol</TargetName>
<TargetName>stm32f103rgtx_bootloader</TargetName>
<ToolsetNumber>0x4</ToolsetNumber>
<ToolsetName>ARM-ADS</ToolsetName>
<pArmCC>6190000::V6.19::ARMCLANG</pArmCC>
@ -395,6 +395,21 @@
<Group>
<GroupName>Application/User/Core</GroupName>
<Files>
<File>
<FileName>custom_flash.c</FileName>
<FileType>1</FileType>
<FilePath>..\Core\Src\custom_flash.c</FilePath>
</File>
<File>
<FileName>custom_flash.h</FileName>
<FileType>5</FileType>
<FilePath>..\Core\Inc\custom_flash.h</FilePath>
</File>
<File>
<FileName>boot_project_setup.h</FileName>
<FileType>5</FileType>
<FilePath>..\Core\Inc\boot_project_setup.h</FilePath>
</File>
<File>
<FileName>requester.h</FileName>
<FileType>5</FileType>
@ -844,7 +859,7 @@
<component Cclass="CMSIS" Cgroup="CORE" Cvendor="ARM" Cversion="5.6.0" condition="ARMv6_7_8-M Device">
<package name="CMSIS" schemaVersion="1.7.7" url="http://www.keil.com/pack/" vendor="ARM" version="5.9.0"/>
<targetInfos>
<targetInfo name="stm32f103rgtx_CAN_Request_Response_protocol"/>
<targetInfo name="stm32f103rgtx_bootloader"/>
</targetInfos>
</component>
</components>

View File

@ -1,2 +1,2 @@
# CAN_Request-Response_protocol
# stm32f103rgtx

View File

@ -1,62 +0,0 @@
#ifndef _new_can_protocol_ID_struct
#define _new_can_protocol_ID_struct
//Route mode
#define ROUTE_MASTER 0
#define ROUTE_SLAVE 1
//Data Types
#define DATA_TYPE_BROADCAST 0b0000
#define DATA_TYPE_DISCRETE 0b0001
#define DATA_TYPE_ANALOG 0b0010
#define DATA_TYPE_MODBUS_COIL 0b0011
#define DATA_TYPE_MODBUS_DISCRETE 0b0100
#define DATA_TYPE_MODBUS_HOLDING 0b0101
#define DATA_TYPE_MODBUS_INPUT 0b0110
#define DATA_TYPE_ERROR 0b0111
#define DATA_TYPE_PULSE 0b1111
//Sensor Types for DATA_TYPE_BROADCAST
#define SENSOR_TYPE_BROADCAST_STATUS 0b00000
#define SENSOR_TYPE_BROADCAST_ONOFF 0b00001
#define SENSOR_TYPE_BROADCAST_RESTARTDEVICE 0b00010
#define SENSOR_TYPE_BROADCAST_RTCSETUP 0b00011
//Sensor Types for DATA_TYPE_DISCRETE
#define SENSOR_TYPE_DISCRETE_ACCIDENT 0b00000
#define SENSOR_TYPE_DISCRETE_WARNING 0b00001
#define SENSOR_TYPE_DISCRETE_CONTROL_SIGNALS 0b00010
#define SENSOR_TYPE_DISCRETE_FLAGS 0b00011
#define SENSOR_TYPE_DISCRETE_RESET 0b00100
#define SENSOR_TYPE_DISCRETE_CHANGE_MODE 0b00101
#define SENSOR_TYPE_DISCRETE_REQUEST_LIST_OF_PARAMETERS 0b00110
//Sensor Types for DATA_TYPE_ANALOG
#define SENSOR_TYPE_ANALOG_UNIVERSAL 0b00000
#define SENSOR_TYPE_ANALOG_USTAVKI 0b00001
#define SENSOR_TYPE_ANALOG_U 0b00010
#define SENSOR_TYPE_ANALOG_I 0b00011
#define SENSOR_TYPE_ANALOG_T 0b00100
//Error Code
#define NONEXISTENT_ELEMENT 0x01
typedef union _extID{
struct extID_Standard_Fields{
unsigned DeviceID:8;
unsigned SensorID:11;
unsigned SensorType:5;
unsigned DataType:4;
unsigned Route:1;
}StandardFields;
struct extID_Modbus_Fields{
unsigned DeviceID:8;
unsigned CountReg:8;
unsigned StrAdr:8;
unsigned DataType:4;
unsigned Route:1;
}ModbusFields;
unsigned int BitAll:29;
}extID;
#endif

View File

@ -5,12 +5,12 @@ CAD.provider=
CAN.ABOM=ENABLE
CAN.BS1=CAN_BS1_13TQ
CAN.BS2=CAN_BS2_2TQ
CAN.CalculateBaudRate=1000000
CAN.CalculateTimeBit=1000
CAN.CalculateTimeQuantum=62.5
CAN.CalculateBaudRate=50000
CAN.CalculateTimeBit=20000
CAN.CalculateTimeQuantum=1250.0
CAN.IPParameters=CalculateTimeQuantum,CalculateTimeBit,CalculateBaudRate,Prescaler,BS2,BS1,SJW,ABOM,TXFP,Mode
CAN.Mode=CAN_MODE_LOOPBACK
CAN.Prescaler=2
CAN.Prescaler=40
CAN.SJW=CAN_SJW_1TQ
CAN.TXFP=ENABLE
Dma.Request0=SDIO
@ -169,8 +169,8 @@ ProjectManager.MainLocation=Core/Src
ProjectManager.NoMain=false
ProjectManager.PreviousToolchain=
ProjectManager.ProjectBuild=false
ProjectManager.ProjectFileName=CAN_Request-Response_protocol.ioc
ProjectManager.ProjectName=CAN_Request-Response_protocol
ProjectManager.ProjectFileName=stm32f103rgtx_bootloader.ioc
ProjectManager.ProjectName=stm32f103rgtx_bootloader
ProjectManager.ProjectStructure=
ProjectManager.RegisterCallBack=
ProjectManager.StackSize=0x400
@ -209,8 +209,8 @@ RTC.IPParameters=Format,AutoPrediv
SDIO.ClockDiv=4
SDIO.IPParameters=ClockDiv
TIM7.IPParameters=Prescaler,Period
TIM7.Period=1000
TIM7.Prescaler=64000-1
TIM7.Period=3000
TIM7.Prescaler=8000-1
USART3.BaudRate=9600*2
USART3.IPParameters=VirtualMode,BaudRate
USART3.VirtualMode=VM_ASYNC