more code
This commit is contained in:
26
code/Core/Inc/crc.h
Normal file
26
code/Core/Inc/crc.h
Normal file
@@ -0,0 +1,26 @@
|
||||
/*
|
||||
* crc.h
|
||||
*
|
||||
* Created on: 19 Dec 2025
|
||||
* Author: janik
|
||||
*/
|
||||
|
||||
#ifndef INC_CRC_H_
|
||||
#define INC_CRC_H_
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
|
||||
typedef struct {
|
||||
uint32_t crc;
|
||||
} CRC8_107;
|
||||
|
||||
static inline void CRC8_107_init(CRC8_107 *ctx)
|
||||
{
|
||||
ctx->crc = 0x0u;
|
||||
}
|
||||
|
||||
void CRC8_107_add(CRC8_107 *ctx, uint8_t data);
|
||||
uint8_t CRC8_107_getChecksum(const CRC8_107 *ctx);
|
||||
|
||||
#endif /* INC_CRC_H_ */
|
||||
140
code/Core/Inc/photon_protocol.h
Normal file
140
code/Core/Inc/photon_protocol.h
Normal file
@@ -0,0 +1,140 @@
|
||||
/*
|
||||
* photon_protocol.h
|
||||
*
|
||||
* Created on: 19 Dec 2025
|
||||
* Author: janik
|
||||
*/
|
||||
|
||||
#ifndef INC_PHOTON_PROTOCOL_H_
|
||||
#define INC_PHOTON_PROTOCOL_H_
|
||||
|
||||
#define UUID_LENGTH 12 // 12 8bit values
|
||||
#define PHOTON_NETWORK_CONTROLLER_ADDRESS 0x00
|
||||
#define PHOTON_NETWORK_BROADCAST_ADDRESS 0xFF
|
||||
#define VENDOR_SPECIFIC_OPTIONS_LENGTH 16
|
||||
|
||||
|
||||
typedef enum {
|
||||
STATUS_OK = 0x00,
|
||||
STATUS_WRONG_FEEDER_ID = 0x01,
|
||||
STATUS_COULDNT_REACH = 0x02,
|
||||
STATUS_UNINITIALIZED_FEEDER = 0x03,
|
||||
STATUS_FEEDING_IN_PROGRESS = 0x04,
|
||||
STATUS_FAIL = 0x05,
|
||||
|
||||
STATUS_TIMEOUT = 0xFE,
|
||||
STATUS_UNKNOWN_ERROR = 0xFF
|
||||
} FeederStatus;
|
||||
|
||||
typedef enum {
|
||||
// Unicast Commands
|
||||
GET_FEEDER_ID = 0x01,
|
||||
INITIALIZE_FEEDER = 0x02,
|
||||
GET_VERSION = 0x03,
|
||||
MOVE_FEED_FORWARD = 0x04,
|
||||
MOVE_FEED_BACKWARD = 0x05,
|
||||
MOVE_FEED_STATUS = 0x06,
|
||||
|
||||
VENDOR_OPTIONS = 0xbf,
|
||||
|
||||
// Broadcast Commands
|
||||
GET_FEEDER_ADDRESS = 0xc0,
|
||||
IDENTIFY_FEEDER = 0xc1,
|
||||
PROGRAM_FEEDER_FLOOR = 0xc2,
|
||||
UNINITIALIZED_FEEDERS_RESPOND = 0xc3
|
||||
// EXTENDED_COMMAND = 0xff, Unused, reserved for future use
|
||||
} FeederCommand;
|
||||
|
||||
|
||||
|
||||
/* ---------- Packet Header ---------- */
|
||||
|
||||
typedef struct __attribute__((packed)) {
|
||||
uint8_t toAddress;
|
||||
uint8_t fromAddress;
|
||||
uint8_t packetId;
|
||||
uint8_t payloadLength;
|
||||
uint8_t crc;
|
||||
} PhotonPacketHeader;
|
||||
|
||||
/* ---------- Command Payloads ---------- */
|
||||
|
||||
typedef struct __attribute__((packed)) {
|
||||
uint8_t distance;
|
||||
} MoveCommand;
|
||||
|
||||
typedef struct __attribute__((packed)) {
|
||||
uint8_t uuid[UUID_LENGTH];
|
||||
} GetFeederAddressCommand;
|
||||
|
||||
typedef struct __attribute__((packed)) {
|
||||
uint8_t uuid[UUID_LENGTH];
|
||||
} InitializeFeederCommand;
|
||||
|
||||
typedef struct __attribute__((packed)) {
|
||||
uint8_t options[VENDOR_SPECIFIC_OPTIONS_LENGTH];
|
||||
} VendorOptionsCommand;
|
||||
|
||||
typedef struct __attribute__((packed)) {
|
||||
uint8_t uuid[UUID_LENGTH];
|
||||
uint8_t address;
|
||||
} ProgramFeederFloorAddressCommand;
|
||||
|
||||
typedef struct __attribute__((packed)) {
|
||||
uint8_t uuid[UUID_LENGTH];
|
||||
} IdentifyFeederCommand;
|
||||
|
||||
/* ---------- Full Command Packet ---------- */
|
||||
|
||||
typedef struct __attribute__((packed)) {
|
||||
PhotonPacketHeader header;
|
||||
uint8_t commandId;
|
||||
union {
|
||||
MoveCommand move;
|
||||
GetFeederAddressCommand getFeederAddress;
|
||||
InitializeFeederCommand initializeFeeder;
|
||||
VendorOptionsCommand vendorOptions;
|
||||
ProgramFeederFloorAddressCommand programFeederFloorAddress;
|
||||
IdentifyFeederCommand identifyFeeder;
|
||||
} payload;
|
||||
} PhotonCommand;
|
||||
|
||||
/* ---------- Response Payloads ---------- */
|
||||
|
||||
typedef struct __attribute__((packed)) {
|
||||
uint8_t uuid[UUID_LENGTH];
|
||||
} GetFeederIdResponse;
|
||||
|
||||
typedef struct __attribute__((packed)) {
|
||||
uint8_t uuid[UUID_LENGTH];
|
||||
} InitializeFeederResponse;
|
||||
|
||||
typedef struct __attribute__((packed)) {
|
||||
uint8_t version;
|
||||
} GetProtocolVersionResponse;
|
||||
|
||||
typedef struct __attribute__((packed)) {
|
||||
uint16_t expectedFeedTime;
|
||||
} FeedDistanceResponse;
|
||||
|
||||
typedef struct __attribute__((packed)) {
|
||||
uint8_t options[VENDOR_SPECIFIC_OPTIONS_LENGTH];
|
||||
} VendorOptionsResponse;
|
||||
|
||||
/* ---------- Full Response Packet ---------- */
|
||||
|
||||
typedef struct __attribute__((packed)) {
|
||||
PhotonPacketHeader header;
|
||||
uint8_t status;
|
||||
union {
|
||||
GetFeederIdResponse getFeederId;
|
||||
InitializeFeederResponse initializeFeeder;
|
||||
GetProtocolVersionResponse protocolVersion;
|
||||
FeedDistanceResponse expectedTimeToFeed;
|
||||
VendorOptionsResponse vendorOptions;
|
||||
} payload;
|
||||
} PhotonResponse;
|
||||
|
||||
|
||||
|
||||
#endif /* INC_PHOTON_PROTOCOL_H_ */
|
||||
137
code/Core/Inc/pid.h
Normal file
137
code/Core/Inc/pid.h
Normal file
@@ -0,0 +1,137 @@
|
||||
/*
|
||||
* pid.h
|
||||
*
|
||||
* Created on: 19 Dec 2025
|
||||
* Author: janik
|
||||
*/
|
||||
|
||||
#ifndef INC_PID_H_
|
||||
#define INC_PID_H_
|
||||
|
||||
// pid_motor_wrap_i32.h
|
||||
typedef struct
|
||||
{
|
||||
// Gains
|
||||
int32_t kp;
|
||||
int32_t ki;
|
||||
int32_t kd;
|
||||
|
||||
// State
|
||||
int32_t integrator;
|
||||
int32_t prev_error;
|
||||
|
||||
// Limits
|
||||
int32_t integrator_min;
|
||||
int32_t integrator_max;
|
||||
int32_t out_max; // max |u|, e.g. 2400
|
||||
|
||||
// Slew limit
|
||||
int32_t max_output_step; // max |u(k) - u(k-1)| per control step
|
||||
int32_t last_output; // u(k-1)
|
||||
} pid_i32_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint16_t pwm; // 0..out_max
|
||||
uint8_t dir; // 0 or 1
|
||||
} pid_motor_cmd_t;
|
||||
|
||||
static inline int32_t clamp_i32(int32_t x, int32_t lo, int32_t hi)
|
||||
{
|
||||
if (x < lo) return lo;
|
||||
if (x > hi) return hi;
|
||||
return x;
|
||||
}
|
||||
|
||||
static inline void pid_init(pid_i32_t *pid,
|
||||
int32_t kp,
|
||||
int32_t ki,
|
||||
int32_t kd,
|
||||
int32_t integrator_min,
|
||||
int32_t integrator_max,
|
||||
int32_t out_max,
|
||||
int32_t max_output_step)
|
||||
{
|
||||
pid->kp = kp;
|
||||
pid->ki = ki;
|
||||
pid->kd = kd;
|
||||
|
||||
pid->integrator = 0;
|
||||
pid->prev_error = 0;
|
||||
|
||||
pid->integrator_min = integrator_min;
|
||||
pid->integrator_max = integrator_max;
|
||||
pid->out_max = out_max;
|
||||
|
||||
pid->max_output_step = max_output_step;
|
||||
pid->last_output = 0;
|
||||
}
|
||||
|
||||
static inline void pid_reset(pid_i32_t *pid)
|
||||
{
|
||||
pid->integrator = 0;
|
||||
pid->prev_error = 0;
|
||||
pid->last_output = 0;
|
||||
}
|
||||
|
||||
static inline pid_motor_cmd_t pid_update_motor(pid_i32_t *pid,
|
||||
int32_t setpoint,
|
||||
int32_t position)
|
||||
{
|
||||
pid_motor_cmd_t cmd;
|
||||
|
||||
// Basic PID (no overflow protection, as requested)
|
||||
int32_t error = setpoint - position;
|
||||
|
||||
int32_t p = pid->kp * error;
|
||||
|
||||
int32_t i = pid->integrator + pid->ki * error;
|
||||
i = clamp_i32(i, pid->integrator_min, pid->integrator_max);
|
||||
pid->integrator = i;
|
||||
|
||||
int32_t d_error = error - pid->prev_error;
|
||||
int32_t d = pid->kd * d_error;
|
||||
pid->prev_error = error;
|
||||
|
||||
// Raw control effort
|
||||
int32_t u_raw = p + i + d;
|
||||
|
||||
// Clamp to [-out_max, +out_max]
|
||||
if (u_raw > pid->out_max) u_raw = pid->out_max;
|
||||
if (u_raw < -pid->out_max) u_raw = -pid->out_max;
|
||||
|
||||
// ---------- Slew limit: avoid instant full reverse ----------
|
||||
int32_t u_prev = pid->last_output;
|
||||
int32_t u = u_raw;
|
||||
|
||||
int32_t max_step = pid->max_output_step;
|
||||
if (max_step > 0) {
|
||||
int32_t du = u_raw - u_prev;
|
||||
|
||||
if (du > max_step) {
|
||||
u = u_prev + max_step;
|
||||
} else if (du < -max_step) {
|
||||
u = u_prev - max_step;
|
||||
} else {
|
||||
u = u_raw;
|
||||
}
|
||||
}
|
||||
|
||||
// Save for next time
|
||||
pid->last_output = u;
|
||||
|
||||
// Map signed u to dir + pwm
|
||||
if (u >= 0) {
|
||||
cmd.dir = 1;
|
||||
cmd.pwm = (uint16_t)u;
|
||||
} else {
|
||||
cmd.dir = 0;
|
||||
cmd.pwm = (uint16_t)(-u);
|
||||
}
|
||||
|
||||
if (cmd.pwm > pid->out_max)
|
||||
cmd.pwm = (uint16_t)pid->out_max;
|
||||
|
||||
return cmd;
|
||||
}
|
||||
#endif /* INC_PID_H_ */
|
||||
@@ -53,6 +53,7 @@ void PendSV_Handler(void);
|
||||
void SysTick_Handler(void);
|
||||
void EXTI4_15_IRQHandler(void);
|
||||
void DMA1_Channel1_IRQHandler(void);
|
||||
void DMA1_Channel2_3_IRQHandler(void);
|
||||
void TIM14_IRQHandler(void);
|
||||
void TIM16_IRQHandler(void);
|
||||
void TIM17_IRQHandler(void);
|
||||
|
||||
24
code/Core/Src/crc.c
Normal file
24
code/Core/Src/crc.c
Normal file
@@ -0,0 +1,24 @@
|
||||
/*
|
||||
* crc.c
|
||||
*
|
||||
* Created on: 19 Dec 2025
|
||||
* Author: janik
|
||||
*/
|
||||
|
||||
#include "crc.h"
|
||||
|
||||
void CRC8_107_add(CRC8_107 *ctx, uint8_t data)
|
||||
{
|
||||
ctx->crc ^= ((uint32_t)data << 8);
|
||||
for (size_t bit_n = 0; bit_n < 8; bit_n++) {
|
||||
if (ctx->crc & 0x8000u) {
|
||||
ctx->crc ^= ((uint32_t)0x1070u << 3); // same as 0x8380
|
||||
}
|
||||
ctx->crc <<= 1;
|
||||
}
|
||||
}
|
||||
|
||||
uint8_t CRC8_107_getChecksum(const CRC8_107 *ctx)
|
||||
{
|
||||
return (uint8_t)(ctx->crc >> 8);
|
||||
}
|
||||
@@ -21,6 +21,12 @@
|
||||
|
||||
/* Private includes ----------------------------------------------------------*/
|
||||
/* USER CODE BEGIN Includes */
|
||||
#include "photon_protocol.h"
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdint.h>
|
||||
#include "pid.h"
|
||||
#include "crc.h"
|
||||
|
||||
/* USER CODE END Includes */
|
||||
|
||||
@@ -37,6 +43,12 @@
|
||||
#define CNT_MAX 65535
|
||||
#define CNT_LIMIT_ZONE 1000
|
||||
|
||||
#define UUID_LENGTH 12 // 12 8bit values
|
||||
#define PHOTON_NETWORK_CONTROLLER_ADDRESS 0x00
|
||||
#define PHOTON_NETWORK_BROADCAST_ADDRESS 0xFF
|
||||
#define PWM_MAX 2400
|
||||
#define MAX_PWM_DIFFERENCE 10
|
||||
|
||||
/* USER CODE END PD */
|
||||
|
||||
/* Private macro -------------------------------------------------------------*/
|
||||
@@ -51,16 +63,35 @@ TIM_HandleTypeDef htim3;
|
||||
TIM_HandleTypeDef htim14;
|
||||
TIM_HandleTypeDef htim16;
|
||||
TIM_HandleTypeDef htim17;
|
||||
DMA_HandleTypeDef hdma_tim3_up;
|
||||
|
||||
UART_HandleTypeDef huart1;
|
||||
UART_HandleTypeDef huart2;
|
||||
DMA_HandleTypeDef hdma_usart2_rx;
|
||||
DMA_HandleTypeDef hdma_usart2_tx;
|
||||
|
||||
/* USER CODE BEGIN PV */
|
||||
uint8_t sw1_pressed,sw2_pressed = 0;
|
||||
int32_t encoder_count_extra=0;
|
||||
uint16_t encoder_previous=0;
|
||||
|
||||
uint8_t UUID[UUID_LENGTH];
|
||||
uint8_t is_initialized=0;
|
||||
uint8_t network_buffer_RX[64];
|
||||
uint8_t msg_buffer1_empty = 1;
|
||||
uint8_t msg_buffer2_empty = 1;
|
||||
uint8_t msg_buffer1 [64];
|
||||
uint8_t msg_buffer2 [64];
|
||||
uint8_t DMA_buffer[64];
|
||||
uint8_t my_address = 0xFF;
|
||||
int32_t total_count = 0;
|
||||
int32_t target_count = 0;
|
||||
int32_t kp = 4;
|
||||
int32_t ki = 1;
|
||||
int32_t kd = 0;
|
||||
int32_t i_min = -500;
|
||||
int32_t i_max = 500;
|
||||
int32_t pid_max_step = 10;
|
||||
pid_i32_t motor_pid;
|
||||
pid_motor_cmd_t motor_cmd;
|
||||
/* USER CODE END PV */
|
||||
|
||||
/* Private function prototypes -----------------------------------------------*/
|
||||
@@ -76,6 +107,10 @@ static void MX_TIM17_Init(void);
|
||||
static void MX_TIM14_Init(void);
|
||||
/* USER CODE BEGIN PFP */
|
||||
|
||||
void set_LED (uint8_t R, uint8_t G, uint8_t B);
|
||||
void handleRS485Message(uint8_t *buffer, uint8_t size);
|
||||
void set_Feeder_PWM(uint16_t PWM, uint8_t direction);
|
||||
|
||||
/* USER CODE END PFP */
|
||||
|
||||
/* Private user code ---------------------------------------------------------*/
|
||||
@@ -101,6 +136,8 @@ int main(void)
|
||||
|
||||
/* USER CODE BEGIN Init */
|
||||
|
||||
pid_init(&motor_pid,kp,ki,kd,i_min,i_max,PWM_MAX,pid_max_step);
|
||||
|
||||
/* USER CODE END Init */
|
||||
|
||||
/* Configure the system clock */
|
||||
@@ -122,12 +159,67 @@ int main(void)
|
||||
MX_TIM14_Init();
|
||||
/* USER CODE BEGIN 2 */
|
||||
|
||||
uint32_t * puuid = (uint32_t *)UUID;
|
||||
*puuid = HAL_GetUIDw0();
|
||||
*(puuid+1) = HAL_GetUIDw1();
|
||||
*(puuid+2) = HAL_GetUIDw2();
|
||||
|
||||
HAL_UARTEx_ReceiveToIdle_DMA (&huart2,DMA_buffer,64);
|
||||
|
||||
/* USER CODE END 2 */
|
||||
|
||||
/* Infinite loop */
|
||||
/* USER CODE BEGIN WHILE */
|
||||
while (1)
|
||||
{
|
||||
if (sw1_pressed)
|
||||
{
|
||||
uint16_t time_pressed = htim16.Instance->CNT;
|
||||
if ((HAL_GPIO_ReadPin(SW1_GPIO_Port,SW1_Pin)) && (time_pressed > 750)) // button still pressed
|
||||
{
|
||||
// todo long button action
|
||||
}
|
||||
else if (!HAL_GPIO_ReadPin(SW1_GPIO_Port,SW1_Pin) && (time_pressed <= 750) && (time_pressed >75)) // release in short window
|
||||
{
|
||||
// todo short button action
|
||||
sw1_pressed = 0;
|
||||
}
|
||||
else if (!HAL_GPIO_ReadPin(SW1_GPIO_Port,SW1_Pin)) sw1_pressed = 0; // release in long window
|
||||
}
|
||||
|
||||
if (sw2_pressed)
|
||||
{
|
||||
uint16_t time_pressed = htim17.Instance->CNT;
|
||||
if ((HAL_GPIO_ReadPin(SW2_GPIO_Port,SW2_Pin)) && (time_pressed > 750)) // button still pressed
|
||||
{
|
||||
// todo long button action
|
||||
}
|
||||
else if (!HAL_GPIO_ReadPin(SW2_GPIO_Port,SW2_Pin) && (time_pressed <= 750)) // release in short window
|
||||
{
|
||||
// todo short button action
|
||||
sw2_pressed = 0;
|
||||
}
|
||||
else if (!HAL_GPIO_ReadPin(SW2_GPIO_Port,SW2_Pin)) sw2_pressed = 0; // release in long window
|
||||
}
|
||||
|
||||
if (!msg_buffer2_empty) // msg 2 buffer has a message
|
||||
{
|
||||
// decode message from msg_buffer2
|
||||
for (uint8_t i = 0; i<64 ; i++)
|
||||
{
|
||||
msg_buffer2[i]=0;
|
||||
}
|
||||
msg_buffer2_empty = 1;
|
||||
}
|
||||
if (!msg_buffer1_empty)
|
||||
{
|
||||
for (uint8_t i = 0; i<64 ; i++)
|
||||
{
|
||||
msg_buffer1[i]=0;
|
||||
}
|
||||
msg_buffer1_empty = 1;
|
||||
}
|
||||
|
||||
|
||||
/* USER CODE END WHILE */
|
||||
|
||||
@@ -476,7 +568,7 @@ static void MX_USART2_UART_Init(void)
|
||||
|
||||
/* USER CODE END USART2_Init 1 */
|
||||
huart2.Instance = USART2;
|
||||
huart2.Init.BaudRate = 115200;
|
||||
huart2.Init.BaudRate = 57600;
|
||||
huart2.Init.WordLength = UART_WORDLENGTH_8B;
|
||||
huart2.Init.StopBits = UART_STOPBITS_1;
|
||||
huart2.Init.Parity = UART_PARITY_NONE;
|
||||
@@ -490,11 +582,11 @@ static void MX_USART2_UART_Init(void)
|
||||
{
|
||||
Error_Handler();
|
||||
}
|
||||
if (HAL_UARTEx_SetTxFifoThreshold(&huart2, UART_TXFIFO_THRESHOLD_1_8) != HAL_OK)
|
||||
if (HAL_UARTEx_SetTxFifoThreshold(&huart2, UART_TXFIFO_THRESHOLD_1_2) != HAL_OK)
|
||||
{
|
||||
Error_Handler();
|
||||
}
|
||||
if (HAL_UARTEx_SetRxFifoThreshold(&huart2, UART_RXFIFO_THRESHOLD_1_8) != HAL_OK)
|
||||
if (HAL_UARTEx_SetRxFifoThreshold(&huart2, UART_RXFIFO_THRESHOLD_1_2) != HAL_OK)
|
||||
{
|
||||
Error_Handler();
|
||||
}
|
||||
@@ -521,6 +613,9 @@ static void MX_DMA_Init(void)
|
||||
/* DMA1_Channel1_IRQn interrupt configuration */
|
||||
HAL_NVIC_SetPriority(DMA1_Channel1_IRQn, 0, 0);
|
||||
HAL_NVIC_EnableIRQ(DMA1_Channel1_IRQn);
|
||||
/* DMA1_Channel2_3_IRQn interrupt configuration */
|
||||
HAL_NVIC_SetPriority(DMA1_Channel2_3_IRQn, 0, 0);
|
||||
HAL_NVIC_EnableIRQ(DMA1_Channel2_3_IRQn);
|
||||
|
||||
}
|
||||
|
||||
@@ -595,8 +690,20 @@ void HAL_TIM_PeriodElapsedCallback (TIM_HandleTypeDef * htim)
|
||||
return;
|
||||
}
|
||||
|
||||
int32_t total_count = (encoder_count_extra * CNT_MAX) + count;
|
||||
// todo run PID on target position with previous error and current error (assume previous target == current target)
|
||||
total_count = (encoder_count_extra * CNT_MAX) + count;
|
||||
if (total_count > INT32_MAX/2)
|
||||
{
|
||||
total_count-= INT32_MAX/4;
|
||||
target_count-= INT32_MAX/4;
|
||||
}
|
||||
else if (total_count < INT32_MIN/2)
|
||||
{
|
||||
total_count+= INT32_MAX/4;
|
||||
target_count+= INT32_MAX/4;
|
||||
}
|
||||
|
||||
motor_cmd = pid_update_motor(&motor_pid,target_count,total_count);
|
||||
set_Feeder_PWM(motor_cmd.pwm,motor_cmd.dir);
|
||||
|
||||
}
|
||||
if (htim == &htim3) return; // PWM timer
|
||||
@@ -638,6 +745,102 @@ void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin)
|
||||
}
|
||||
}
|
||||
|
||||
void HAL_UARTEx_RxEventCallback(UART_HandleTypeDef *huart, uint16_t Size)
|
||||
{
|
||||
if (Size > 64) return; // todo error handling
|
||||
if (msg_buffer1_empty)
|
||||
{
|
||||
memcpy(DMA_buffer,msg_buffer1,Size);
|
||||
msg_buffer1_empty = 0;
|
||||
}
|
||||
else if (msg_buffer2_empty)
|
||||
{
|
||||
memcpy(DMA_buffer,msg_buffer2,Size);
|
||||
msg_buffer2_empty = 0;
|
||||
}
|
||||
else // no free buffer available todo error handling
|
||||
{
|
||||
return;
|
||||
}
|
||||
HAL_UARTEx_ReceiveToIdle_DMA(&huart2, DMA_buffer, 64);
|
||||
}
|
||||
|
||||
void set_LED (uint8_t R, uint8_t G, uint8_t B)
|
||||
{
|
||||
if (R) R = GPIO_PIN_SET;
|
||||
if (G) G = GPIO_PIN_SET;
|
||||
if (B) B = GPIO_PIN_SET;
|
||||
HAL_GPIO_WritePin(LED_R_GPIO_Port,LED_R_Pin,R);
|
||||
HAL_GPIO_WritePin(LED_G_GPIO_Port,LED_G_Pin,G);
|
||||
HAL_GPIO_WritePin(LED_B_GPIO_Port,LED_B_Pin,B);
|
||||
}
|
||||
|
||||
void handleRS485Message(uint8_t *buffer, uint8_t size)
|
||||
{
|
||||
PhotonPacketHeader *header = (PhotonPacketHeader *) buffer;
|
||||
// check if message is for this device or is broadcast
|
||||
if (!(header->toAddress == PHOTON_NETWORK_BROADCAST_ADDRESS))
|
||||
{
|
||||
if (!(header->toAddress == my_address))
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
else // this message is relevant to this device
|
||||
{
|
||||
PhotonCommand *command = (PhotonCommand *) buffer;
|
||||
PhotonResponse response;
|
||||
response.header.fromAddress = my_address;
|
||||
response.header.packetId = command->header.packetId;
|
||||
response.header.toAddress = command->header.fromAddress;
|
||||
switch (command->commandId)
|
||||
{
|
||||
case GET_FEEDER_ID:
|
||||
|
||||
break;
|
||||
case INITIALIZE_FEEDER:
|
||||
break;
|
||||
case GET_VERSION:
|
||||
break;
|
||||
case MOVE_FEED_FORWARD:
|
||||
break;
|
||||
case MOVE_FEED_BACKWARD:
|
||||
break;
|
||||
case MOVE_FEED_STATUS:
|
||||
break;
|
||||
case VENDOR_OPTIONS:
|
||||
break;
|
||||
case GET_FEEDER_ADDRESS:
|
||||
break;
|
||||
case IDENTIFY_FEEDER:
|
||||
break;
|
||||
case PROGRAM_FEEDER_FLOOR:
|
||||
break;
|
||||
case UNINITIALIZED_FEEDERS_RESPOND:
|
||||
break;
|
||||
default:
|
||||
// todo error handling
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
void set_Feeder_PWM(uint16_t PWM, uint8_t direction)
|
||||
{
|
||||
if (direction)
|
||||
{
|
||||
htim1.Instance->CCR1 = PWM;
|
||||
htim1.Instance->CCR2 = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
htim1.Instance->CCR1 = 0;
|
||||
htim1.Instance->CCR2 = PWM;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* USER CODE END 4 */
|
||||
|
||||
|
||||
@@ -23,7 +23,9 @@
|
||||
/* USER CODE BEGIN Includes */
|
||||
|
||||
/* USER CODE END Includes */
|
||||
extern DMA_HandleTypeDef hdma_tim3_up;
|
||||
extern DMA_HandleTypeDef hdma_usart2_rx;
|
||||
|
||||
extern DMA_HandleTypeDef hdma_usart2_tx;
|
||||
|
||||
/* Private typedef -----------------------------------------------------------*/
|
||||
/* USER CODE BEGIN TD */
|
||||
@@ -173,24 +175,6 @@ void HAL_TIM_Encoder_MspInit(TIM_HandleTypeDef* htim_encoder)
|
||||
GPIO_InitStruct.Alternate = GPIO_AF1_TIM3;
|
||||
HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);
|
||||
|
||||
/* TIM3 DMA Init */
|
||||
/* TIM3_UP Init */
|
||||
hdma_tim3_up.Instance = DMA1_Channel1;
|
||||
hdma_tim3_up.Init.Request = DMA_REQUEST_TIM3_UP;
|
||||
hdma_tim3_up.Init.Direction = DMA_PERIPH_TO_MEMORY;
|
||||
hdma_tim3_up.Init.PeriphInc = DMA_PINC_DISABLE;
|
||||
hdma_tim3_up.Init.MemInc = DMA_MINC_ENABLE;
|
||||
hdma_tim3_up.Init.PeriphDataAlignment = DMA_PDATAALIGN_HALFWORD;
|
||||
hdma_tim3_up.Init.MemDataAlignment = DMA_MDATAALIGN_HALFWORD;
|
||||
hdma_tim3_up.Init.Mode = DMA_NORMAL;
|
||||
hdma_tim3_up.Init.Priority = DMA_PRIORITY_LOW;
|
||||
if (HAL_DMA_Init(&hdma_tim3_up) != HAL_OK)
|
||||
{
|
||||
Error_Handler();
|
||||
}
|
||||
|
||||
__HAL_LINKDMA(htim_encoder,hdma[TIM_DMA_ID_UPDATE],hdma_tim3_up);
|
||||
|
||||
/* USER CODE BEGIN TIM3_MspInit 1 */
|
||||
|
||||
/* USER CODE END TIM3_MspInit 1 */
|
||||
@@ -321,8 +305,6 @@ void HAL_TIM_Encoder_MspDeInit(TIM_HandleTypeDef* htim_encoder)
|
||||
*/
|
||||
HAL_GPIO_DeInit(GPIOC, QUAD_A_Pin|QUAD_B_Pin);
|
||||
|
||||
/* TIM3 DMA DeInit */
|
||||
HAL_DMA_DeInit(htim_encoder->hdma[TIM_DMA_ID_UPDATE]);
|
||||
/* USER CODE BEGIN TIM3_MspDeInit 1 */
|
||||
|
||||
/* USER CODE END TIM3_MspDeInit 1 */
|
||||
@@ -396,6 +378,41 @@ void HAL_UART_MspInit(UART_HandleTypeDef* huart)
|
||||
GPIO_InitStruct.Alternate = GPIO_AF1_USART2;
|
||||
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
|
||||
|
||||
/* USART2 DMA Init */
|
||||
/* USART2_RX Init */
|
||||
hdma_usart2_rx.Instance = DMA1_Channel2;
|
||||
hdma_usart2_rx.Init.Request = DMA_REQUEST_USART2_RX;
|
||||
hdma_usart2_rx.Init.Direction = DMA_PERIPH_TO_MEMORY;
|
||||
hdma_usart2_rx.Init.PeriphInc = DMA_PINC_DISABLE;
|
||||
hdma_usart2_rx.Init.MemInc = DMA_MINC_ENABLE;
|
||||
hdma_usart2_rx.Init.PeriphDataAlignment = DMA_PDATAALIGN_BYTE;
|
||||
hdma_usart2_rx.Init.MemDataAlignment = DMA_MDATAALIGN_BYTE;
|
||||
hdma_usart2_rx.Init.Mode = DMA_NORMAL;
|
||||
hdma_usart2_rx.Init.Priority = DMA_PRIORITY_MEDIUM;
|
||||
if (HAL_DMA_Init(&hdma_usart2_rx) != HAL_OK)
|
||||
{
|
||||
Error_Handler();
|
||||
}
|
||||
|
||||
__HAL_LINKDMA(huart,hdmarx,hdma_usart2_rx);
|
||||
|
||||
/* USART2_TX Init */
|
||||
hdma_usart2_tx.Instance = DMA1_Channel1;
|
||||
hdma_usart2_tx.Init.Request = DMA_REQUEST_USART2_TX;
|
||||
hdma_usart2_tx.Init.Direction = DMA_MEMORY_TO_PERIPH;
|
||||
hdma_usart2_tx.Init.PeriphInc = DMA_PINC_DISABLE;
|
||||
hdma_usart2_tx.Init.MemInc = DMA_MINC_ENABLE;
|
||||
hdma_usart2_tx.Init.PeriphDataAlignment = DMA_PDATAALIGN_BYTE;
|
||||
hdma_usart2_tx.Init.MemDataAlignment = DMA_MDATAALIGN_BYTE;
|
||||
hdma_usart2_tx.Init.Mode = DMA_NORMAL;
|
||||
hdma_usart2_tx.Init.Priority = DMA_PRIORITY_HIGH;
|
||||
if (HAL_DMA_Init(&hdma_usart2_tx) != HAL_OK)
|
||||
{
|
||||
Error_Handler();
|
||||
}
|
||||
|
||||
__HAL_LINKDMA(huart,hdmatx,hdma_usart2_tx);
|
||||
|
||||
/* USER CODE BEGIN USART2_MspInit 1 */
|
||||
|
||||
/* USER CODE END USART2_MspInit 1 */
|
||||
@@ -444,6 +461,9 @@ void HAL_UART_MspDeInit(UART_HandleTypeDef* huart)
|
||||
*/
|
||||
HAL_GPIO_DeInit(GPIOA, GPIO_PIN_1|GPIO_PIN_4|GPIO_PIN_5);
|
||||
|
||||
/* USART2 DMA DeInit */
|
||||
HAL_DMA_DeInit(huart->hdmarx);
|
||||
HAL_DMA_DeInit(huart->hdmatx);
|
||||
/* USER CODE BEGIN USART2_MspDeInit 1 */
|
||||
|
||||
/* USER CODE END USART2_MspDeInit 1 */
|
||||
|
||||
@@ -55,10 +55,11 @@
|
||||
/* USER CODE END 0 */
|
||||
|
||||
/* External variables --------------------------------------------------------*/
|
||||
extern DMA_HandleTypeDef hdma_tim3_up;
|
||||
extern TIM_HandleTypeDef htim14;
|
||||
extern TIM_HandleTypeDef htim16;
|
||||
extern TIM_HandleTypeDef htim17;
|
||||
extern DMA_HandleTypeDef hdma_usart2_rx;
|
||||
extern DMA_HandleTypeDef hdma_usart2_tx;
|
||||
/* USER CODE BEGIN EV */
|
||||
|
||||
/* USER CODE END EV */
|
||||
@@ -166,12 +167,26 @@ void DMA1_Channel1_IRQHandler(void)
|
||||
/* USER CODE BEGIN DMA1_Channel1_IRQn 0 */
|
||||
|
||||
/* USER CODE END DMA1_Channel1_IRQn 0 */
|
||||
HAL_DMA_IRQHandler(&hdma_tim3_up);
|
||||
HAL_DMA_IRQHandler(&hdma_usart2_tx);
|
||||
/* USER CODE BEGIN DMA1_Channel1_IRQn 1 */
|
||||
|
||||
/* USER CODE END DMA1_Channel1_IRQn 1 */
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief This function handles DMA1 channel 2 and channel 3 interrupts.
|
||||
*/
|
||||
void DMA1_Channel2_3_IRQHandler(void)
|
||||
{
|
||||
/* USER CODE BEGIN DMA1_Channel2_3_IRQn 0 */
|
||||
|
||||
/* USER CODE END DMA1_Channel2_3_IRQn 0 */
|
||||
HAL_DMA_IRQHandler(&hdma_usart2_rx);
|
||||
/* USER CODE BEGIN DMA1_Channel2_3_IRQn 1 */
|
||||
|
||||
/* USER CODE END DMA1_Channel2_3_IRQn 1 */
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief This function handles TIM14 global interrupt.
|
||||
*/
|
||||
|
||||
@@ -1,13 +1,21 @@
|
||||
../Core/Src/main.c:85:5:main 1
|
||||
../Core/Src/main.c:136:6:SystemClock_Config 3
|
||||
../Core/Src/main.c:175:13:MX_TIM1_Init 10
|
||||
../Core/Src/main.c:269:13:MX_TIM3_Init 3
|
||||
../Core/Src/main.c:318:13:MX_TIM16_Init 2
|
||||
../Core/Src/main.c:350:13:MX_TIM17_Init 2
|
||||
../Core/Src/main.c:382:13:MX_USART1_UART_Init 5
|
||||
../Core/Src/main.c:430:13:MX_USART2_UART_Init 5
|
||||
../Core/Src/main.c:476:13:MX_DMA_Init 1
|
||||
../Core/Src/main.c:494:13:MX_GPIO_Init 1
|
||||
../Core/Src/main.c:544:6:HAL_TIM_PeriodElapsedCallback 1
|
||||
../Core/Src/main.c:561:6:HAL_GPIO_EXTI_Callback 5
|
||||
../Core/Src/main.c:590:6:Error_Handler 1
|
||||
../Core/Inc/pid.h:39:23:clamp_i32 3
|
||||
../Core/Inc/pid.h:46:20:pid_init 1
|
||||
../Core/Inc/pid.h:77:31:pid_update_motor 8
|
||||
../Core/Src/main.c:124:5:main 18
|
||||
../Core/Src/main.c:234:6:SystemClock_Config 3
|
||||
../Core/Src/main.c:273:13:MX_TIM1_Init 10
|
||||
../Core/Src/main.c:367:13:MX_TIM3_Init 3
|
||||
../Core/Src/main.c:416:13:MX_TIM14_Init 2
|
||||
../Core/Src/main.c:447:13:MX_TIM16_Init 2
|
||||
../Core/Src/main.c:479:13:MX_TIM17_Init 2
|
||||
../Core/Src/main.c:511:13:MX_USART1_UART_Init 5
|
||||
../Core/Src/main.c:559:13:MX_USART2_UART_Init 5
|
||||
../Core/Src/main.c:605:13:MX_DMA_Init 1
|
||||
../Core/Src/main.c:626:13:MX_GPIO_Init 1
|
||||
../Core/Src/main.c:676:6:HAL_TIM_PeriodElapsedCallback 11
|
||||
../Core/Src/main.c:724:6:HAL_GPIO_EXTI_Callback 5
|
||||
../Core/Src/main.c:746:6:HAL_UARTEx_RxEventCallback 4
|
||||
../Core/Src/main.c:766:6:set_LED 4
|
||||
../Core/Src/main.c:776:6:handleRS485Message 1
|
||||
../Core/Src/main.c:794:6:set_Feeder_PWM 2
|
||||
../Core/Src/main.c:815:6:Error_Handler 1
|
||||
|
||||
@@ -28,7 +28,8 @@ Core/Src/main.o: ../Core/Src/main.c ../Core/Inc/main.h \
|
||||
../Drivers/STM32C0xx_HAL_Driver/Inc/stm32c0xx_hal_tim.h \
|
||||
../Drivers/STM32C0xx_HAL_Driver/Inc/stm32c0xx_hal_tim_ex.h \
|
||||
../Drivers/STM32C0xx_HAL_Driver/Inc/stm32c0xx_hal_uart.h \
|
||||
../Drivers/STM32C0xx_HAL_Driver/Inc/stm32c0xx_hal_uart_ex.h
|
||||
../Drivers/STM32C0xx_HAL_Driver/Inc/stm32c0xx_hal_uart_ex.h \
|
||||
../Core/Inc/photon_protocol.h ../Core/Inc/pid.h
|
||||
../Core/Inc/main.h:
|
||||
../Drivers/STM32C0xx_HAL_Driver/Inc/stm32c0xx_hal.h:
|
||||
../Drivers/STM32C0xx_HAL_Driver/Inc/stm32c0xx_ll_system.h:
|
||||
@@ -60,3 +61,5 @@ Core/Src/main.o: ../Core/Src/main.c ../Core/Inc/main.h \
|
||||
../Drivers/STM32C0xx_HAL_Driver/Inc/stm32c0xx_hal_tim_ex.h:
|
||||
../Drivers/STM32C0xx_HAL_Driver/Inc/stm32c0xx_hal_uart.h:
|
||||
../Drivers/STM32C0xx_HAL_Driver/Inc/stm32c0xx_hal_uart_ex.h:
|
||||
../Core/Inc/photon_protocol.h:
|
||||
../Core/Inc/pid.h:
|
||||
|
||||
Binary file not shown.
@@ -1,13 +1,21 @@
|
||||
../Core/Src/main.c:85:5:main 8 static
|
||||
../Core/Src/main.c:136:6:SystemClock_Config 64 static
|
||||
../Core/Src/main.c:175:13:MX_TIM1_Init 120 static
|
||||
../Core/Src/main.c:269:13:MX_TIM3_Init 64 static
|
||||
../Core/Src/main.c:318:13:MX_TIM16_Init 8 static
|
||||
../Core/Src/main.c:350:13:MX_TIM17_Init 8 static
|
||||
../Core/Src/main.c:382:13:MX_USART1_UART_Init 8 static
|
||||
../Core/Src/main.c:430:13:MX_USART2_UART_Init 8 static
|
||||
../Core/Src/main.c:476:13:MX_DMA_Init 16 static
|
||||
../Core/Src/main.c:494:13:MX_GPIO_Init 56 static
|
||||
../Core/Src/main.c:544:6:HAL_TIM_PeriodElapsedCallback 16 static
|
||||
../Core/Src/main.c:561:6:HAL_GPIO_EXTI_Callback 16 static
|
||||
../Core/Src/main.c:590:6:Error_Handler 8 static,ignoring_inline_asm
|
||||
../Core/Inc/pid.h:39:23:clamp_i32 24 static
|
||||
../Core/Inc/pid.h:46:20:pid_init 24 static
|
||||
../Core/Inc/pid.h:77:31:pid_update_motor 72 static
|
||||
../Core/Src/main.c:124:5:main 56 static
|
||||
../Core/Src/main.c:234:6:SystemClock_Config 64 static
|
||||
../Core/Src/main.c:273:13:MX_TIM1_Init 120 static
|
||||
../Core/Src/main.c:367:13:MX_TIM3_Init 64 static
|
||||
../Core/Src/main.c:416:13:MX_TIM14_Init 8 static
|
||||
../Core/Src/main.c:447:13:MX_TIM16_Init 8 static
|
||||
../Core/Src/main.c:479:13:MX_TIM17_Init 8 static
|
||||
../Core/Src/main.c:511:13:MX_USART1_UART_Init 8 static
|
||||
../Core/Src/main.c:559:13:MX_USART2_UART_Init 8 static
|
||||
../Core/Src/main.c:605:13:MX_DMA_Init 16 static
|
||||
../Core/Src/main.c:626:13:MX_GPIO_Init 56 static
|
||||
../Core/Src/main.c:676:6:HAL_TIM_PeriodElapsedCallback 24 static
|
||||
../Core/Src/main.c:724:6:HAL_GPIO_EXTI_Callback 16 static
|
||||
../Core/Src/main.c:746:6:HAL_UARTEx_RxEventCallback 16 static
|
||||
../Core/Src/main.c:766:6:set_LED 24 static
|
||||
../Core/Src/main.c:776:6:handleRS485Message 24 static
|
||||
../Core/Src/main.c:794:6:set_Feeder_PWM 16 static
|
||||
../Core/Src/main.c:815:6:Error_Handler 8 static,ignoring_inline_asm
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
../Core/Src/stm32c0xx_hal_msp.c:66:6:HAL_MspInit 1
|
||||
../Core/Src/stm32c0xx_hal_msp.c:89:6:HAL_TIM_Base_MspInit 4
|
||||
../Core/Src/stm32c0xx_hal_msp.c:139:6:HAL_TIM_Encoder_MspInit 3
|
||||
../Core/Src/stm32c0xx_hal_msp.c:188:6:HAL_TIM_MspPostInit 2
|
||||
../Core/Src/stm32c0xx_hal_msp.c:230:6:HAL_TIM_Base_MspDeInit 4
|
||||
../Core/Src/stm32c0xx_hal_msp.c:280:6:HAL_TIM_Encoder_MspDeInit 2
|
||||
../Core/Src/stm32c0xx_hal_msp.c:311:6:HAL_UART_MspInit 4
|
||||
../Core/Src/stm32c0xx_hal_msp.c:384:6:HAL_UART_MspDeInit 3
|
||||
../Core/Src/stm32c0xx_hal_msp.c:68:6:HAL_MspInit 1
|
||||
../Core/Src/stm32c0xx_hal_msp.c:91:6:HAL_TIM_Base_MspInit 5
|
||||
../Core/Src/stm32c0xx_hal_msp.c:155:6:HAL_TIM_Encoder_MspInit 2
|
||||
../Core/Src/stm32c0xx_hal_msp.c:186:6:HAL_TIM_MspPostInit 2
|
||||
../Core/Src/stm32c0xx_hal_msp.c:228:6:HAL_TIM_Base_MspDeInit 5
|
||||
../Core/Src/stm32c0xx_hal_msp.c:292:6:HAL_TIM_Encoder_MspDeInit 2
|
||||
../Core/Src/stm32c0xx_hal_msp.c:321:6:HAL_UART_MspInit 6
|
||||
../Core/Src/stm32c0xx_hal_msp.c:429:6:HAL_UART_MspDeInit 3
|
||||
|
||||
Binary file not shown.
@@ -1,8 +1,8 @@
|
||||
../Core/Src/stm32c0xx_hal_msp.c:66:6:HAL_MspInit 16 static
|
||||
../Core/Src/stm32c0xx_hal_msp.c:89:6:HAL_TIM_Base_MspInit 32 static
|
||||
../Core/Src/stm32c0xx_hal_msp.c:139:6:HAL_TIM_Encoder_MspInit 56 static
|
||||
../Core/Src/stm32c0xx_hal_msp.c:188:6:HAL_TIM_MspPostInit 48 static
|
||||
../Core/Src/stm32c0xx_hal_msp.c:230:6:HAL_TIM_Base_MspDeInit 16 static
|
||||
../Core/Src/stm32c0xx_hal_msp.c:280:6:HAL_TIM_Encoder_MspDeInit 16 static
|
||||
../Core/Src/stm32c0xx_hal_msp.c:311:6:HAL_UART_MspInit 88 static
|
||||
../Core/Src/stm32c0xx_hal_msp.c:384:6:HAL_UART_MspDeInit 16 static
|
||||
../Core/Src/stm32c0xx_hal_msp.c:68:6:HAL_MspInit 16 static
|
||||
../Core/Src/stm32c0xx_hal_msp.c:91:6:HAL_TIM_Base_MspInit 32 static
|
||||
../Core/Src/stm32c0xx_hal_msp.c:155:6:HAL_TIM_Encoder_MspInit 56 static
|
||||
../Core/Src/stm32c0xx_hal_msp.c:186:6:HAL_TIM_MspPostInit 48 static
|
||||
../Core/Src/stm32c0xx_hal_msp.c:228:6:HAL_TIM_Base_MspDeInit 16 static
|
||||
../Core/Src/stm32c0xx_hal_msp.c:292:6:HAL_TIM_Encoder_MspDeInit 16 static
|
||||
../Core/Src/stm32c0xx_hal_msp.c:321:6:HAL_UART_MspInit 88 static
|
||||
../Core/Src/stm32c0xx_hal_msp.c:429:6:HAL_UART_MspDeInit 16 static
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
../Core/Src/stm32c0xx_it.c:71:6:NMI_Handler 1
|
||||
../Core/Src/stm32c0xx_it.c:86:6:HardFault_Handler 1
|
||||
../Core/Src/stm32c0xx_it.c:101:6:SVC_Handler 1
|
||||
../Core/Src/stm32c0xx_it.c:114:6:PendSV_Handler 1
|
||||
../Core/Src/stm32c0xx_it.c:127:6:SysTick_Handler 1
|
||||
../Core/Src/stm32c0xx_it.c:148:6:EXTI4_15_IRQHandler 1
|
||||
../Core/Src/stm32c0xx_it.c:163:6:DMA1_Channel1_IRQHandler 1
|
||||
../Core/Src/stm32c0xx_it.c:177:6:TIM16_IRQHandler 1
|
||||
../Core/Src/stm32c0xx_it.c:191:6:TIM17_IRQHandler 1
|
||||
../Core/Src/stm32c0xx_it.c:73:6:NMI_Handler 1
|
||||
../Core/Src/stm32c0xx_it.c:88:6:HardFault_Handler 1
|
||||
../Core/Src/stm32c0xx_it.c:103:6:SVC_Handler 1
|
||||
../Core/Src/stm32c0xx_it.c:116:6:PendSV_Handler 1
|
||||
../Core/Src/stm32c0xx_it.c:129:6:SysTick_Handler 1
|
||||
../Core/Src/stm32c0xx_it.c:150:6:EXTI4_15_IRQHandler 1
|
||||
../Core/Src/stm32c0xx_it.c:165:6:DMA1_Channel1_IRQHandler 1
|
||||
../Core/Src/stm32c0xx_it.c:179:6:DMA1_Channel2_3_IRQHandler 1
|
||||
../Core/Src/stm32c0xx_it.c:193:6:TIM14_IRQHandler 1
|
||||
../Core/Src/stm32c0xx_it.c:207:6:TIM16_IRQHandler 1
|
||||
../Core/Src/stm32c0xx_it.c:221:6:TIM17_IRQHandler 1
|
||||
|
||||
Binary file not shown.
@@ -1,9 +1,11 @@
|
||||
../Core/Src/stm32c0xx_it.c:71:6:NMI_Handler 8 static
|
||||
../Core/Src/stm32c0xx_it.c:86:6:HardFault_Handler 8 static
|
||||
../Core/Src/stm32c0xx_it.c:101:6:SVC_Handler 8 static
|
||||
../Core/Src/stm32c0xx_it.c:114:6:PendSV_Handler 8 static
|
||||
../Core/Src/stm32c0xx_it.c:127:6:SysTick_Handler 8 static
|
||||
../Core/Src/stm32c0xx_it.c:148:6:EXTI4_15_IRQHandler 8 static
|
||||
../Core/Src/stm32c0xx_it.c:163:6:DMA1_Channel1_IRQHandler 8 static
|
||||
../Core/Src/stm32c0xx_it.c:177:6:TIM16_IRQHandler 8 static
|
||||
../Core/Src/stm32c0xx_it.c:191:6:TIM17_IRQHandler 8 static
|
||||
../Core/Src/stm32c0xx_it.c:73:6:NMI_Handler 8 static
|
||||
../Core/Src/stm32c0xx_it.c:88:6:HardFault_Handler 8 static
|
||||
../Core/Src/stm32c0xx_it.c:103:6:SVC_Handler 8 static
|
||||
../Core/Src/stm32c0xx_it.c:116:6:PendSV_Handler 8 static
|
||||
../Core/Src/stm32c0xx_it.c:129:6:SysTick_Handler 8 static
|
||||
../Core/Src/stm32c0xx_it.c:150:6:EXTI4_15_IRQHandler 8 static
|
||||
../Core/Src/stm32c0xx_it.c:165:6:DMA1_Channel1_IRQHandler 8 static
|
||||
../Core/Src/stm32c0xx_it.c:179:6:DMA1_Channel2_3_IRQHandler 8 static
|
||||
../Core/Src/stm32c0xx_it.c:193:6:TIM14_IRQHandler 8 static
|
||||
../Core/Src/stm32c0xx_it.c:207:6:TIM16_IRQHandler 8 static
|
||||
../Core/Src/stm32c0xx_it.c:221:6:TIM17_IRQHandler 8 static
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -2,25 +2,43 @@
|
||||
CAD.formats=[]
|
||||
CAD.pinconfig=Dual
|
||||
CAD.provider=
|
||||
Dma.Request0=TIM3_UP
|
||||
Dma.RequestsNb=1
|
||||
Dma.TIM3_UP.0.Direction=DMA_PERIPH_TO_MEMORY
|
||||
Dma.TIM3_UP.0.EventEnable=DISABLE
|
||||
Dma.TIM3_UP.0.Instance=DMA1_Channel1
|
||||
Dma.TIM3_UP.0.MemDataAlignment=DMA_MDATAALIGN_HALFWORD
|
||||
Dma.TIM3_UP.0.MemInc=DMA_MINC_ENABLE
|
||||
Dma.TIM3_UP.0.Mode=DMA_NORMAL
|
||||
Dma.TIM3_UP.0.PeriphDataAlignment=DMA_PDATAALIGN_HALFWORD
|
||||
Dma.TIM3_UP.0.PeriphInc=DMA_PINC_DISABLE
|
||||
Dma.TIM3_UP.0.Polarity=HAL_DMAMUX_REQ_GEN_RISING
|
||||
Dma.TIM3_UP.0.Priority=DMA_PRIORITY_LOW
|
||||
Dma.TIM3_UP.0.RequestNumber=1
|
||||
Dma.TIM3_UP.0.RequestParameters=Instance,Direction,PeriphInc,MemInc,PeriphDataAlignment,MemDataAlignment,Mode,Priority,SignalID,Polarity,RequestNumber,SyncSignalID,SyncPolarity,SyncEnable,EventEnable,SyncRequestNumber
|
||||
Dma.TIM3_UP.0.SignalID=NONE
|
||||
Dma.TIM3_UP.0.SyncEnable=DISABLE
|
||||
Dma.TIM3_UP.0.SyncPolarity=HAL_DMAMUX_SYNC_NO_EVENT
|
||||
Dma.TIM3_UP.0.SyncRequestNumber=1
|
||||
Dma.TIM3_UP.0.SyncSignalID=NONE
|
||||
Dma.Request0=USART2_RX
|
||||
Dma.Request1=USART2_TX
|
||||
Dma.RequestsNb=2
|
||||
Dma.USART2_RX.0.Direction=DMA_PERIPH_TO_MEMORY
|
||||
Dma.USART2_RX.0.EventEnable=DISABLE
|
||||
Dma.USART2_RX.0.Instance=DMA1_Channel2
|
||||
Dma.USART2_RX.0.MemDataAlignment=DMA_MDATAALIGN_BYTE
|
||||
Dma.USART2_RX.0.MemInc=DMA_MINC_ENABLE
|
||||
Dma.USART2_RX.0.Mode=DMA_NORMAL
|
||||
Dma.USART2_RX.0.PeriphDataAlignment=DMA_PDATAALIGN_BYTE
|
||||
Dma.USART2_RX.0.PeriphInc=DMA_PINC_DISABLE
|
||||
Dma.USART2_RX.0.Polarity=HAL_DMAMUX_REQ_GEN_RISING
|
||||
Dma.USART2_RX.0.Priority=DMA_PRIORITY_MEDIUM
|
||||
Dma.USART2_RX.0.RequestNumber=1
|
||||
Dma.USART2_RX.0.RequestParameters=Instance,Direction,PeriphInc,MemInc,PeriphDataAlignment,MemDataAlignment,Mode,Priority,SignalID,Polarity,RequestNumber,SyncSignalID,SyncPolarity,SyncEnable,EventEnable,SyncRequestNumber
|
||||
Dma.USART2_RX.0.SignalID=NONE
|
||||
Dma.USART2_RX.0.SyncEnable=DISABLE
|
||||
Dma.USART2_RX.0.SyncPolarity=HAL_DMAMUX_SYNC_NO_EVENT
|
||||
Dma.USART2_RX.0.SyncRequestNumber=1
|
||||
Dma.USART2_RX.0.SyncSignalID=NONE
|
||||
Dma.USART2_TX.1.Direction=DMA_MEMORY_TO_PERIPH
|
||||
Dma.USART2_TX.1.EventEnable=DISABLE
|
||||
Dma.USART2_TX.1.Instance=DMA1_Channel1
|
||||
Dma.USART2_TX.1.MemDataAlignment=DMA_MDATAALIGN_BYTE
|
||||
Dma.USART2_TX.1.MemInc=DMA_MINC_ENABLE
|
||||
Dma.USART2_TX.1.Mode=DMA_NORMAL
|
||||
Dma.USART2_TX.1.PeriphDataAlignment=DMA_PDATAALIGN_BYTE
|
||||
Dma.USART2_TX.1.PeriphInc=DMA_PINC_DISABLE
|
||||
Dma.USART2_TX.1.Polarity=HAL_DMAMUX_REQ_GEN_RISING
|
||||
Dma.USART2_TX.1.Priority=DMA_PRIORITY_HIGH
|
||||
Dma.USART2_TX.1.RequestNumber=1
|
||||
Dma.USART2_TX.1.RequestParameters=Instance,Direction,PeriphInc,MemInc,PeriphDataAlignment,MemDataAlignment,Mode,Priority,SignalID,Polarity,RequestNumber,SyncSignalID,SyncPolarity,SyncEnable,EventEnable,SyncRequestNumber
|
||||
Dma.USART2_TX.1.SignalID=NONE
|
||||
Dma.USART2_TX.1.SyncEnable=DISABLE
|
||||
Dma.USART2_TX.1.SyncPolarity=HAL_DMAMUX_SYNC_NO_EVENT
|
||||
Dma.USART2_TX.1.SyncRequestNumber=1
|
||||
Dma.USART2_TX.1.SyncSignalID=NONE
|
||||
File.Version=6
|
||||
GPIO.groupedBy=Group By Peripherals
|
||||
KeepUserPlacement=false
|
||||
@@ -77,6 +95,7 @@ Mcu.UserName=STM32C051C6Tx
|
||||
MxCube.Version=6.15.0
|
||||
MxDb.Version=DB.6.0.150
|
||||
NVIC.DMA1_Channel1_IRQn=true\:0\:0\:false\:false\:true\:false\:true\:true
|
||||
NVIC.DMA1_Channel2_3_IRQn=true\:0\:0\:false\:false\:true\:false\:true\:true
|
||||
NVIC.EXTI4_15_IRQn=true\:0\:0\:false\:false\:true\:true\:true\:true
|
||||
NVIC.ForceEnableDMAVector=true
|
||||
NVIC.HardFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false
|
||||
@@ -199,7 +218,7 @@ ProjectManager.ToolChainLocation=
|
||||
ProjectManager.UAScriptAfterPath=
|
||||
ProjectManager.UAScriptBeforePath=
|
||||
ProjectManager.UnderRoot=true
|
||||
ProjectManager.functionlistsort=1-SystemClock_Config-RCC-false-HAL-false,2-MX_GPIO_Init-GPIO-false-HAL-true,3-MX_DMA_Init-DMA-false-HAL-true,4-MX_TIM1_Init-TIM1-false-HAL-true,5-MX_TIM3_Init-TIM3-false-HAL-true,6-MX_USART1_UART_Init-USART1-false-HAL-true,7-MX_USART2_UART_Init-USART2-false-HAL-true,8-MX_TIM16_Init-TIM16-false-HAL-true,9-MX_TIM17_Init-TIM17-false-HAL-true,0-MX_CORTEX_M0+_Init-CORTEX_M0+-false-HAL-true
|
||||
ProjectManager.functionlistsort=1-SystemClock_Config-RCC-false-HAL-false,2-MX_GPIO_Init-GPIO-false-HAL-true,3-MX_DMA_Init-DMA-false-HAL-true,4-MX_TIM1_Init-TIM1-false-HAL-true,5-MX_TIM3_Init-TIM3-false-HAL-true,6-MX_USART1_UART_Init-USART1-false-HAL-true,7-MX_USART2_UART_Init-USART2-false-HAL-true,8-MX_TIM16_Init-TIM16-false-HAL-true,9-MX_TIM17_Init-TIM17-false-HAL-true,10-MX_TIM14_Init-TIM14-false-HAL-true,0-MX_CORTEX_M0+_Init-CORTEX_M0+-false-HAL-true
|
||||
RCC.ADCFreq_Value=48000000
|
||||
RCC.AHBFreq_Value=48000000
|
||||
RCC.APBFreq_Value=48000000
|
||||
@@ -256,7 +275,10 @@ TIM3.EncoderMode=TIM_ENCODERMODE_TI12
|
||||
TIM3.IPParameters=EncoderMode
|
||||
USART1.IPParameters=VirtualMode-Asynchronous
|
||||
USART1.VirtualMode-Asynchronous=VM_ASYNC
|
||||
USART2.IPParameters=VirtualMode-Asynchronous,VirtualMode-Hardware Flow Control (RS485)
|
||||
USART2.BaudRate=57600
|
||||
USART2.IPParameters=VirtualMode-Asynchronous,VirtualMode-Hardware Flow Control (RS485),BaudRate,TXFIFOThreshold,RXFIFOThreshold
|
||||
USART2.RXFIFOThreshold=RXFIFO_THRESHOLD_HALFFULL
|
||||
USART2.TXFIFOThreshold=TXFIFO_THRESHOLD_HALFFULL
|
||||
USART2.VirtualMode-Asynchronous=VM_ASYNC
|
||||
USART2.VirtualMode-Hardware\ Flow\ Control\ (RS485)=VM_ASYNC
|
||||
VP_SYS_VS_Systick.Mode=SysTick
|
||||
|
||||
Reference in New Issue
Block a user