fix: enable four-channel weighing in MCU2
This commit is contained in:
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,76 @@
|
|||||||
|
PROJECT_XML := ../src/Project/Project.uvproj
|
||||||
|
BUILD_DIR := build
|
||||||
|
TARGET := $(BUILD_DIR)/MCU2_V2.1_260728_4CH
|
||||||
|
|
||||||
|
CC := arm-none-eabi-gcc
|
||||||
|
OBJCOPY := arm-none-eabi-objcopy
|
||||||
|
SIZE := arm-none-eabi-size
|
||||||
|
|
||||||
|
C_SOURCES := $(filter-out ../src/CMSIS/core_cm3.c,$(shell perl extract_sources.pl $(PROJECT_XML)))
|
||||||
|
S_SOURCES := startup_stm32f10x_hd_gcc.S
|
||||||
|
OBJECTS := $(patsubst ../src/%.c,$(BUILD_DIR)/%.o,$(C_SOURCES))
|
||||||
|
OBJECTS += $(BUILD_DIR)/gcc_syscalls.o
|
||||||
|
OBJECTS += $(BUILD_DIR)/startup_stm32f10x_hd_gcc.o
|
||||||
|
|
||||||
|
INCLUDES := \
|
||||||
|
-I../src/USER -I../src/CORE -I../src/CMSIS \
|
||||||
|
-I../src/SYSTEM/delay -I../src/SYSTEM/debug -I../src/SYSTEM/usart \
|
||||||
|
-I../src/STM32F10x_FWLib/inc \
|
||||||
|
-I../src/HARDWARE/LED -I../src/HARDWARE/KEY -I../src/HARDWARE/LCD \
|
||||||
|
-I../src/HARDWARE/24CXX -I../src/HARDWARE/FLASH -I../src/HARDWARE/IIC \
|
||||||
|
-I../src/HARDWARE/SPI -I../src/HARDWARE/BUZZER -I../src/HARDWARE/RFID \
|
||||||
|
-I../src/HARDWARE/EXTI -I../src/HARDWARE/TIMER \
|
||||||
|
-I../src/HARDWARE/UltrasonicWave -I../src/HARDWARE/USART \
|
||||||
|
-I../src/HARDWARE/GPS -I../src/HARDWARE/GSM -I../src/HARDWARE/QR_Code \
|
||||||
|
-I../src/HARDWARE/DEVICE -I../src/HARDWARE/NTC_ADC -I../src/HARDWARE/WDG \
|
||||||
|
-I../src/HARDWARE/SCALE -I../src/HARDWARE/ElectronicLock \
|
||||||
|
-I../src/HARDWARE/MOTOR -I../src/HARDWARE/AUDIO -I../src/HARDWARE/OPTO_SWITCH \
|
||||||
|
-I../src/HARDWARE/IR_Distancer -I../src/HARDWARE/RS485 \
|
||||||
|
-I../src/HARDWARE/STMFLASH -I../src/HARDWARE/Disinfection
|
||||||
|
|
||||||
|
ARCH_FLAGS := -mcpu=cortex-m3 -mthumb
|
||||||
|
DEFINES := -DSTM32F10X_HD -DUSE_STDPERIPH_DRIVER -Dsignal=gsm_signal_strength
|
||||||
|
WARNINGS := -Wall -Wextra -Wno-unused-parameter -Wno-unused-variable \
|
||||||
|
-Wno-unused-but-set-variable -Wno-sign-compare -Wno-implicit-int \
|
||||||
|
-Wno-unknown-pragmas -Wno-format
|
||||||
|
CFLAGS := $(ARCH_FLAGS) -std=gnu99 -Os -g3 -ffunction-sections -fdata-sections \
|
||||||
|
-fcommon -fno-strict-aliasing -fno-builtin -include gcc_compat.h $(DEFINES) $(INCLUDES) $(WARNINGS)
|
||||||
|
ASFLAGS := $(ARCH_FLAGS) -x assembler-with-cpp -g3
|
||||||
|
LDFLAGS := $(ARCH_FLAGS) -T stm32f103ve.ld -Wl,--gc-sections \
|
||||||
|
-Wl,-Map=$(TARGET).map,--cref -Wl,--print-memory-usage \
|
||||||
|
--specs=nano.specs --specs=nosys.specs -u _printf_float
|
||||||
|
LDLIBS := -Wl,--start-group -lc -lm -Wl,--end-group
|
||||||
|
|
||||||
|
.PHONY: all clean verify
|
||||||
|
|
||||||
|
all: $(TARGET).hex $(TARGET).bin
|
||||||
|
$(SIZE) $(TARGET).elf
|
||||||
|
|
||||||
|
$(TARGET).elf: $(OBJECTS) stm32f103ve.ld | $(BUILD_DIR)
|
||||||
|
$(CC) $(OBJECTS) $(LDFLAGS) $(LDLIBS) -o $@
|
||||||
|
|
||||||
|
$(TARGET).hex: $(TARGET).elf
|
||||||
|
$(OBJCOPY) -O ihex $< $@
|
||||||
|
|
||||||
|
$(TARGET).bin: $(TARGET).elf
|
||||||
|
$(OBJCOPY) -O binary $< $@
|
||||||
|
|
||||||
|
$(BUILD_DIR)/%.o: ../src/%.c gcc_compat.h
|
||||||
|
@mkdir -p $(dir $@)
|
||||||
|
$(CC) $(CFLAGS) -MMD -MP -c $< -o $@
|
||||||
|
|
||||||
|
$(BUILD_DIR)/startup_stm32f10x_hd_gcc.o: startup_stm32f10x_hd_gcc.S
|
||||||
|
@mkdir -p $(dir $@)
|
||||||
|
$(CC) $(ASFLAGS) -c $< -o $@
|
||||||
|
|
||||||
|
$(BUILD_DIR)/gcc_syscalls.o: gcc_syscalls.c gcc_compat.h
|
||||||
|
@mkdir -p $(dir $@)
|
||||||
|
$(CC) $(CFLAGS) -MMD -MP -c $< -o $@
|
||||||
|
|
||||||
|
$(BUILD_DIR):
|
||||||
|
mkdir -p $@
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -rf $(BUILD_DIR)
|
||||||
|
|
||||||
|
-include $(OBJECTS:.o=.d)
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
#!/usr/bin/env perl
|
||||||
|
use strict;
|
||||||
|
use warnings;
|
||||||
|
|
||||||
|
my $project = shift @ARGV or die "usage: $0 Project.uvprojx\n";
|
||||||
|
open my $fh, '<', $project or die "cannot open $project: $!\n";
|
||||||
|
while (my $line = <$fh>) {
|
||||||
|
next unless $line =~ m{<FilePath>\.\.\\(.+\.c)</FilePath>};
|
||||||
|
my $path = $1;
|
||||||
|
$path =~ s{\\}{/}g;
|
||||||
|
print "../src/$path ";
|
||||||
|
}
|
||||||
|
close $fh;
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
#ifndef GCC_COMPAT_H
|
||||||
|
#define GCC_COMPAT_H
|
||||||
|
|
||||||
|
#ifndef __align
|
||||||
|
#define __align(n) __attribute__((aligned(n)))
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef __packed
|
||||||
|
#define __packed __attribute__((packed))
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
#include "stm32f10x.h"
|
||||||
|
|
||||||
|
int _write(int file, char *data, int length)
|
||||||
|
{
|
||||||
|
int index;
|
||||||
|
|
||||||
|
(void)file;
|
||||||
|
for (index = 0; index < length; ++index)
|
||||||
|
{
|
||||||
|
while (USART_GetFlagStatus(UART5, USART_FLAG_TC) == RESET)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
USART_SendData(UART5, (uint8_t)data[index]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return length;
|
||||||
|
}
|
||||||
@@ -0,0 +1,201 @@
|
|||||||
|
.syntax unified
|
||||||
|
.cpu cortex-m3
|
||||||
|
.thumb
|
||||||
|
|
||||||
|
.global g_pfnVectors
|
||||||
|
.global Reset_Handler
|
||||||
|
.extern SystemInit
|
||||||
|
.extern main
|
||||||
|
.extern __libc_init_array
|
||||||
|
|
||||||
|
.section .isr_vector,"a",%progbits
|
||||||
|
.type g_pfnVectors, %object
|
||||||
|
g_pfnVectors:
|
||||||
|
.word _estack
|
||||||
|
.word Reset_Handler
|
||||||
|
.word NMI_Handler
|
||||||
|
.word HardFault_Handler
|
||||||
|
.word MemManage_Handler
|
||||||
|
.word BusFault_Handler
|
||||||
|
.word UsageFault_Handler
|
||||||
|
.word 0, 0, 0, 0
|
||||||
|
.word SVC_Handler
|
||||||
|
.word DebugMon_Handler
|
||||||
|
.word 0
|
||||||
|
.word PendSV_Handler
|
||||||
|
.word SysTick_Handler
|
||||||
|
.word WWDG_IRQHandler
|
||||||
|
.word PVD_IRQHandler
|
||||||
|
.word TAMPER_IRQHandler
|
||||||
|
.word RTC_IRQHandler
|
||||||
|
.word FLASH_IRQHandler
|
||||||
|
.word RCC_IRQHandler
|
||||||
|
.word EXTI0_IRQHandler
|
||||||
|
.word EXTI1_IRQHandler
|
||||||
|
.word EXTI2_IRQHandler
|
||||||
|
.word EXTI3_IRQHandler
|
||||||
|
.word EXTI4_IRQHandler
|
||||||
|
.word DMA1_Channel1_IRQHandler
|
||||||
|
.word DMA1_Channel2_IRQHandler
|
||||||
|
.word DMA1_Channel3_IRQHandler
|
||||||
|
.word DMA1_Channel4_IRQHandler
|
||||||
|
.word DMA1_Channel5_IRQHandler
|
||||||
|
.word DMA1_Channel6_IRQHandler
|
||||||
|
.word DMA1_Channel7_IRQHandler
|
||||||
|
.word ADC1_2_IRQHandler
|
||||||
|
.word USB_HP_CAN1_TX_IRQHandler
|
||||||
|
.word USB_LP_CAN1_RX0_IRQHandler
|
||||||
|
.word CAN1_RX1_IRQHandler
|
||||||
|
.word CAN1_SCE_IRQHandler
|
||||||
|
.word EXTI9_5_IRQHandler
|
||||||
|
.word TIM1_BRK_IRQHandler
|
||||||
|
.word TIM1_UP_IRQHandler
|
||||||
|
.word TIM1_TRG_COM_IRQHandler
|
||||||
|
.word TIM1_CC_IRQHandler
|
||||||
|
.word TIM2_IRQHandler
|
||||||
|
.word TIM3_IRQHandler
|
||||||
|
.word TIM4_IRQHandler
|
||||||
|
.word I2C1_EV_IRQHandler
|
||||||
|
.word I2C1_ER_IRQHandler
|
||||||
|
.word I2C2_EV_IRQHandler
|
||||||
|
.word I2C2_ER_IRQHandler
|
||||||
|
.word SPI1_IRQHandler
|
||||||
|
.word SPI2_IRQHandler
|
||||||
|
.word USART1_IRQHandler
|
||||||
|
.word USART2_IRQHandler
|
||||||
|
.word USART3_IRQHandler
|
||||||
|
.word EXTI15_10_IRQHandler
|
||||||
|
.word RTCAlarm_IRQHandler
|
||||||
|
.word USBWakeUp_IRQHandler
|
||||||
|
.word TIM8_BRK_IRQHandler
|
||||||
|
.word TIM8_UP_IRQHandler
|
||||||
|
.word TIM8_TRG_COM_IRQHandler
|
||||||
|
.word TIM8_CC_IRQHandler
|
||||||
|
.word ADC3_IRQHandler
|
||||||
|
.word FSMC_IRQHandler
|
||||||
|
.word SDIO_IRQHandler
|
||||||
|
.word TIM5_IRQHandler
|
||||||
|
.word SPI3_IRQHandler
|
||||||
|
.word UART4_IRQHandler
|
||||||
|
.word UART5_IRQHandler
|
||||||
|
.word TIM6_IRQHandler
|
||||||
|
.word TIM7_IRQHandler
|
||||||
|
.word DMA2_Channel1_IRQHandler
|
||||||
|
.word DMA2_Channel2_IRQHandler
|
||||||
|
.word DMA2_Channel3_IRQHandler
|
||||||
|
.word DMA2_Channel4_5_IRQHandler
|
||||||
|
.size g_pfnVectors, .-g_pfnVectors
|
||||||
|
|
||||||
|
.section .text.Reset_Handler,"ax",%progbits
|
||||||
|
.thumb_func
|
||||||
|
Reset_Handler:
|
||||||
|
ldr r0, =_sidata
|
||||||
|
ldr r1, =_sdata
|
||||||
|
ldr r2, =_edata
|
||||||
|
1:
|
||||||
|
cmp r1, r2
|
||||||
|
bcc 2f
|
||||||
|
b 3f
|
||||||
|
2:
|
||||||
|
ldr r3, [r0], #4
|
||||||
|
str r3, [r1], #4
|
||||||
|
b 1b
|
||||||
|
3:
|
||||||
|
ldr r1, =_sbss
|
||||||
|
ldr r2, =_ebss
|
||||||
|
movs r3, #0
|
||||||
|
4:
|
||||||
|
cmp r1, r2
|
||||||
|
bcc 5f
|
||||||
|
b 6f
|
||||||
|
5:
|
||||||
|
str r3, [r1], #4
|
||||||
|
b 4b
|
||||||
|
6:
|
||||||
|
bl SystemInit
|
||||||
|
bl __libc_init_array
|
||||||
|
bl main
|
||||||
|
7:
|
||||||
|
b 7b
|
||||||
|
|
||||||
|
.section .text.Default_Handler,"ax",%progbits
|
||||||
|
.thumb_func
|
||||||
|
Default_Handler:
|
||||||
|
b Default_Handler
|
||||||
|
|
||||||
|
.macro weak_handler name
|
||||||
|
.weak \name
|
||||||
|
.thumb_set \name, Default_Handler
|
||||||
|
.endm
|
||||||
|
|
||||||
|
weak_handler NMI_Handler
|
||||||
|
weak_handler HardFault_Handler
|
||||||
|
weak_handler MemManage_Handler
|
||||||
|
weak_handler BusFault_Handler
|
||||||
|
weak_handler UsageFault_Handler
|
||||||
|
weak_handler SVC_Handler
|
||||||
|
weak_handler DebugMon_Handler
|
||||||
|
weak_handler PendSV_Handler
|
||||||
|
weak_handler SysTick_Handler
|
||||||
|
weak_handler WWDG_IRQHandler
|
||||||
|
weak_handler PVD_IRQHandler
|
||||||
|
weak_handler TAMPER_IRQHandler
|
||||||
|
weak_handler RTC_IRQHandler
|
||||||
|
weak_handler FLASH_IRQHandler
|
||||||
|
weak_handler RCC_IRQHandler
|
||||||
|
weak_handler EXTI0_IRQHandler
|
||||||
|
weak_handler EXTI1_IRQHandler
|
||||||
|
weak_handler EXTI2_IRQHandler
|
||||||
|
weak_handler EXTI3_IRQHandler
|
||||||
|
weak_handler EXTI4_IRQHandler
|
||||||
|
weak_handler DMA1_Channel1_IRQHandler
|
||||||
|
weak_handler DMA1_Channel2_IRQHandler
|
||||||
|
weak_handler DMA1_Channel3_IRQHandler
|
||||||
|
weak_handler DMA1_Channel4_IRQHandler
|
||||||
|
weak_handler DMA1_Channel5_IRQHandler
|
||||||
|
weak_handler DMA1_Channel6_IRQHandler
|
||||||
|
weak_handler DMA1_Channel7_IRQHandler
|
||||||
|
weak_handler ADC1_2_IRQHandler
|
||||||
|
weak_handler USB_HP_CAN1_TX_IRQHandler
|
||||||
|
weak_handler USB_LP_CAN1_RX0_IRQHandler
|
||||||
|
weak_handler CAN1_RX1_IRQHandler
|
||||||
|
weak_handler CAN1_SCE_IRQHandler
|
||||||
|
weak_handler EXTI9_5_IRQHandler
|
||||||
|
weak_handler TIM1_BRK_IRQHandler
|
||||||
|
weak_handler TIM1_UP_IRQHandler
|
||||||
|
weak_handler TIM1_TRG_COM_IRQHandler
|
||||||
|
weak_handler TIM1_CC_IRQHandler
|
||||||
|
weak_handler TIM2_IRQHandler
|
||||||
|
weak_handler TIM3_IRQHandler
|
||||||
|
weak_handler TIM4_IRQHandler
|
||||||
|
weak_handler I2C1_EV_IRQHandler
|
||||||
|
weak_handler I2C1_ER_IRQHandler
|
||||||
|
weak_handler I2C2_EV_IRQHandler
|
||||||
|
weak_handler I2C2_ER_IRQHandler
|
||||||
|
weak_handler SPI1_IRQHandler
|
||||||
|
weak_handler SPI2_IRQHandler
|
||||||
|
weak_handler USART1_IRQHandler
|
||||||
|
weak_handler USART2_IRQHandler
|
||||||
|
weak_handler USART3_IRQHandler
|
||||||
|
weak_handler EXTI15_10_IRQHandler
|
||||||
|
weak_handler RTCAlarm_IRQHandler
|
||||||
|
weak_handler USBWakeUp_IRQHandler
|
||||||
|
weak_handler TIM8_BRK_IRQHandler
|
||||||
|
weak_handler TIM8_UP_IRQHandler
|
||||||
|
weak_handler TIM8_TRG_COM_IRQHandler
|
||||||
|
weak_handler TIM8_CC_IRQHandler
|
||||||
|
weak_handler ADC3_IRQHandler
|
||||||
|
weak_handler FSMC_IRQHandler
|
||||||
|
weak_handler SDIO_IRQHandler
|
||||||
|
weak_handler TIM5_IRQHandler
|
||||||
|
weak_handler SPI3_IRQHandler
|
||||||
|
weak_handler UART4_IRQHandler
|
||||||
|
weak_handler UART5_IRQHandler
|
||||||
|
weak_handler TIM6_IRQHandler
|
||||||
|
weak_handler TIM7_IRQHandler
|
||||||
|
weak_handler DMA2_Channel1_IRQHandler
|
||||||
|
weak_handler DMA2_Channel2_IRQHandler
|
||||||
|
weak_handler DMA2_Channel3_IRQHandler
|
||||||
|
weak_handler DMA2_Channel4_5_IRQHandler
|
||||||
|
|
||||||
|
.section .note.GNU-stack,"",%progbits
|
||||||
@@ -0,0 +1,95 @@
|
|||||||
|
ENTRY(Reset_Handler)
|
||||||
|
|
||||||
|
MEMORY
|
||||||
|
{
|
||||||
|
FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 512K
|
||||||
|
RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 64K
|
||||||
|
}
|
||||||
|
|
||||||
|
_estack = ORIGIN(RAM) + LENGTH(RAM);
|
||||||
|
_Min_Heap_Size = 0x200;
|
||||||
|
_Min_Stack_Size = 0x400;
|
||||||
|
|
||||||
|
SECTIONS
|
||||||
|
{
|
||||||
|
.isr_vector :
|
||||||
|
{
|
||||||
|
. = ALIGN(4);
|
||||||
|
KEEP(*(.isr_vector))
|
||||||
|
. = ALIGN(4);
|
||||||
|
} > FLASH
|
||||||
|
|
||||||
|
.text :
|
||||||
|
{
|
||||||
|
. = ALIGN(4);
|
||||||
|
*(.text .text.*)
|
||||||
|
*(.rodata .rodata.*)
|
||||||
|
KEEP(*(.init))
|
||||||
|
KEEP(*(.fini))
|
||||||
|
. = ALIGN(4);
|
||||||
|
_etext = .;
|
||||||
|
} > FLASH
|
||||||
|
|
||||||
|
.ARM.extab : { *(.ARM.extab* .gnu.linkonce.armextab.*) } > FLASH
|
||||||
|
.ARM.exidx :
|
||||||
|
{
|
||||||
|
__exidx_start = .;
|
||||||
|
*(.ARM.exidx*)
|
||||||
|
__exidx_end = .;
|
||||||
|
} > FLASH
|
||||||
|
|
||||||
|
.preinit_array :
|
||||||
|
{
|
||||||
|
PROVIDE_HIDDEN(__preinit_array_start = .);
|
||||||
|
KEEP(*(.preinit_array*))
|
||||||
|
PROVIDE_HIDDEN(__preinit_array_end = .);
|
||||||
|
} > FLASH
|
||||||
|
.init_array :
|
||||||
|
{
|
||||||
|
PROVIDE_HIDDEN(__init_array_start = .);
|
||||||
|
KEEP(*(SORT(.init_array.*)))
|
||||||
|
KEEP(*(.init_array*))
|
||||||
|
PROVIDE_HIDDEN(__init_array_end = .);
|
||||||
|
} > FLASH
|
||||||
|
.fini_array :
|
||||||
|
{
|
||||||
|
PROVIDE_HIDDEN(__fini_array_start = .);
|
||||||
|
KEEP(*(SORT(.fini_array.*)))
|
||||||
|
KEEP(*(.fini_array*))
|
||||||
|
PROVIDE_HIDDEN(__fini_array_end = .);
|
||||||
|
} > FLASH
|
||||||
|
|
||||||
|
_sidata = LOADADDR(.data);
|
||||||
|
.data :
|
||||||
|
{
|
||||||
|
. = ALIGN(4);
|
||||||
|
_sdata = .;
|
||||||
|
*(.data .data.*)
|
||||||
|
. = ALIGN(4);
|
||||||
|
_edata = .;
|
||||||
|
} > RAM AT > FLASH
|
||||||
|
|
||||||
|
.bss (NOLOAD) :
|
||||||
|
{
|
||||||
|
. = ALIGN(4);
|
||||||
|
_sbss = .;
|
||||||
|
__bss_start__ = _sbss;
|
||||||
|
*(.bss .bss.*)
|
||||||
|
*(COMMON)
|
||||||
|
. = ALIGN(4);
|
||||||
|
_ebss = .;
|
||||||
|
__bss_end__ = _ebss;
|
||||||
|
} > RAM
|
||||||
|
|
||||||
|
._user_heap_stack (NOLOAD) :
|
||||||
|
{
|
||||||
|
. = ALIGN(8);
|
||||||
|
PROVIDE(end = .);
|
||||||
|
PROVIDE(_end = .);
|
||||||
|
. += _Min_Heap_Size;
|
||||||
|
. += _Min_Stack_Size;
|
||||||
|
. = ALIGN(8);
|
||||||
|
} > RAM
|
||||||
|
|
||||||
|
/DISCARD/ : { *(.note.GNU-stack) }
|
||||||
|
}
|
||||||
@@ -20,7 +20,7 @@
|
|||||||
#include "scale.h"
|
#include "scale.h"
|
||||||
|
|
||||||
|
|
||||||
#define VersionNumber "V2.0_200319"
|
#define VersionNumber "V2.1_260728_4CH"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
***********************************************************************
|
***********************************************************************
|
||||||
|
|||||||
@@ -412,8 +412,8 @@ void WeightDetectionTask(void)
|
|||||||
{
|
{
|
||||||
WeightDetection1();
|
WeightDetection1();
|
||||||
WeightDetection2();
|
WeightDetection2();
|
||||||
// WeightDetection3();
|
WeightDetection3();
|
||||||
// WeightDetection4();
|
WeightDetection4();
|
||||||
ScaleCmdDecodeTask();
|
ScaleCmdDecodeTask();
|
||||||
CalibrationErrorHandler();
|
CalibrationErrorHandler();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,6 @@
|
|||||||
#include "device.h"
|
#include "device.h"
|
||||||
#include "data_typedef.h"
|
#include "data_typedef.h"
|
||||||
#include "m_s_comm.h"
|
#include "m_s_comm.h"
|
||||||
#include "gps.h"
|
|
||||||
|
|
||||||
void NVIC_Configuration(void);
|
void NVIC_Configuration(void);
|
||||||
void RegularUploadTask(void);
|
void RegularUploadTask(void);
|
||||||
@@ -25,8 +24,8 @@ int main(void)
|
|||||||
USART1_Init(2400); //秤2
|
USART1_Init(2400); //秤2
|
||||||
USART2_Init(38400); //主从MCU通信接口
|
USART2_Init(38400); //主从MCU通信接口
|
||||||
USART3_Init(2400); //秤1
|
USART3_Init(2400); //秤1
|
||||||
USART4_Init(9600); //GPS
|
USART4_Init(2400); //Scale 3
|
||||||
USART5_Init(115200); //秤4
|
USART5_Init(2400); //秤4
|
||||||
|
|
||||||
TIM2_Int_Init(1000, 7200-1); //10Khz的计数频率,计数到1000为100ms (即每个周期为0.1ms)
|
TIM2_Int_Init(1000, 7200-1); //10Khz的计数频率,计数到1000为100ms (即每个周期为0.1ms)
|
||||||
TIM3_Int_Init(100, 7200-1); //10Khz的计数频率(每个周期为0.1ms),定时10ms用于限位开关和按钮扫描
|
TIM3_Int_Init(100, 7200-1); //10Khz的计数频率(每个周期为0.1ms),定时10ms用于限位开关和按钮扫描
|
||||||
@@ -36,7 +35,6 @@ int main(void)
|
|||||||
printf("\r\n***************System Running***************\r\n");
|
printf("\r\n***************System Running***************\r\n");
|
||||||
|
|
||||||
DeviceInit(); //硬件设备初始化
|
DeviceInit(); //硬件设备初始化
|
||||||
GPS_Init();
|
|
||||||
|
|
||||||
IWDG_Init(5, 625); //看门狗初始化,分频数为128,重载值为625,溢出时间为2s
|
IWDG_Init(5, 625); //看门狗初始化,分频数为128,重载值为625,溢出时间为2s
|
||||||
|
|
||||||
@@ -49,7 +47,6 @@ int main(void)
|
|||||||
KeysSendTask(); //按键状态发送任务
|
KeysSendTask(); //按键状态发送任务
|
||||||
RegularUploadTask(); //定时上传任务
|
RegularUploadTask(); //定时上传任务
|
||||||
M_S_DataDecodeTask(); //主从机通信任务
|
M_S_DataDecodeTask(); //主从机通信任务
|
||||||
GPS_Task(); //GPS定位处理任务
|
|
||||||
|
|
||||||
SystemExceptionTask(); //系统异常处理任务
|
SystemExceptionTask(); //系统异常处理任务
|
||||||
IWDG_FeedTask(); //看门狗喂狗任务
|
IWDG_FeedTask(); //看门狗喂狗任务
|
||||||
@@ -73,14 +70,12 @@ int main(void)
|
|||||||
void RegularUploadTask(void)
|
void RegularUploadTask(void)
|
||||||
{
|
{
|
||||||
static timer sendDevStaTimer; //上传设备运行状态信息(温度、信号、测距)
|
static timer sendDevStaTimer; //上传设备运行状态信息(温度、信号、测距)
|
||||||
static timer gpsOutputTimer; //gps输出定时
|
|
||||||
|
|
||||||
static uint8_t timer_ok = 0;
|
static uint8_t timer_ok = 0;
|
||||||
if(timer_ok == 0)
|
if(timer_ok == 0)
|
||||||
{
|
{
|
||||||
timer_ok = 1;
|
timer_ok = 1;
|
||||||
timer_set(&sendDevStaTimer, 5);
|
timer_set(&sendDevStaTimer, 5);
|
||||||
timer_set(&gpsOutputTimer, CLOCK_SECOND*10);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//设备运行状态信息上传
|
//设备运行状态信息上传
|
||||||
@@ -89,12 +84,6 @@ void RegularUploadTask(void)
|
|||||||
timer_restart(&sendDevStaTimer);
|
timer_restart(&sendDevStaTimer);
|
||||||
M_S_CommandSend(0x01);
|
M_S_CommandSend(0x01);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(timer_expired(&gpsOutputTimer))
|
|
||||||
{
|
|
||||||
timer_restart(&gpsOutputTimer);
|
|
||||||
M_S_CommandSend(0x03);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -23,7 +23,10 @@ MCU1 版本标识:`V2.1_260709_4CH`。
|
|||||||
- `MCU2/src/CMSIS/`:CMSIS 与启动文件
|
- `MCU2/src/CMSIS/`:CMSIS 与启动文件
|
||||||
- `MCU2/src/STM32F10x_FWLib/`:STM32F10x 标准外设库
|
- `MCU2/src/STM32F10x_FWLib/`:STM32F10x 标准外设库
|
||||||
- `MCU2/src/SYSTEM/`:系统基础模块
|
- `MCU2/src/SYSTEM/`:系统基础模块
|
||||||
- `MCU2/Release/MCU2_HEX_Output.hex`:副控板可烧录固件
|
- `MCU2/gcc_build/`:副控板 ARM GCC 构建脚本
|
||||||
|
- `MCU2/Release/MCU2_V2.1_260728_4CH.hex`:副控板可烧录固件
|
||||||
|
|
||||||
|
MCU2 版本标识:`V2.1_260728_4CH`,启用四路称重,四路均为 2400 波特率,并停用 GPS。
|
||||||
|
|
||||||
## 构建方式
|
## 构建方式
|
||||||
|
|
||||||
@@ -36,3 +39,9 @@ MCU1 ARM GCC:
|
|||||||
```sh
|
```sh
|
||||||
make -C gcc_build
|
make -C gcc_build
|
||||||
```
|
```
|
||||||
|
|
||||||
|
MCU2 ARM GCC:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
make -C MCU2/gcc_build
|
||||||
|
```
|
||||||
|
|||||||
Reference in New Issue
Block a user