diff --git a/F0:F030,F042,F072/CANBUS_SSI/Makefile.old b/F0:F030,F042,F072/CANBUS_SSI/Makefile.old deleted file mode 100644 index a4f0cf7..0000000 --- a/F0:F030,F042,F072/CANBUS_SSI/Makefile.old +++ /dev/null @@ -1,155 +0,0 @@ -# make debug adds -DEBUG -Werror -# make ADDEFS="additional defs" -BINARY = canstepper -BOOTPORT ?= /dev/ttyUSB0 -BOOTSPEED ?= 115200 -# MCU FAMILY -FAMILY ?= F0 -# MCU code (STM32F072xx) -MCU ?= F072xB -# change this linking script depending on particular MCU model, -LDSCRIPT ?= stm32f0728.ld -DEFS = ${ADDEFS} -DVERSION=\"0.0.1\" -DUSARTNUM=1 -TARGET := RELEASE - -FP_FLAGS ?= -msoft-float -ASM_FLAGS ?= -mthumb -mcpu=cortex-m0 -march=armv6-m -mtune=cortex-m0 -ARCH_FLAGS = $(ASM_FLAGS) $(FP_FLAGS) - -############################################################################### -# Executables -#PREFIX ?= arm-none-eabi -# gcc from arm web site -PREFIX ?= /opt/bin/arm-none-eabi -RM := rm -f -RMDIR := rmdir -CC := $(PREFIX)-gcc -LD := $(PREFIX)-gcc -AR := $(PREFIX)-ar -AS := $(PREFIX)-as -SIZE := $(PREFIX)-size -OBJCOPY := $(PREFIX)-objcopy -OBJDUMP := $(PREFIX)-objdump -GDB := $(PREFIX)-gdb -STFLASH := $(shell which st-flash) -STBOOT := $(shell which stm32flash) -DFUUTIL := $(shell which dfu-util) - -############################################################################### -# Source files -OBJDIR = mk -SRC := $(wildcard *.c) -OBJS := $(addprefix $(OBJDIR)/, $(SRC:%.c=%.o)) -STARTUP = $(OBJDIR)/startup.o -OBJS += $(STARTUP) -# dependencies: we need them to recompile files if their headers-dependencies changed -DEPS := $(OBJS:.o=.d) - -INC_DIR ?= ../../inc - -INCLUDE := -I$(INC_DIR)/Fx -I$(INC_DIR)/cm -LIB_DIR := $(INC_DIR)/ld - -############################################################################### -# C flags -CFLAGS += -O2 -g -MD -D__thumb2__=1 -CFLAGS += -Wall -Wextra -Wshadow -CFLAGS += -fno-common -ffunction-sections -fdata-sections - -############################################################################### -# Linker flags -LDFLAGS += --static -nostartfiles --specs=nano.specs -LDFLAGS += -L$(LIB_DIR) -LDFLAGS += -T$(LDSCRIPT) -LDFLAGS += -Wl,-Map=$(OBJDIR)/$(BINARY).map -LDFLAGS += -Wl,--gc-sections - -############################################################################### -# Used libraries -LDLIBS += -Wl,--start-group -lc -lgcc -Wl,--end-group -LDLIBS += $(shell $(CC) $(CFLAGS) -print-libgcc-file-name) -DEFS += -DSTM32$(FAMILY) -DSTM32$(MCU) - -ELF := $(OBJDIR)/$(BINARY).elf -LIST := $(OBJDIR)/$(BINARY).list -BIN := $(BINARY).bin -HEX := $(BINARY).hex - -all: $(OBJDIR)/RELEASE bin list size -release: all - -debug: CFLAGS += -DEBUG -Werror -W -Wimplicit-function-declaration -debug: $(OBJDIR)/DEBUG bin list size - -$(OBJDIR)/DEBUG: - @rm -rf $(OBJDIR) - @mkdir $(OBJDIR) - @> $(OBJDIR)/DEBUG - @echo "TARGET: DEBUG" - echo "CFLAGS += -DEBUG -Werror -W -Wimplicit-function-declaration" > $(OBJDIR)/CFLAGS -$(OBJDIR)/RELEASE: - @rm -rf $(OBJDIR) - @mkdir $(OBJDIR) - @> $(OBJDIR)/RELEASE - @echo "TARGET: RELEASE" - echo "" > $(OBJDIR)/CFLAGS - -elf: $(ELF) -bin: $(BIN) -hex: $(HEX) -list: $(LIST) - -ifneq ($(MAKECMDGOALS),clean) --include $(DEPS) --include $(OBJDIR)/CFLAGS -endif - -$(OBJDIR): - mkdir $(OBJDIR) - -$(STARTUP): $(INC_DIR)/startup/vector.c - @echo " CC startup" - $(CC) $(CFLAGS) $(DEFS) $(INCLUDE) $(ARCH_FLAGS) -o $@ -c $< - -$(OBJDIR)/%.o: %.c - @echo " CC $<" - $(CC) $(CFLAGS) $(DEFS) $(INCLUDE) $(ARCH_FLAGS) -o $@ -c $< - -$(BIN): $(ELF) - @echo " OBJCOPY $(BIN)" - $(OBJCOPY) -Obinary $(ELF) $(BIN) - -$(HEX): $(ELF) - @echo " OBJCOPY $(HEX)" - $(OBJCOPY) -Oihex $(ELF) $(HEX) - -$(LIST): $(ELF) - @echo " OBJDUMP $(LIST)" - $(OBJDUMP) -S $(ELF) > $(LIST) - -$(ELF): $(OBJDIR) $(OBJS) - @echo " LD $(ELF)" - $(LD) $(LDFLAGS) $(ARCH_FLAGS) $(OBJS) $(LDLIBS) -o $(ELF) - -size: $(ELF) - $(SIZE) $(ELF) - -clean: - @echo " CLEAN" - @$(RM) $(HEX) - @$(RM) -rf $(OBJDIR) 2>/dev/null || true - - -flash: $(BIN) - @echo " FLASH $(BIN)" - $(STFLASH) --reset write $(BIN) 0x8000000 - -boot: $(BIN) - @echo " LOAD $(BIN) through bootloader" - $(STBOOT) -b$(BOOTSPEED) $(BOOTPORT) -w $(BIN) - -dfuboot: $(BIN) - @echo " LOAD $(BIN) THROUGH DFU" - $(DFUUTIL) -a0 -D $(BIN) -s 0x08000000 - -.PHONY: clean flash boot diff --git a/F0:F030,F042,F072/PL2303_ringbuffer/Makefile.old b/F0:F030,F042,F072/PL2303_ringbuffer/Makefile.old deleted file mode 100644 index b6f4bf4..0000000 --- a/F0:F030,F042,F072/PL2303_ringbuffer/Makefile.old +++ /dev/null @@ -1,154 +0,0 @@ -BINARY = PL2303 -BOOTPORT ?= /dev/ttyUSB0 -BOOTSPEED ?= 115200 -INDEPENDENT_HEADERS= -# MCU FAMILY -FAMILY ?= F0 -# MCU code -MCU ?= F042x6 -# change this linking script depending on particular MCU model, -LDSCRIPT ?= stm32f042x6.ld - -# autoincremental version & build date -VERSION_FILE = version.inc -NEXTVER := $(shell expr $$(awk '/#define BUILD_NUMBER/' $(VERSION_FILE) | tr -cd "[0-9]") + 1) -BUILDDATE := $(shell date +%Y-%m-%d) - -FP_FLAGS ?= -msoft-float -# -mfloat-abi=soft -ASM_FLAGS ?= -mthumb -mcpu=cortex-m0 -march=armv6-m -mtune=cortex-m0 -ARCH_FLAGS = $(ASM_FLAGS) $(FP_FLAGS) - -############################################################################### -# Executables -#PREFIX ?= arm-none-eabi -# gcc from arm web site -PREFIX ?= /opt/bin/arm-none-eabi -TOOLCHLIB ?= /opt/arm-none-eabi/lib -RM := rm -f -RMDIR := rmdir -CC := $(PREFIX)-gcc -LD := $(PREFIX)-gcc -AR := $(PREFIX)-ar -AS := $(PREFIX)-as -SIZE := $(PREFIX)-size -OBJCOPY := $(PREFIX)-objcopy -OBJDUMP := $(PREFIX)-objdump -GDB := $(PREFIX)-gdb -STFLASH := $(shell which st-flash) -STBOOT := $(shell which stm32flash) -DFUUTIL := $(shell which dfu-util) - -############################################################################### -# Source files -OBJDIR := mk -SRC := $(wildcard *.c) -OBJS := $(addprefix $(OBJDIR)/, $(SRC:%.c=%.o)) -STARTUP = $(OBJDIR)/startup.o -OBJS += $(STARTUP) -MAP = $(OBJDIR)/$(BINARY).map -# dependencies: we need them to recompile files if their headers-dependencies changed -DEPS := $(OBJS:.o=.d) - -INC_DIR ?= ../inc - -INCLUDE := -I$(INC_DIR)/Fx -I$(INC_DIR)/cm -LIB_DIR := $(INC_DIR)/ld - -############################################################################### -# C flags -CFLAGS += -O2 -g -MD -D__thumb2__=1 -CFLAGS += -Wall -Werror -Wextra -Wshadow -Wimplicit-function-declaration -Wredundant-decls -CFLAGS += -fno-common -ffunction-sections -fdata-sections -# -fno-stack-protector -fshort-enums -CFLAGS += $(ARCH_FLAGS) $(INCLUDE) - -############################################################################### -# Linker flags -LDFLAGS += -nostartfiles --static -Wl,--print-memory-usage -# --specs=nano.specs -nostdlib -LDFLAGS += -Wl,-Map=$(MAP) -Wl,--gc-sections -LDFLAGS += -L$(LIB_DIR) -L$(TOOLCHLIB) -LDFLAGS += -T$(LDSCRIPT) $(ARCH_FLAGS) - -############################################################################### -# Used libraries -LDLIBS += -Wl,--start-group -lc -lgcc -Wl,--end-group $(shell $(CC) $(CFLAGS) -print-libgcc-file-name) - -DEFS += -DSTM32$(FAMILY) -DSTM32$(MCU) - -ELF := $(OBJDIR)/$(BINARY).elf -LIST := $(OBJDIR)/$(BINARY).list -BIN := $(BINARY).bin -HEX := $(BINARY).hex - -all: bin list size - -elf: $(ELF) -bin: $(BIN) -hex: $(HEX) -list: $(LIST) - -ifneq ($(MAKECMDGOALS),clean) --include $(DEPS) -endif - -$(OBJDIR): - mkdir $(OBJDIR) - -$(STARTUP): $(INC_DIR)/startup/vector.c - $(CC) $(CFLAGS) $(DEFS) $(INCLUDE) -o $@ -c $< - -$(VERSION_FILE): *.[ch] - @echo " Generate version: $(NEXTVER) for date $(BUILDDATE)" - @sed -i "s/#define BUILD_NUMBER.*/#define BUILD_NUMBER \"$(NEXTVER)\"/" $(VERSION_FILE) - @sed -i "s/#define BUILD_DATE.*/#define BUILD_DATE \"$(BUILDDATE)\"/" $(VERSION_FILE) - -$(OBJDIR)/proto.o: proto.c $(VERSION_FILE) - -$(OBJDIR)/%.o: %.c - @echo " CC $<" - $(CC) $(CFLAGS) $(DEFS) $(INCLUDE) -o $@ -c $< - -$(BIN): $(ELF) - @echo " OBJCOPY $(BIN)" - $(OBJCOPY) -Obinary $(ELF) $(BIN) - -$(HEX): $(ELF) - @echo " OBJCOPY $(HEX)" - $(OBJCOPY) -Oihex $(ELF) $(HEX) - -$(LIST): $(ELF) - @echo " OBJDUMP $(LIST)" - $(OBJDUMP) -S $(ELF) > $(LIST) - -$(ELF): $(OBJDIR) $(OBJS) - @echo " LD $(ELF)" - $(LD) $(LDFLAGS) $(OBJS) $(LDLIBS) -o $(ELF) - -size: $(ELF) - $(SIZE) $(ELF) - -clean: - @echo " CLEAN" - $(RM) $(OBJS) $(DEPS) $(ELF) $(HEX) $(LIST) $(MAP) - @rmdir $(OBJDIR) 2>/dev/null || true - -flash: $(BIN) - @echo " FLASH $(BIN)" - $(STFLASH) --reset write $(BIN) 0x8000000 - -boot: $(BIN) - @echo " LOAD $(BIN) through bootloader" - $(STBOOT) -b$(BOOTSPEED) $(BOOTPORT) -w $(BIN) - -dfuboot: $(BIN) - @echo " LOAD $(BIN) THROUGH DFU" - $(DFUUTIL) -a0 -D $(BIN) -s 0x08000000 - -openocd: - openocd -f openocd.cfg -dbg: - arm-none-eabi-gdb $(ELF) -ex 'target remote localhost:3333' -ex 'monitor reset halt' - -.PHONY: clean flash boot dfuboot size dbg openocd diff --git a/F0:F030,F042,F072/inc/cm/core_cmFunc.h b/F0:F030,F042,F072/inc/cm/core_cmFunc.h index bdc54e6..d5e32c5 100644 --- a/F0:F030,F042,F072/inc/cm/core_cmFunc.h +++ b/F0:F030,F042,F072/inc/cm/core_cmFunc.h @@ -1,637 +1,637 @@ -/**************************************************************************//** - * @file core_cmFunc.h - * @brief CMSIS Cortex-M Core Function Access Header File - * @version V4.00 - * @date 28. August 2014 - * - * @note - * - ******************************************************************************/ -/* Copyright (c) 2009 - 2014 ARM LIMITED - - All rights reserved. - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - Neither the name of ARM nor the names of its contributors may be used - to endorse or promote products derived from this software without - specific prior written permission. - * - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - ---------------------------------------------------------------------------*/ - - -#ifndef __CORE_CMFUNC_H -#define __CORE_CMFUNC_H - - -/* ########################### Core Function Access ########################### */ -/** \ingroup CMSIS_Core_FunctionInterface - \defgroup CMSIS_Core_RegAccFunctions CMSIS Core Register Access Functions - @{ - */ - -#if defined ( __CC_ARM ) /*------------------RealView Compiler -----------------*/ -/* ARM armcc specific functions */ - -#if (__ARMCC_VERSION < 400677) - #error "Please use ARM Compiler Toolchain V4.0.677 or later!" -#endif - -/* intrinsic void __enable_irq(); */ -/* intrinsic void __disable_irq(); */ - -/** \brief Get Control Register - - This function returns the content of the Control Register. - - \return Control Register value - */ -__STATIC_INLINE uint32_t __get_CONTROL(void) -{ - register uint32_t __regControl __ASM("control"); - return(__regControl); -} - - -/** \brief Set Control Register - - This function writes the given value to the Control Register. - - \param [in] control Control Register value to set - */ -__STATIC_INLINE void __set_CONTROL(uint32_t control) -{ - register uint32_t __regControl __ASM("control"); - __regControl = control; -} - - -/** \brief Get IPSR Register - - This function returns the content of the IPSR Register. - - \return IPSR Register value - */ -__STATIC_INLINE uint32_t __get_IPSR(void) -{ - register uint32_t __regIPSR __ASM("ipsr"); - return(__regIPSR); -} - - -/** \brief Get APSR Register - - This function returns the content of the APSR Register. - - \return APSR Register value - */ -__STATIC_INLINE uint32_t __get_APSR(void) -{ - register uint32_t __regAPSR __ASM("apsr"); - return(__regAPSR); -} - - -/** \brief Get xPSR Register - - This function returns the content of the xPSR Register. - - \return xPSR Register value - */ -__STATIC_INLINE uint32_t __get_xPSR(void) -{ - register uint32_t __regXPSR __ASM("xpsr"); - return(__regXPSR); -} - - -/** \brief Get Process Stack Pointer - - This function returns the current value of the Process Stack Pointer (PSP). - - \return PSP Register value - */ -__STATIC_INLINE uint32_t __get_PSP(void) -{ - register uint32_t __regProcessStackPointer __ASM("psp"); - return(__regProcessStackPointer); -} - - -/** \brief Set Process Stack Pointer - - This function assigns the given value to the Process Stack Pointer (PSP). - - \param [in] topOfProcStack Process Stack Pointer value to set - */ -__STATIC_INLINE void __set_PSP(uint32_t topOfProcStack) -{ - register uint32_t __regProcessStackPointer __ASM("psp"); - __regProcessStackPointer = topOfProcStack; -} - - -/** \brief Get Main Stack Pointer - - This function returns the current value of the Main Stack Pointer (MSP). - - \return MSP Register value - */ -__STATIC_INLINE uint32_t __get_MSP(void) -{ - register uint32_t __regMainStackPointer __ASM("msp"); - return(__regMainStackPointer); -} - - -/** \brief Set Main Stack Pointer - - This function assigns the given value to the Main Stack Pointer (MSP). - - \param [in] topOfMainStack Main Stack Pointer value to set - */ -__STATIC_INLINE void __set_MSP(uint32_t topOfMainStack) -{ - register uint32_t __regMainStackPointer __ASM("msp"); - __regMainStackPointer = topOfMainStack; -} - - -/** \brief Get Priority Mask - - This function returns the current state of the priority mask bit from the Priority Mask Register. - - \return Priority Mask value - */ -__STATIC_INLINE uint32_t __get_PRIMASK(void) -{ - register uint32_t __regPriMask __ASM("primask"); - return(__regPriMask); -} - - -/** \brief Set Priority Mask - - This function assigns the given value to the Priority Mask Register. - - \param [in] priMask Priority Mask - */ -__STATIC_INLINE void __set_PRIMASK(uint32_t priMask) -{ - register uint32_t __regPriMask __ASM("primask"); - __regPriMask = (priMask); -} - - -#if (__CORTEX_M >= 0x03) || (__CORTEX_SC >= 300) - -/** \brief Enable FIQ - - This function enables FIQ interrupts by clearing the F-bit in the CPSR. - Can only be executed in Privileged modes. - */ -#define __enable_fault_irq __enable_fiq - - -/** \brief Disable FIQ - - This function disables FIQ interrupts by setting the F-bit in the CPSR. - Can only be executed in Privileged modes. - */ -#define __disable_fault_irq __disable_fiq - - -/** \brief Get Base Priority - - This function returns the current value of the Base Priority register. - - \return Base Priority register value - */ -__STATIC_INLINE uint32_t __get_BASEPRI(void) -{ - register uint32_t __regBasePri __ASM("basepri"); - return(__regBasePri); -} - - -/** \brief Set Base Priority - - This function assigns the given value to the Base Priority register. - - \param [in] basePri Base Priority value to set - */ -__STATIC_INLINE void __set_BASEPRI(uint32_t basePri) -{ - register uint32_t __regBasePri __ASM("basepri"); - __regBasePri = (basePri & 0xff); -} - - -/** \brief Get Fault Mask - - This function returns the current value of the Fault Mask register. - - \return Fault Mask register value - */ -__STATIC_INLINE uint32_t __get_FAULTMASK(void) -{ - register uint32_t __regFaultMask __ASM("faultmask"); - return(__regFaultMask); -} - - -/** \brief Set Fault Mask - - This function assigns the given value to the Fault Mask register. - - \param [in] faultMask Fault Mask value to set - */ -__STATIC_INLINE void __set_FAULTMASK(uint32_t faultMask) -{ - register uint32_t __regFaultMask __ASM("faultmask"); - __regFaultMask = (faultMask & (uint32_t)1); -} - -#endif /* (__CORTEX_M >= 0x03) || (__CORTEX_SC >= 300) */ - - -#if (__CORTEX_M == 0x04) || (__CORTEX_M == 0x07) - -/** \brief Get FPSCR - - This function returns the current value of the Floating Point Status/Control register. - - \return Floating Point Status/Control register value - */ -__STATIC_INLINE uint32_t __get_FPSCR(void) -{ -#if (__FPU_PRESENT == 1) && (__FPU_USED == 1) - register uint32_t __regfpscr __ASM("fpscr"); - return(__regfpscr); -#else - return(0); -#endif -} - - -/** \brief Set FPSCR - - This function assigns the given value to the Floating Point Status/Control register. - - \param [in] fpscr Floating Point Status/Control value to set - */ -__STATIC_INLINE void __set_FPSCR(uint32_t fpscr) -{ -#if (__FPU_PRESENT == 1) && (__FPU_USED == 1) - register uint32_t __regfpscr __ASM("fpscr"); - __regfpscr = (fpscr); -#endif -} - -#endif /* (__CORTEX_M == 0x04) || (__CORTEX_M == 0x07) */ - - -#elif defined ( __GNUC__ ) /*------------------ GNU Compiler ---------------------*/ -/* GNU gcc specific functions */ - -/** \brief Enable IRQ Interrupts - - This function enables IRQ interrupts by clearing the I-bit in the CPSR. - Can only be executed in Privileged modes. - */ -__attribute__( ( always_inline ) ) __STATIC_INLINE void __enable_irq(void) -{ - __ASM volatile ("cpsie i" : : : "memory"); -} - - -/** \brief Disable IRQ Interrupts - - This function disables IRQ interrupts by setting the I-bit in the CPSR. - Can only be executed in Privileged modes. - */ -__attribute__( ( always_inline ) ) __STATIC_INLINE void __disable_irq(void) -{ - __ASM volatile ("cpsid i" : : : "memory"); -} - - -/** \brief Get Control Register - - This function returns the content of the Control Register. - - \return Control Register value - */ -__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __get_CONTROL(void) -{ - uint32_t result; - - __ASM volatile ("MRS %0, control" : "=r" (result) ); - return(result); -} - - -/** \brief Set Control Register - - This function writes the given value to the Control Register. - - \param [in] control Control Register value to set - */ -__attribute__( ( always_inline ) ) __STATIC_INLINE void __set_CONTROL(uint32_t control) -{ - __ASM volatile ("MSR control, %0" : : "r" (control) : "memory"); -} - - -/** \brief Get IPSR Register - - This function returns the content of the IPSR Register. - - \return IPSR Register value - */ -__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __get_IPSR(void) -{ - uint32_t result; - - __ASM volatile ("MRS %0, ipsr" : "=r" (result) ); - return(result); -} - - -/** \brief Get APSR Register - - This function returns the content of the APSR Register. - - \return APSR Register value - */ -__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __get_APSR(void) -{ - uint32_t result; - - __ASM volatile ("MRS %0, apsr" : "=r" (result) ); - return(result); -} - - -/** \brief Get xPSR Register - - This function returns the content of the xPSR Register. - - \return xPSR Register value - */ -__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __get_xPSR(void) -{ - uint32_t result; - - __ASM volatile ("MRS %0, xpsr" : "=r" (result) ); - return(result); -} - - -/** \brief Get Process Stack Pointer - - This function returns the current value of the Process Stack Pointer (PSP). - - \return PSP Register value - */ -__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __get_PSP(void) -{ - register uint32_t result; - - __ASM volatile ("MRS %0, psp\n" : "=r" (result) ); - return(result); -} - - -/** \brief Set Process Stack Pointer - - This function assigns the given value to the Process Stack Pointer (PSP). - - \param [in] topOfProcStack Process Stack Pointer value to set - */ -__attribute__( ( always_inline ) ) __STATIC_INLINE void __set_PSP(uint32_t topOfProcStack) -{ - __ASM volatile ("MSR psp, %0\n" : : "r" (topOfProcStack) : "sp"); -} - - -/** \brief Get Main Stack Pointer - - This function returns the current value of the Main Stack Pointer (MSP). - - \return MSP Register value - */ -__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __get_MSP(void) -{ - register uint32_t result; - - __ASM volatile ("MRS %0, msp\n" : "=r" (result) ); - return(result); -} - - -/** \brief Set Main Stack Pointer - - This function assigns the given value to the Main Stack Pointer (MSP). - - \param [in] topOfMainStack Main Stack Pointer value to set - */ -__attribute__( ( always_inline ) ) __STATIC_INLINE void __set_MSP(uint32_t topOfMainStack) -{ - __ASM volatile ("MSR msp, %0\n" : : "r" (topOfMainStack)); -} - - -/** \brief Get Priority Mask - - This function returns the current state of the priority mask bit from the Priority Mask Register. - - \return Priority Mask value - */ -__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __get_PRIMASK(void) -{ - uint32_t result; - - __ASM volatile ("MRS %0, primask" : "=r" (result) ); - return(result); -} - - -/** \brief Set Priority Mask - - This function assigns the given value to the Priority Mask Register. - - \param [in] priMask Priority Mask - */ -__attribute__( ( always_inline ) ) __STATIC_INLINE void __set_PRIMASK(uint32_t priMask) -{ - __ASM volatile ("MSR primask, %0" : : "r" (priMask) : "memory"); -} - - -#if (__CORTEX_M >= 0x03) - -/** \brief Enable FIQ - - This function enables FIQ interrupts by clearing the F-bit in the CPSR. - Can only be executed in Privileged modes. - */ -__attribute__( ( always_inline ) ) __STATIC_INLINE void __enable_fault_irq(void) -{ - __ASM volatile ("cpsie f" : : : "memory"); -} - - -/** \brief Disable FIQ - - This function disables FIQ interrupts by setting the F-bit in the CPSR. - Can only be executed in Privileged modes. - */ -__attribute__( ( always_inline ) ) __STATIC_INLINE void __disable_fault_irq(void) -{ - __ASM volatile ("cpsid f" : : : "memory"); -} - - -/** \brief Get Base Priority - - This function returns the current value of the Base Priority register. - - \return Base Priority register value - */ -__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __get_BASEPRI(void) -{ - uint32_t result; - - __ASM volatile ("MRS %0, basepri_max" : "=r" (result) ); - return(result); -} - - -/** \brief Set Base Priority - - This function assigns the given value to the Base Priority register. - - \param [in] basePri Base Priority value to set - */ -__attribute__( ( always_inline ) ) __STATIC_INLINE void __set_BASEPRI(uint32_t value) -{ - __ASM volatile ("MSR basepri, %0" : : "r" (value) : "memory"); -} - - -/** \brief Get Fault Mask - - This function returns the current value of the Fault Mask register. - - \return Fault Mask register value - */ -__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __get_FAULTMASK(void) -{ - uint32_t result; - - __ASM volatile ("MRS %0, faultmask" : "=r" (result) ); - return(result); -} - - -/** \brief Set Fault Mask - - This function assigns the given value to the Fault Mask register. - - \param [in] faultMask Fault Mask value to set - */ -__attribute__( ( always_inline ) ) __STATIC_INLINE void __set_FAULTMASK(uint32_t faultMask) -{ - __ASM volatile ("MSR faultmask, %0" : : "r" (faultMask) : "memory"); -} - -#endif /* (__CORTEX_M >= 0x03) */ - - -#if (__CORTEX_M == 0x04) || (__CORTEX_M == 0x07) - -/** \brief Get FPSCR - - This function returns the current value of the Floating Point Status/Control register. - - \return Floating Point Status/Control register value - */ -__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __get_FPSCR(void) -{ -#if (__FPU_PRESENT == 1) && (__FPU_USED == 1) - uint32_t result; - - /* Empty asm statement works as a scheduling barrier */ - __ASM volatile (""); - __ASM volatile ("VMRS %0, fpscr" : "=r" (result) ); - __ASM volatile (""); - return(result); -#else - return(0); -#endif -} - - -/** \brief Set FPSCR - - This function assigns the given value to the Floating Point Status/Control register. - - \param [in] fpscr Floating Point Status/Control value to set - */ -__attribute__( ( always_inline ) ) __STATIC_INLINE void __set_FPSCR(uint32_t fpscr) -{ -#if (__FPU_PRESENT == 1) && (__FPU_USED == 1) - /* Empty asm statement works as a scheduling barrier */ - __ASM volatile (""); - __ASM volatile ("VMSR fpscr, %0" : : "r" (fpscr) : "vfpcc"); - __ASM volatile (""); -#endif -} - -#endif /* (__CORTEX_M == 0x04) || (__CORTEX_M == 0x07) */ - - -#elif defined ( __ICCARM__ ) /*------------------ ICC Compiler -------------------*/ -/* IAR iccarm specific functions */ -#include - - -#elif defined ( __TMS470__ ) /*---------------- TI CCS Compiler ------------------*/ -/* TI CCS specific functions */ -#include - - -#elif defined ( __TASKING__ ) /*------------------ TASKING Compiler --------------*/ -/* TASKING carm specific functions */ -/* - * The CMSIS functions have been implemented as intrinsics in the compiler. - * Please use "carm -?i" to get an up to date list of all intrinsics, - * Including the CMSIS ones. - */ - - -#elif defined ( __CSMC__ ) /*------------------ COSMIC Compiler -------------------*/ -/* Cosmic specific functions */ -#include - -#endif - -/*@} end of CMSIS_Core_RegAccFunctions */ - -#endif /* __CORE_CMFUNC_H */ +/**************************************************************************//** + * @file core_cmFunc.h + * @brief CMSIS Cortex-M Core Function Access Header File + * @version V4.00 + * @date 28. August 2014 + * + * @note + * + ******************************************************************************/ +/* Copyright (c) 2009 - 2014 ARM LIMITED + + All rights reserved. + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + - Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + - Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + - Neither the name of ARM nor the names of its contributors may be used + to endorse or promote products derived from this software without + specific prior written permission. + * + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + ---------------------------------------------------------------------------*/ + + +#ifndef __CORE_CMFUNC_H +#define __CORE_CMFUNC_H + + +/* ########################### Core Function Access ########################### */ +/** \ingroup CMSIS_Core_FunctionInterface + \defgroup CMSIS_Core_RegAccFunctions CMSIS Core Register Access Functions + @{ + */ + +#if defined ( __CC_ARM ) /*------------------RealView Compiler -----------------*/ +/* ARM armcc specific functions */ + +#if (__ARMCC_VERSION < 400677) + #error "Please use ARM Compiler Toolchain V4.0.677 or later!" +#endif + +/* intrinsic void __enable_irq(); */ +/* intrinsic void __disable_irq(); */ + +/** \brief Get Control Register + + This function returns the content of the Control Register. + + \return Control Register value + */ +__STATIC_INLINE uint32_t __get_CONTROL(void) +{ + register uint32_t __regControl __ASM("control"); + return(__regControl); +} + + +/** \brief Set Control Register + + This function writes the given value to the Control Register. + + \param [in] control Control Register value to set + */ +__STATIC_INLINE void __set_CONTROL(uint32_t control) +{ + register uint32_t __regControl __ASM("control"); + __regControl = control; +} + + +/** \brief Get IPSR Register + + This function returns the content of the IPSR Register. + + \return IPSR Register value + */ +__STATIC_INLINE uint32_t __get_IPSR(void) +{ + register uint32_t __regIPSR __ASM("ipsr"); + return(__regIPSR); +} + + +/** \brief Get APSR Register + + This function returns the content of the APSR Register. + + \return APSR Register value + */ +__STATIC_INLINE uint32_t __get_APSR(void) +{ + register uint32_t __regAPSR __ASM("apsr"); + return(__regAPSR); +} + + +/** \brief Get xPSR Register + + This function returns the content of the xPSR Register. + + \return xPSR Register value + */ +__STATIC_INLINE uint32_t __get_xPSR(void) +{ + register uint32_t __regXPSR __ASM("xpsr"); + return(__regXPSR); +} + + +/** \brief Get Process Stack Pointer + + This function returns the current value of the Process Stack Pointer (PSP). + + \return PSP Register value + */ +__STATIC_INLINE uint32_t __get_PSP(void) +{ + register uint32_t __regProcessStackPointer __ASM("psp"); + return(__regProcessStackPointer); +} + + +/** \brief Set Process Stack Pointer + + This function assigns the given value to the Process Stack Pointer (PSP). + + \param [in] topOfProcStack Process Stack Pointer value to set + */ +__STATIC_INLINE void __set_PSP(uint32_t topOfProcStack) +{ + register uint32_t __regProcessStackPointer __ASM("psp"); + __regProcessStackPointer = topOfProcStack; +} + + +/** \brief Get Main Stack Pointer + + This function returns the current value of the Main Stack Pointer (MSP). + + \return MSP Register value + */ +__STATIC_INLINE uint32_t __get_MSP(void) +{ + register uint32_t __regMainStackPointer __ASM("msp"); + return(__regMainStackPointer); +} + + +/** \brief Set Main Stack Pointer + + This function assigns the given value to the Main Stack Pointer (MSP). + + \param [in] topOfMainStack Main Stack Pointer value to set + */ +__STATIC_INLINE void __set_MSP(uint32_t topOfMainStack) +{ + register uint32_t __regMainStackPointer __ASM("msp"); + __regMainStackPointer = topOfMainStack; +} + + +/** \brief Get Priority Mask + + This function returns the current state of the priority mask bit from the Priority Mask Register. + + \return Priority Mask value + */ +__STATIC_INLINE uint32_t __get_PRIMASK(void) +{ + register uint32_t __regPriMask __ASM("primask"); + return(__regPriMask); +} + + +/** \brief Set Priority Mask + + This function assigns the given value to the Priority Mask Register. + + \param [in] priMask Priority Mask + */ +__STATIC_INLINE void __set_PRIMASK(uint32_t priMask) +{ + register uint32_t __regPriMask __ASM("primask"); + __regPriMask = (priMask); +} + + +#if (__CORTEX_M >= 0x03) || (__CORTEX_SC >= 300) + +/** \brief Enable FIQ + + This function enables FIQ interrupts by clearing the F-bit in the CPSR. + Can only be executed in Privileged modes. + */ +#define __enable_fault_irq __enable_fiq + + +/** \brief Disable FIQ + + This function disables FIQ interrupts by setting the F-bit in the CPSR. + Can only be executed in Privileged modes. + */ +#define __disable_fault_irq __disable_fiq + + +/** \brief Get Base Priority + + This function returns the current value of the Base Priority register. + + \return Base Priority register value + */ +__STATIC_INLINE uint32_t __get_BASEPRI(void) +{ + register uint32_t __regBasePri __ASM("basepri"); + return(__regBasePri); +} + + +/** \brief Set Base Priority + + This function assigns the given value to the Base Priority register. + + \param [in] basePri Base Priority value to set + */ +__STATIC_INLINE void __set_BASEPRI(uint32_t basePri) +{ + register uint32_t __regBasePri __ASM("basepri"); + __regBasePri = (basePri & 0xff); +} + + +/** \brief Get Fault Mask + + This function returns the current value of the Fault Mask register. + + \return Fault Mask register value + */ +__STATIC_INLINE uint32_t __get_FAULTMASK(void) +{ + register uint32_t __regFaultMask __ASM("faultmask"); + return(__regFaultMask); +} + + +/** \brief Set Fault Mask + + This function assigns the given value to the Fault Mask register. + + \param [in] faultMask Fault Mask value to set + */ +__STATIC_INLINE void __set_FAULTMASK(uint32_t faultMask) +{ + register uint32_t __regFaultMask __ASM("faultmask"); + __regFaultMask = (faultMask & (uint32_t)1); +} + +#endif /* (__CORTEX_M >= 0x03) || (__CORTEX_SC >= 300) */ + + +#if (__CORTEX_M == 0x04) || (__CORTEX_M == 0x07) + +/** \brief Get FPSCR + + This function returns the current value of the Floating Point Status/Control register. + + \return Floating Point Status/Control register value + */ +__STATIC_INLINE uint32_t __get_FPSCR(void) +{ +#if (__FPU_PRESENT == 1) && (__FPU_USED == 1) + register uint32_t __regfpscr __ASM("fpscr"); + return(__regfpscr); +#else + return(0); +#endif +} + + +/** \brief Set FPSCR + + This function assigns the given value to the Floating Point Status/Control register. + + \param [in] fpscr Floating Point Status/Control value to set + */ +__STATIC_INLINE void __set_FPSCR(uint32_t fpscr) +{ +#if (__FPU_PRESENT == 1) && (__FPU_USED == 1) + register uint32_t __regfpscr __ASM("fpscr"); + __regfpscr = (fpscr); +#endif +} + +#endif /* (__CORTEX_M == 0x04) || (__CORTEX_M == 0x07) */ + + +#elif defined ( __GNUC__ ) /*------------------ GNU Compiler ---------------------*/ +/* GNU gcc specific functions */ + +/** \brief Enable IRQ Interrupts + + This function enables IRQ interrupts by clearing the I-bit in the CPSR. + Can only be executed in Privileged modes. + */ +__attribute__( ( always_inline ) ) __STATIC_INLINE void __enable_irq(void) +{ + __ASM volatile ("cpsie i" : : : "memory"); +} + + +/** \brief Disable IRQ Interrupts + + This function disables IRQ interrupts by setting the I-bit in the CPSR. + Can only be executed in Privileged modes. + */ +__attribute__( ( always_inline ) ) __STATIC_INLINE void __disable_irq(void) +{ + __ASM volatile ("cpsid i" : : : "memory"); +} + + +/** \brief Get Control Register + + This function returns the content of the Control Register. + + \return Control Register value + */ +__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __get_CONTROL(void) +{ + uint32_t result; + + __ASM volatile ("MRS %0, control" : "=r" (result) ); + return(result); +} + + +/** \brief Set Control Register + + This function writes the given value to the Control Register. + + \param [in] control Control Register value to set + */ +__attribute__( ( always_inline ) ) __STATIC_INLINE void __set_CONTROL(uint32_t control) +{ + __ASM volatile ("MSR control, %0" : : "r" (control) : "memory"); +} + + +/** \brief Get IPSR Register + + This function returns the content of the IPSR Register. + + \return IPSR Register value + */ +__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __get_IPSR(void) +{ + uint32_t result; + + __ASM volatile ("MRS %0, ipsr" : "=r" (result) ); + return(result); +} + + +/** \brief Get APSR Register + + This function returns the content of the APSR Register. + + \return APSR Register value + */ +__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __get_APSR(void) +{ + uint32_t result; + + __ASM volatile ("MRS %0, apsr" : "=r" (result) ); + return(result); +} + + +/** \brief Get xPSR Register + + This function returns the content of the xPSR Register. + + \return xPSR Register value + */ +__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __get_xPSR(void) +{ + uint32_t result; + + __ASM volatile ("MRS %0, xpsr" : "=r" (result) ); + return(result); +} + + +/** \brief Get Process Stack Pointer + + This function returns the current value of the Process Stack Pointer (PSP). + + \return PSP Register value + */ +__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __get_PSP(void) +{ + register uint32_t result; + + __ASM volatile ("MRS %0, psp\n" : "=r" (result) ); + return(result); +} + + +/** \brief Set Process Stack Pointer + + This function assigns the given value to the Process Stack Pointer (PSP). + + \param [in] topOfProcStack Process Stack Pointer value to set + */ +__attribute__( ( always_inline ) ) __STATIC_INLINE void __set_PSP(uint32_t topOfProcStack) +{ + __ASM volatile ("MSR psp, %0\n" : : "r" (topOfProcStack) : ); +} + + +/** \brief Get Main Stack Pointer + + This function returns the current value of the Main Stack Pointer (MSP). + + \return MSP Register value + */ +__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __get_MSP(void) +{ + register uint32_t result; + + __ASM volatile ("MRS %0, msp\n" : "=r" (result) ); + return(result); +} + + +/** \brief Set Main Stack Pointer + + This function assigns the given value to the Main Stack Pointer (MSP). + + \param [in] topOfMainStack Main Stack Pointer value to set + */ +__attribute__( ( always_inline ) ) __STATIC_INLINE void __set_MSP(uint32_t topOfMainStack) +{ + __ASM volatile ("MSR msp, %0\n" : : "r" (topOfMainStack) : ); +} + + +/** \brief Get Priority Mask + + This function returns the current state of the priority mask bit from the Priority Mask Register. + + \return Priority Mask value + */ +__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __get_PRIMASK(void) +{ + uint32_t result; + + __ASM volatile ("MRS %0, primask" : "=r" (result) ); + return(result); +} + + +/** \brief Set Priority Mask + + This function assigns the given value to the Priority Mask Register. + + \param [in] priMask Priority Mask + */ +__attribute__( ( always_inline ) ) __STATIC_INLINE void __set_PRIMASK(uint32_t priMask) +{ + __ASM volatile ("MSR primask, %0" : : "r" (priMask) : "memory"); +} + + +#if (__CORTEX_M >= 0x03) + +/** \brief Enable FIQ + + This function enables FIQ interrupts by clearing the F-bit in the CPSR. + Can only be executed in Privileged modes. + */ +__attribute__( ( always_inline ) ) __STATIC_INLINE void __enable_fault_irq(void) +{ + __ASM volatile ("cpsie f" : : : "memory"); +} + + +/** \brief Disable FIQ + + This function disables FIQ interrupts by setting the F-bit in the CPSR. + Can only be executed in Privileged modes. + */ +__attribute__( ( always_inline ) ) __STATIC_INLINE void __disable_fault_irq(void) +{ + __ASM volatile ("cpsid f" : : : "memory"); +} + + +/** \brief Get Base Priority + + This function returns the current value of the Base Priority register. + + \return Base Priority register value + */ +__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __get_BASEPRI(void) +{ + uint32_t result; + + __ASM volatile ("MRS %0, basepri_max" : "=r" (result) ); + return(result); +} + + +/** \brief Set Base Priority + + This function assigns the given value to the Base Priority register. + + \param [in] basePri Base Priority value to set + */ +__attribute__( ( always_inline ) ) __STATIC_INLINE void __set_BASEPRI(uint32_t value) +{ + __ASM volatile ("MSR basepri, %0" : : "r" (value) : "memory"); +} + + +/** \brief Get Fault Mask + + This function returns the current value of the Fault Mask register. + + \return Fault Mask register value + */ +__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __get_FAULTMASK(void) +{ + uint32_t result; + + __ASM volatile ("MRS %0, faultmask" : "=r" (result) ); + return(result); +} + + +/** \brief Set Fault Mask + + This function assigns the given value to the Fault Mask register. + + \param [in] faultMask Fault Mask value to set + */ +__attribute__( ( always_inline ) ) __STATIC_INLINE void __set_FAULTMASK(uint32_t faultMask) +{ + __ASM volatile ("MSR faultmask, %0" : : "r" (faultMask) : "memory"); +} + +#endif /* (__CORTEX_M >= 0x03) */ + + +#if (__CORTEX_M == 0x04) || (__CORTEX_M == 0x07) + +/** \brief Get FPSCR + + This function returns the current value of the Floating Point Status/Control register. + + \return Floating Point Status/Control register value + */ +__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __get_FPSCR(void) +{ +#if (__FPU_PRESENT == 1) && (__FPU_USED == 1) + uint32_t result; + + /* Empty asm statement works as a scheduling barrier */ + __ASM volatile (""); + __ASM volatile ("VMRS %0, fpscr" : "=r" (result) ); + __ASM volatile (""); + return(result); +#else + return(0); +#endif +} + + +/** \brief Set FPSCR + + This function assigns the given value to the Floating Point Status/Control register. + + \param [in] fpscr Floating Point Status/Control value to set + */ +__attribute__( ( always_inline ) ) __STATIC_INLINE void __set_FPSCR(uint32_t fpscr) +{ +#if (__FPU_PRESENT == 1) && (__FPU_USED == 1) + /* Empty asm statement works as a scheduling barrier */ + __ASM volatile (""); + __ASM volatile ("VMSR fpscr, %0" : : "r" (fpscr) : "vfpcc"); + __ASM volatile (""); +#endif +} + +#endif /* (__CORTEX_M == 0x04) || (__CORTEX_M == 0x07) */ + + +#elif defined ( __ICCARM__ ) /*------------------ ICC Compiler -------------------*/ +/* IAR iccarm specific functions */ +#include + + +#elif defined ( __TMS470__ ) /*---------------- TI CCS Compiler ------------------*/ +/* TI CCS specific functions */ +#include + + +#elif defined ( __TASKING__ ) /*------------------ TASKING Compiler --------------*/ +/* TASKING carm specific functions */ +/* + * The CMSIS functions have been implemented as intrinsics in the compiler. + * Please use "carm -?i" to get an up to date list of all intrinsics, + * Including the CMSIS ones. + */ + + +#elif defined ( __CSMC__ ) /*------------------ COSMIC Compiler -------------------*/ +/* Cosmic specific functions */ +#include + +#endif + +/*@} end of CMSIS_Core_RegAccFunctions */ + +#endif /* __CORE_CMFUNC_H */ diff --git a/F0:F030,F042,F072/usbcan_gpio/Makefile b/F0:F030,F042,F072/usbcan_gpio/Makefile new file mode 100644 index 0000000..3607fae --- /dev/null +++ b/F0:F030,F042,F072/usbcan_gpio/Makefile @@ -0,0 +1,12 @@ +BINARY := usbcangpio +# MCU code +#MCU := F072xB +MCU := F042x6 +# change this linking script depending on particular MCU model, +#LDSCRIPT := stm32f072xB.ld +LDSCRIPT := stm32f042x6.ld + +DEFINES := -DUSB2_16 + +include ../makefile.f0 +include ../../makefile.stm32 diff --git a/F0:F030,F042,F072/usbcan_gpio/Readme.md b/F0:F030,F042,F072/usbcan_gpio/Readme.md new file mode 100644 index 0000000..f5a8006 --- /dev/null +++ b/F0:F030,F042,F072/usbcan_gpio/Readme.md @@ -0,0 +1,12 @@ +USB-CAN adapter +=============== + +Based on [USB-CAN](https://github.com/eddyem/stm32samples/tree/master/F0%3AF030%2CF042%2CF072/usbcan_ringbuffer). + +Unlike original (only USB-CAN) adapter, in spite of it have GPIO contacts on board, this firmware allows to use both +USB-CAN and GPIO. + +The old USB-CAN is available as earlier by /dev/USB-CANx, also you can see new device: /dev/USB-GPIOx. +New interface allows you to configure GPIO and use it's base functions: in/out/ADC. + + diff --git a/F0:F030,F042,F072/usbcan_gpio/can.c b/F0:F030,F042,F072/usbcan_gpio/can.c new file mode 100644 index 0000000..7690c44 --- /dev/null +++ b/F0:F030,F042,F072/usbcan_gpio/can.c @@ -0,0 +1,396 @@ +/* + * This file is part of the usbcangpio project. + * Copyright 2022 Edward V. Emelianov . + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include "can.h" +#include "hardware.h" +#include "canproto.h" + +#define USBIF ICAN +#include "strfunc.h" + +// circular buffer for received messages +static CAN_message messages[CAN_INMESSAGE_SIZE]; +static uint8_t first_free_idx = 0; // index of first empty cell +static int8_t first_nonfree_idx = -1; // index of first data cell +uint32_t floodT = FLOOD_PERIOD_MS; // flood period in ms +static uint8_t incrflood = 0; // ==1 for incremental flooding + +static uint32_t last_err_code = 0; +static CAN_status can_status = CAN_STOP; + +static void can_process_fifo(uint8_t fifo_num); + +static CAN_message loc_flood_msg; +static CAN_message *flood_msg = NULL; // == loc_flood_msg - to flood + +CAN_status CAN_get_status(){ + CAN_status st = can_status; + // give overrun message only once + if(st == CAN_FIFO_OVERRUN){ + SEND("FIFO overrun\n"); + can_status = CAN_READY; + } + return st; +} + +// push next message into buffer; return 1 if buffer overfull +static int CAN_messagebuf_push(CAN_message *msg){ +#ifdef EBUG + SEND("push\n"); +#endif + if(first_free_idx == first_nonfree_idx){ +#ifdef EBUG + SEND("INBUF OVERFULL\n"); +#endif + return 1; // no free space + } + if(first_nonfree_idx < 0) first_nonfree_idx = 0; // first message in empty buffer + messages[first_free_idx++] = *msg; + // need to roll? + if(first_free_idx == CAN_INMESSAGE_SIZE) first_free_idx = 0; + return 0; +} + +// pop message from buffer +CAN_message *CAN_messagebuf_pop(){ + if(first_nonfree_idx < 0) return NULL; + CAN_message *msg = &messages[first_nonfree_idx++]; + if(first_nonfree_idx == CAN_INMESSAGE_SIZE) first_nonfree_idx = 0; + if(first_nonfree_idx == first_free_idx){ // buffer is empty - refresh it + first_nonfree_idx = -1; + first_free_idx = 0; + } + return msg; +} + +int CAN_reinit(uint16_t speed){ + CAN->TSR |= CAN_TSR_ABRQ0 | CAN_TSR_ABRQ1 | CAN_TSR_ABRQ2; + RCC->APB1RSTR |= RCC_APB1RSTR_CANRST; + RCC->APB1RSTR &= ~RCC_APB1RSTR_CANRST; + return CAN_setup(speed); +} + +/* +Can filtering: FSCx=0 (CAN->FS1R) -> 16-bit identifiers +MASK: FBMx=0 (CAN->FM1R), two filters (n in FR1 and n+1 in FR2) + ID: CAN->sFilterRegister[x].FRn[0..15] + MASK: CAN->sFilterRegister[x].FRn[16..31] + FR bits: STID[10:0] RTR IDE EXID[17:15] +LIST: FBMx=1, four filters (n&n+1 in FR1, n+2&n+3 in FR2) + IDn: CAN->sFilterRegister[x].FRn[0..15] + IDn+1: CAN->sFilterRegister[x].FRn[16..31] +*/ + +/* +Can timing: main freq - APB (PLL=48MHz) +segment = 1sync + TBS1 + TBS2, sample point is between TBS1 and TBS2, +so if TBS1=4 and TBS2=3, sum=8, bit sampling freq is 48/8 = 6MHz +-> to get 100kbps we need prescaler=60 + 250kbps - 24 + 500kbps - 12 + 1MBps - 6 +*/ + + +static uint16_t oldspeed = 100; // speed of last init +uint16_t CAN_getspeed(){ + return oldspeed; +} +// speed - in kbps. @return - current speed +int CAN_setup(uint16_t speed){ + LED_off(LED1); + flood_msg = NULL; // clear for not flood in terminal + incrflood = 0; + if(speed == 0) speed = oldspeed; + else if(speed < CAN_MIN_SPEED) speed = CAN_MIN_SPEED; + else if(speed > CAN_MAX_SPEED) speed = CAN_MAX_SPEED; + uint32_t regval = 6000/speed - 1; + oldspeed = 6000 / (regval + 1); // new speed due to register value + uint32_t tmout = 16000000; + // Configure GPIO: PB8 - CAN_Rx, PB9 - CAN_Tx + /* (1) Select AF mode (10) on PB8 and PB9 */ + /* (2) AF4 for CAN signals */ + GPIOB->MODER = (GPIOB->MODER & ~(GPIO_MODER_MODER8 | GPIO_MODER_MODER9)) + | (GPIO_MODER_MODER8_AF | GPIO_MODER_MODER9_AF); /* (1) */ + GPIOB->AFR[1] = (GPIOB->AFR[1] &~ (GPIO_AFRH_AFRH0 | GPIO_AFRH_AFRH1))\ + | (4 << (0 * 4)) | (4 << (1 * 4)); /* (2) */ + /* Enable the peripheral clock CAN */ + RCC->APB1ENR |= RCC_APB1ENR_CANEN; + /* Configure CAN */ + /* (1) Enter CAN init mode to write the configuration */ + /* (2) Wait the init mode entering */ + /* (3) Exit sleep mode */ + /* (4) Normal mode, set timing to 100kb/s: TBS1 = 4, TBS2 = 3, prescaler = 60 */ + /* (5) Leave init mode */ + /* (6) Wait the init mode leaving */ + /* (7) Enter filter init mode, (16-bit + mask, bank 0 for FIFO 0) */ + /* (8) Acivate filter 0 for two IDs */ + /* (9) Identifier list mode */ + /* (10) Set the Id list */ + /* (12) Leave filter init */ + /* (13) Set error interrupts enable */ + CAN->MCR |= CAN_MCR_INRQ; /* (1) */ + while((CAN->MSR & CAN_MSR_INAK)!=CAN_MSR_INAK) /* (2) */ + if(--tmout == 0) break; + CAN->MCR &=~ CAN_MCR_SLEEP; /* (3) */ + CAN->MCR |= CAN_MCR_ABOM; /* allow automatically bus-off */ + + CAN->BTR = 2 << 20 | 3 << 16 | regval; /* (4) */ + CAN->MCR &=~ CAN_MCR_INRQ; /* (5) */ + tmout = 16000000; + while((CAN->MSR & CAN_MSR_INAK)==CAN_MSR_INAK) if(--tmout == 0) break; /* (6) */ + // accept ALL + CAN->FMR = CAN_FMR_FINIT; /* (7) */ + CAN->FA1R = CAN_FA1R_FACT0 | CAN_FA1R_FACT1; /* (8) */ + // set to 1 all needed bits of CAN->FFA1R to switch given filters to FIFO1 + CAN->sFilterRegister[0].FR1 = (1<<21)|(1<<5); // all odd IDs + CAN->FFA1R = 2; // filter 1 for FIFO1, filter 0 - for FIFO0 + CAN->sFilterRegister[1].FR1 = (1<<21); // all even IDs + CAN->FMR &= ~CAN_FMR_FINIT; /* (12) */ + CAN->IER |= CAN_IER_ERRIE | CAN_IER_FOVIE0 | CAN_IER_FOVIE1; /* (13) */ + + /* Configure IT */ + /* (14) Set priority for CAN_IRQn */ + /* (15) Enable CAN_IRQn */ + NVIC_SetPriority(CEC_CAN_IRQn, 0); /* (14) */ + NVIC_EnableIRQ(CEC_CAN_IRQn); /* (15) */ + can_status = CAN_READY; + return oldspeed; +} + +void printCANerr(){ + if(!last_err_code) last_err_code = CAN->ESR; + if(!last_err_code){ + SEND("No errors\n"); + return; + } + SEND("Receive error counter: "); + printu((last_err_code & CAN_ESR_REC)>>24); + SEND("\nTransmit error counter: "); + printu((last_err_code & CAN_ESR_TEC)>>16); + SEND("\nLast error code: "); + int lec = (last_err_code & CAN_ESR_LEC) >> 4; + const char *errmsg = "No"; + switch(lec){ + case 1: errmsg = "Stuff"; break; + case 2: errmsg = "Form"; break; + case 3: errmsg = "Ack"; break; + case 4: errmsg = "Bit recessive"; break; + case 5: errmsg = "Bit dominant"; break; + case 6: errmsg = "CRC"; break; + case 7: errmsg = "(set by software)"; break; + } + SEND(errmsg); SEND(" error\n"); + if(last_err_code & CAN_ESR_BOFF) SEND("Bus off "); + if(last_err_code & CAN_ESR_EPVF) SEND("Passive error limit "); + if(last_err_code & CAN_ESR_EWGF) SEND("Error counter limit"); + last_err_code = 0; + NL(); +} + +void can_proc(){ +#ifdef EBUG + if(last_err_code){ + SEND("Error, ESR="); + printu(last_err_code); + NL(); + last_err_code = 0; + } +#endif + // check for messages in FIFO0 & FIFO1 + if(CAN->RF0R & CAN_RF0R_FMP0){ + can_process_fifo(0); + } + if(CAN->RF1R & CAN_RF1R_FMP1){ + can_process_fifo(1); + } + IWDG->KR = IWDG_REFRESH; + if(CAN->ESR & (CAN_ESR_BOFF | CAN_ESR_EPVF | CAN_ESR_EWGF)){ // much errors - restart CAN BUS + SEND("\nToo much errors, restarting CAN!\n"); + printCANerr(); + // request abort for all mailboxes + CAN->TSR |= CAN_TSR_ABRQ0 | CAN_TSR_ABRQ1 | CAN_TSR_ABRQ2; + // reset CAN bus + RCC->APB1RSTR |= RCC_APB1RSTR_CANRST; + RCC->APB1RSTR &= ~RCC_APB1RSTR_CANRST; + CAN_setup(0); + } + static uint32_t lastFloodTime = 0; + static uint32_t incrmessagectr = 0; + if(flood_msg && (Tms - lastFloodTime) >= (floodT)){ // send message every floodT ms + lastFloodTime = Tms; + can_send(flood_msg->data, flood_msg->length, flood_msg->ID); + }else if(incrflood && (Tms - lastFloodTime) >= floodT){ // incremental flood message + lastFloodTime = Tms; + if(CAN_OK == can_send((uint8_t*)&incrmessagectr, 4, loc_flood_msg.ID)) ++incrmessagectr; + } +} + +CAN_status can_send(uint8_t *msg, uint8_t len, uint16_t target_id){ + uint8_t mailbox = 0; + // check first free mailbox + if(CAN->TSR & (CAN_TSR_TME)){ + mailbox = (CAN->TSR & CAN_TSR_CODE) >> 24; + }else{ // no free mailboxes +#ifdef EBUG + SEND("No free mailboxes\n"); +#endif + return CAN_BUSY; + } +#ifdef EBUG + SEND("Send data. Len="); printu(len); + SEND(", tagid="); printuhex(target_id); + SEND(", data="); + for(int i = 0; i < len; ++i){ + SEND(" "); printuhex(msg[i]); + } + NL(); +#endif + CAN_TxMailBox_TypeDef *box = &CAN->sTxMailBox[mailbox]; + uint32_t lb = 0, hb = 0; + switch(len){ + case 8: + hb |= (uint32_t)msg[7] << 24; + // fallthrough + case 7: + hb |= (uint32_t)msg[6] << 16; + // fallthrough + case 6: + hb |= (uint32_t)msg[5] << 8; + // fallthrough + case 5: + hb |= (uint32_t)msg[4]; + // fallthrough + case 4: + lb |= (uint32_t)msg[3] << 24; + // fallthrough + case 3: + lb |= (uint32_t)msg[2] << 16; + // fallthrough + case 2: + lb |= (uint32_t)msg[1] << 8; + // fallthrough + default: + lb |= (uint32_t)msg[0]; + } + box->TDLR = lb; + box->TDHR = hb; + box->TDTR = len; + box->TIR = (target_id & 0x7FF) << 21 | CAN_TI0R_TXRQ; + return CAN_OK; +} + +void set_flood(CAN_message *msg, int incr){ + if(incr){ incrflood = 1; return; } + incrflood = 0; + if(!msg) flood_msg = NULL; + else{ +#ifdef EBUG + SEND("flood msg: #"); + printuhex(msg->ID); + for(uint8_t ctr = 0; ctr < msg->length; ++ctr){ + PUTCHAR(' '); + printuhex(msg->data[ctr]); + } + NL(); +#endif + // I meet strange problems with `loc_flood_msg = *msg` and system memcpy, so.. + loc_flood_msg.ID = msg->ID; + loc_flood_msg.length = msg->length; + *((uint32_t*)loc_flood_msg.data) = *((uint32_t*)msg->data); + if(loc_flood_msg.length > 4) + *((uint32_t*)&loc_flood_msg.data[4]) = *((uint32_t*)&msg->data[4]); + flood_msg = &loc_flood_msg; + } +} + +static void can_process_fifo(uint8_t fifo_num){ + if(fifo_num > 1) return; + LED_on(LED1); // Turn on LED1 - message received + CAN_FIFOMailBox_TypeDef *box = &CAN->sFIFOMailBox[fifo_num]; + volatile uint32_t *RFxR = (fifo_num) ? &CAN->RF1R : &CAN->RF0R; +#ifdef EBUG + printu(*RFxR & CAN_RF0R_FMP0); SEND(" messages in FIFO\n"); +#endif + // read all + while(*RFxR & CAN_RF0R_FMP0){ // amount of messages pending + // CAN_RDTxR: (16-31) - timestamp, (8-15) - filter match index, (0-3) - data length + /* TODO: check filter match index if more than one ID can receive */ + CAN_message msg; + uint8_t *dat = msg.data; + uint8_t len = box->RDTR & 0x0f; + msg.length = len; + msg.ID = box->RIR >> 21; + //msg.filterNo = (box->RDTR >> 8) & 0xff; + //msg.fifoNum = fifo_num; + if(len){ // message can be without data + uint32_t hb = box->RDHR, lb = box->RDLR; + switch(len){ + case 8: + dat[7] = hb>>24; + // fallthrough + case 7: + dat[6] = (hb>>16) & 0xff; + // fallthrough + case 6: + dat[5] = (hb>>8) & 0xff; + // fallthrough + case 5: + dat[4] = hb & 0xff; + // fallthrough + case 4: + dat[3] = lb>>24; + // fallthrough + case 3: + dat[2] = (lb>>16) & 0xff; + // fallthrough + case 2: + dat[1] = (lb>>8) & 0xff; + // fallthrough + case 1: + dat[0] = lb & 0xff; + } + } + if(CAN_messagebuf_push(&msg)) return; // error: buffer is full, try later + *RFxR = CAN_RF0R_RFOM0; // release fifo for access to next message + } + //if(*RFxR & CAN_RF0R_FULL0) *RFxR &= ~CAN_RF0R_FULL0; + *RFxR = 0; // clear FOVR & FULL +} + +void cec_can_isr(){ + if(CAN->RF0R & CAN_RF0R_FOVR0){ // FIFO overrun + CAN->RF0R = CAN_RF0R_FOVR0; + can_status = CAN_FIFO_OVERRUN; + } + if(CAN->RF1R & CAN_RF1R_FOVR1){ + CAN->RF1R = CAN_RF1R_FOVR1; + can_status = CAN_FIFO_OVERRUN; + } + if(CAN->MSR & CAN_MSR_ERRI){ // Error + CAN->MSR &= ~CAN_MSR_ERRI; + // request abort for problem mailbox + if(CAN->TSR & CAN_TSR_TERR0) CAN->TSR |= CAN_TSR_ABRQ0; + if(CAN->TSR & CAN_TSR_TERR1) CAN->TSR |= CAN_TSR_ABRQ1; + if(CAN->TSR & CAN_TSR_TERR2) CAN->TSR |= CAN_TSR_ABRQ2; +#ifdef EBUG + last_err_code = CAN->ESR; +#endif + } +} + diff --git a/F0:F030,F042,F072/usbcan_gpio/can.h b/F0:F030,F042,F072/usbcan_gpio/can.h new file mode 100644 index 0000000..36bda41 --- /dev/null +++ b/F0:F030,F042,F072/usbcan_gpio/can.h @@ -0,0 +1,64 @@ +/* + * This file is part of the usbcangpio project. + * Copyright 2022 Edward V. Emelianov . + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#pragma once + +#include + +// min/max CAN speed (kBaud) +#define CAN_MIN_SPEED 10 +#define CAN_MAX_SPEED 1000 + +// amount of filter banks in STM32F0 +#define STM32F0FBANKNO 28 +// flood period in milliseconds +#define FLOOD_PERIOD_MS 5 + +// incoming message buffer size +#define CAN_INMESSAGE_SIZE (8) + +extern uint32_t floodT; + +// CAN message +typedef struct{ + uint8_t data[8]; // up to 8 bytes of data + uint8_t length; // data length + uint16_t ID; // ID of receiver +} CAN_message; + +typedef enum{ + CAN_STOP, + CAN_READY, + CAN_BUSY, + CAN_OK, + CAN_FIFO_OVERRUN +} CAN_status; + +CAN_status CAN_get_status(); + +int CAN_reinit(uint16_t speed); +int CAN_setup(uint16_t speed); +uint16_t CAN_getspeed(); + +CAN_status can_send(uint8_t *msg, uint8_t len, uint16_t target_id); +void can_proc(); +void printCANerr(); + +CAN_message *CAN_messagebuf_pop(); + +void set_flood(CAN_message *msg, int incr); diff --git a/F0:F030,F042,F072/usbcan_gpio/canproto.c b/F0:F030,F042,F072/usbcan_gpio/canproto.c new file mode 100644 index 0000000..2f6da31 --- /dev/null +++ b/F0:F030,F042,F072/usbcan_gpio/canproto.c @@ -0,0 +1,483 @@ +/* + * This file is part of the usbcangpio project. + * Copyright 2022 Edward V. Emelianov . + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include + +#include "can.h" +#include "hardware.h" +#include "canproto.h" + +#define USBIF ICAN +#include "strfunc.h" + +#define IGN_SIZE 10 + +extern volatile uint8_t canerror; + +static uint8_t ShowMsgs = 1; +static uint16_t Ignore_IDs[IGN_SIZE]; +static uint8_t IgnSz = 0; + +// parse `txt` to CAN_message +static CAN_message *parseCANmsg(char *txt){ + static CAN_message canmsg; + uint32_t N; + char *n; + int ctr = -1; + canmsg.ID = 0xffff; + do{ + n = getnum(txt, &N); + if(txt == n) break; + txt = n; + if(ctr == -1){ + if(N > 0x7ff){ + SEND("ID should be 11-bit number!\n"); + return NULL; + } + canmsg.ID = (uint16_t)(N&0x7ff); + ctr = 0; + continue; + } + if(ctr > 7){ + SEND("ONLY 8 data bytes allowed!\n"); + return NULL; + } + if(N > 0xff){ + SEND("Every data portion is a byte!\n"); + return NULL; + } + canmsg.data[ctr++] = (uint8_t)(N&0xff); + }while(1); + if(canmsg.ID == 0xffff){ + SEND("NO ID given, send nothing!\n"); + return NULL; + } + SEND("Message parsed OK\n"); + canmsg.length = (uint8_t) ctr; + return &canmsg; +} + +// USB_sendstr command, format: ID (hex/bin/dec) data bytes (up to 8 bytes, space-delimeted) +TRUE_INLINE void USB_sendstrCANcommand(char *txt){ + if(CAN->MSR & CAN_MSR_INAK){ + SEND("CAN bus is off, try to restart it\n"); + return; + } + CAN_message *msg = parseCANmsg(txt); + if(!msg) return; + uint32_t N = 5; + while(CAN_BUSY == can_send(msg->data, msg->length, msg->ID)){ + if(--N == 0) break; + } +} + +TRUE_INLINE void CANini(char *txt){ + uint32_t N; + char *n = getnum(txt, &N); + if(txt == n){ + printu(CAN_getspeed()); + SEND("kbps\n"); + return; + } + if(N < CAN_MIN_SPEED){ + SEND("Speed is too low\n"); + return; + }else if(N > CAN_MAX_SPEED){ + SEND("Speed is too high\n"); + return; + } + CAN_reinit((uint16_t)N); + SEND("Reinit CAN bus with speed "); + printu(N); SEND("kbps\n"); +} + +TRUE_INLINE void addIGN(char *txt){ + if(IgnSz == IGN_SIZE){ + SEND("Ignore buffer is full\n"); + return; + } + txt = omit_spaces(txt); + uint32_t N; + char *n = getnum(txt, &N); + if(txt == n){ + SEND("No ID given\n"); + return; + } + if(N > 0x7ff){ + SEND("ID should be 11-bit number!\n"); + return; + } + Ignore_IDs[IgnSz++] = (uint16_t)(N & 0x7ff); + SEND("Added ID "); printu(N); + SEND("\nIgn buffer size: "); printu(IgnSz); + NL(); +} + +TRUE_INLINE void print_ign_buf(){ + if(IgnSz == 0){ + SEND("Ignore buffer is empty\n"); + return; + } + SEND("Ignored IDs:\n"); + for(int i = 0; i < IgnSz; ++i){ + printu(i); + SEND(": "); + printuhex(Ignore_IDs[i]); + NL(); + } +} + +// print ID/mask of CAN->sFilterRegister[x] half +static void printID(uint16_t FRn){ + if(FRn & 0x1f) return; // trash + printuhex(FRn >> 5); +} +/* +Can filtering: FSCx=0 (CAN->FS1R) -> 16-bit identifiers +CAN->FMR = (sb)<<8 | FINIT - init filter in starting bank sb +CAN->FFA1R FFAx = 1 -> FIFO1, 0 -> FIFO0 +CAN->FA1R FACTx=1 - filter active +MASK: FBMx=0 (CAN->FM1R), two filters (n in FR1 and n+1 in FR2) + ID: CAN->sFilterRegister[x].FRn[0..15] + MASK: CAN->sFilterRegister[x].FRn[16..31] + FR bits: STID[10:0] RTR IDE EXID[17:15] +LIST: FBMx=1, four filters (n&n+1 in FR1, n+2&n+3 in FR2) + IDn: CAN->sFilterRegister[x].FRn[0..15] + IDn+1: CAN->sFilterRegister[x].FRn[16..31] +*/ +TRUE_INLINE void list_filters(){ + uint32_t fa = CAN->FA1R, ctr = 0, mask = 1; + while(fa){ + if(fa & 1){ + SEND("Filter "); printu(ctr); SEND(", FIFO"); + if(CAN->FFA1R & mask) SEND("1"); + else SEND("0"); + SEND(" in "); + if(CAN->FM1R & mask){ // up to 4 filters in LIST mode + SEND("LIST mode, IDs: "); + printID(CAN->sFilterRegister[ctr].FR1 & 0xffff); + SEND(" "); + printID(CAN->sFilterRegister[ctr].FR1 >> 16); + SEND(" "); + printID(CAN->sFilterRegister[ctr].FR2 & 0xffff); + SEND(" "); + printID(CAN->sFilterRegister[ctr].FR2 >> 16); + }else{ // up to 2 filters in MASK mode + SEND("MASK mode: "); + if(!(CAN->sFilterRegister[ctr].FR1&0x1f)){ + SEND("ID="); printID(CAN->sFilterRegister[ctr].FR1 & 0xffff); + SEND(", MASK="); printID(CAN->sFilterRegister[ctr].FR1 >> 16); + SEND(" "); + } + if(!(CAN->sFilterRegister[ctr].FR2&0x1f)){ + SEND("ID="); printID(CAN->sFilterRegister[ctr].FR2 & 0xffff); + SEND(", MASK="); printID(CAN->sFilterRegister[ctr].FR2 >> 16); + } + } + NL(); + } + fa >>= 1; + ++ctr; + mask <<= 1; + } +} + +TRUE_INLINE void setfloodt(char *s){ + uint32_t N; + s = omit_spaces(s); + char *n = getnum(s, &N); + if(s != n){ + floodT = N; + } + SEND("t="); printu(floodT); NL(); +} + +/** + * @brief add_filter - add/modify filter + * @param str - string in format "bank# FIFO# mode num0 .. num3" + * where bank# - 0..27 + * if there's nothing after bank# - delete filter + * FIFO# - 0,1 + * mode - 'I' for ID, 'M' for mask + * num0..num3 - IDs in ID mode, ID/MASK for mask mode + */ +static void add_filter(char *str){ + uint32_t N; + str = omit_spaces(str); + char *n = getnum(str, &N); + if(n == str){ + SEND("No bank# given\n"); + return; + } + if(N > STM32F0FBANKNO-1){ + SEND("bank# > 27\n"); + return; + } + uint8_t bankno = (uint8_t)N; + str = omit_spaces(n); + if(!*str){ // deactivate filter + SEND("Deactivate filters in bank "); + printu(bankno); NL(); + CAN->FMR = CAN_FMR_FINIT; + CAN->FA1R &= ~(1<FMR &=~ CAN_FMR_FINIT; + return; + } + uint8_t fifono = 0; + if(*str == '1') fifono = 1; + else if(*str != '0'){ + SEND("FIFO# is 0 or 1\n"); + return; + } + str = omit_spaces(str + 1); + char c = *str; + uint8_t mode = 0; // ID + if(c == 'M' || c == 'm') mode = 1; + else if(c != 'I' && c != 'i'){ + SEND("mode is 'M/m' for MASK and 'I/i' for IDLIST\n"); + return; + } + str = omit_spaces(str + 1); + uint32_t filters[4]; + uint32_t nfilt; + for(nfilt = 0; nfilt < 4; ++nfilt){ + n = getnum(str, &N); + if(n == str) break; + filters[nfilt] = N; + str = omit_spaces(n); + } + if(nfilt == 0){ + SEND("You should add at least one filter!\n"); + return; + } + if(mode && (nfilt&1)){ + SEND("In MASK mode you should point pairs of ID/MASK\n"); + return; + } + CAN->FMR = CAN_FMR_FINIT; + uint32_t mask = 1<FA1R |= mask; // activate given filter + if(fifono) CAN->FFA1R |= mask; // set FIFO number + else CAN->FFA1R &= ~mask; + if(mode) CAN->FM1R &= ~mask; // MASK + else CAN->FM1R |= mask; // LIST + uint32_t F1 = (0x8f<<16); + uint32_t F2 = (0x8f<<16); + // reset filter registers to wrong value + CAN->sFilterRegister[bankno].FR1 = (0x8f<<16) | 0x8f; + CAN->sFilterRegister[bankno].FR2 = (0x8f<<16) | 0x8f; + switch(nfilt){ + case 4: + F2 = filters[3] << 21; + // fallthrough + case 3: + CAN->sFilterRegister[bankno].FR2 = (F2 & 0xffff0000) | (filters[2] << 5); + // fallthrough + case 2: + F1 = filters[1] << 21; + // fallthrough + case 1: + CAN->sFilterRegister[bankno].FR1 = (F1 & 0xffff0000) | (filters[0] << 5); + } + CAN->FMR &=~ CAN_FMR_FINIT; + SEND("Added filter with "); + printu(nfilt); SEND(" parameters\n"); +} + +static const char *helpmsg = + REPOURL + "'a' - add ID to ignore list (max 10 IDs)\n" + "'b' - reinit CAN with given baudrate or get current\n" + "'c' - get CAN status\n" + "'d' - delete ignore list\n" +#ifdef STM32F072xB + "'D' - activate DFU mode\n" +#endif + "'e' - get CAN errcodes\n" + "'f' - add/delete filter, format: bank# FIFO# mode(M/I) num0 [num1 [num2 [num3]]]\n" + "'F' - send/clear flood message: F ID byte0 ... byteN\n" + "'i' - send incremental flood message (ID == ID for `F`)\n" + "'I' - reinit CAN\n" + "'l' - list all active filters\n" + "'o' - turn LEDs OFF\n" + "'O' - turn LEDs ON\n" + "'p' - print ignore buffer\n" + "'P' - pause/resume in packets displaying\n" + "'R' - software reset\n" + "'s/S' - send data over CAN: s ID byte0 .. byteN\n" + "'t' - change flood period (>=0ms)\n" + "'T' - get time from start (ms)\n" +; + +TRUE_INLINE void getcanstat(){ + SEND("CAN_MSR="); + printuhex(CAN->MSR); + SEND("\nCAN_TSR="); + printuhex(CAN->TSR); + SEND("\nCAN_RF0R="); + printuhex(CAN->RF0R); + SEND("\nCAN_RF1R="); + printuhex(CAN->RF1R); + NL(); +} + +/** + * @brief cmd_parser - command parsing + * @param txt - buffer with commands & data + * @param isUSB - == 1 if data got from USB + */ +static void cmd_parser(char *txt){ + char _1st = txt[0]; + ++txt; + /* + * parse long commands here + */ + switch(_1st){ + case 'a': + addIGN(txt); + return; + break; + case 'b': + CANini(txt); + return; + break; + case 'f': + add_filter(txt); + return; + break; + case 'F': + set_flood(parseCANmsg(txt), 0); + return; + break; + case 's': + case 'S': + USB_sendstrCANcommand(txt); + return; + break; + case 't': + setfloodt(txt); + return; + break; + } + if(*txt) _1st = '?'; // help for wrong message length + switch(_1st){ + case 'c': + getcanstat(); + break; + case 'd': + IgnSz = 0; + break; + case 'e': + printCANerr(); + break; +#ifdef STM32F072xB + case 'D': + USB_sendstr("Go into DFU mode\n"); + USB_sendall(); + Jump2Boot(); + break; +#endif + case 'i': + set_flood(NULL, 1); + SEND("Incremental flooding is ON ('F' to off)\n"); + break; + case 'I': + SEND("CANspeed="); + printu(CAN_reinit(0)); + NL(); + break; + case 'l': + list_filters(); + break; + case 'o': + ledsON = 0; + LED_off(LED0); + LED_off(LED1); + SEND("LEDS=0\n"); + break; + case 'O': + ledsON = 1; + SEND("LEDS=1\n"); + break; + case 'p': + print_ign_buf(); + break; + case 'P': + ShowMsgs = !ShowMsgs; + if(ShowMsgs) SEND("Resume\n"); + else SEND("Pause\n"); + break; + case 'R': + SEND("Soft reset\n"); + USB_sendall(ICAN); // wait until everything will gone + NVIC_SystemReset(); + break; + case 'T': + SEND("Time (ms): "); + printu(Tms); + NL(); + break; + default: // help + SEND(helpmsg); + break; + } +} + +// check Ignore_IDs & return 1 if ID isn't in list +static uint8_t isgood(uint16_t ID){ + for(int i = 0; i < IgnSz; ++i) + if(Ignore_IDs[i] == ID) return 0; + return 1; +} + +void CANUSB_process(){ + char inbuff[MAXSTRLEN]; + CAN_message *can_mesg; + uint32_t lastT = 0; + can_proc(); + if(CAN_get_status() == CAN_FIFO_OVERRUN){ + SEND("CAN bus fifo overrun occured!\n"); + } + while((can_mesg = CAN_messagebuf_pop())){ + IWDG->KR = IWDG_REFRESH; + if(can_mesg && isgood(can_mesg->ID)){ + LED_on(LED0); + lastT = Tms; + if(!lastT) lastT = 1; + if(ShowMsgs){ // new data in buff + IWDG->KR = IWDG_REFRESH; + uint8_t len = can_mesg->length; + printu(Tms); + SEND(" #"); + printuhex(can_mesg->ID); + for(uint8_t ctr = 0; ctr < len; ++ctr){ + PUTCHAR(' '); + printuhex(can_mesg->data[ctr]); + } + NL(); + } + } + } + if(lastT && (Tms - lastT > 199)){ + LED_off(LED0); + lastT = 0; + } + int l = RECV(inbuff, MAXSTRLEN); + if(l < 0) SEND("ERROR: USB buffer overflow or string was too long\n"); + else if(l) cmd_parser(inbuff); +} diff --git a/F0:F030,F042,F072/usbcan_gpio/canproto.h b/F0:F030,F042,F072/usbcan_gpio/canproto.h new file mode 100644 index 0000000..3dacc19 --- /dev/null +++ b/F0:F030,F042,F072/usbcan_gpio/canproto.h @@ -0,0 +1,22 @@ +/* + * This file is part of the usbcangpio project. + * Copyright 2022 Edward V. Emelianov . + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#pragma once + +void CANUSB_process(); + diff --git a/F0:F030,F042,F072/usbcan_gpio/flash.c b/F0:F030,F042,F072/usbcan_gpio/flash.c new file mode 100644 index 0000000..27c871e --- /dev/null +++ b/F0:F030,F042,F072/usbcan_gpio/flash.c @@ -0,0 +1,181 @@ +/* + * flash.c + * + * Copyright 2017 Edward V. Emelianov + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, + * MA 02110-1301, USA. + * + */ + +#include +#include // memcpy +#include "can.h" +#include "flash.h" +//#include "strfunc.h" + +extern const uint32_t __varsstart, _BLOCKSIZE; + +static const uint32_t blocksize = (uint32_t)&_BLOCKSIZE; + +// max amount of Config records stored (will be recalculate in flashstorage_init() +static uint32_t maxCnum = 1024 / sizeof(user_conf); // can't use blocksize here + +static int erase_flash(const void*, const void*); +static int write2flash(const void*, const void*, uint32_t); +// don't write `static` here, or get error: +// 'memcpy' forming offset 8 is out of the bounds [0, 4] of object '__varsstart' with type 'uint32_t' +const user_conf *Flash_Data = (const user_conf *)(&__varsstart); + +user_conf the_conf = { + .userconf_sz = sizeof(user_conf), + .CANspeed = 100, + .iInterface = { + [ICAN] = u"USB-CAN", + [IGPIO] = u"USB-GPIO", + }, + .iIlengths = {14, 16}, +}; + +int currentconfidx = -1; // index of current configuration + +/** + * @brief binarySearch - binary search in flash for last non-empty cell + * any struct searched should have its sizeof() @ the first field!!! + * @param l - left index + * @param r - right index (should be @1 less than last index!) + * @param start - starting address + * @param stor_size - size of structure to search + * @return index of non-empty cell or -1 + */ +static int binarySearch(int r, const uint8_t *start, int stor_size){ + int l = 0; + while(r >= l){ + int mid = l + (r - l) / 2; + const uint8_t *s = start + mid * stor_size; + if(*((const uint16_t*)s) == stor_size){ + if(*((const uint16_t*)(s + stor_size)) == 0xffff){ // next is free + return mid; + }else{ // element is to the right + l = mid + 1; + } + }else{ // element is to the left + r = mid - 1; + } + } + return -1; // not found +} + +/** + * @brief flashstorage_init - initialization of user conf storage + * run in once @ start + */ +void flashstorage_init(){ + if(FLASH_SIZE > 0 && FLASH_SIZE < 20000){ + uint32_t flsz = FLASH_SIZE * blocksize; // size in bytes + flsz -= (uint32_t)(&__varsstart) - FLASH_BASE; + maxCnum = flsz / sizeof(user_conf); + } + // -1 if there's no data at all & flash is clear; maxnum-1 if flash is full + currentconfidx = binarySearch((int)maxCnum-2, (const uint8_t*)Flash_Data, sizeof(user_conf)); + if(currentconfidx > -1){ + memcpy(&the_conf, &Flash_Data[currentconfidx], sizeof(user_conf)); + } +} + +// store new configuration +// @return 0 if all OK +int store_userconf(){ + // maxnum - 3 means that there always should be at least one empty record after last data + // for binarySearch() checking that there's nothing more after it! + if(currentconfidx > (int)maxCnum - 3){ // there's no more place + currentconfidx = 0; + if(erase_flash(Flash_Data, NULL)) return 1; + }else ++currentconfidx; // take next data position (0 - within first run after firmware flashing) + return write2flash((const void*)&Flash_Data[currentconfidx], &the_conf, sizeof(the_conf)); +} + +static int write2flash(const void *start, const void *wrdata, uint32_t stor_size){ + int ret = 0; + if (FLASH->CR & FLASH_CR_LOCK){ // unloch flash + FLASH->KEYR = FLASH_KEY1; + FLASH->KEYR = FLASH_KEY2; + } + while (FLASH->SR & FLASH_SR_BSY) IWDG->KR = IWDG_REFRESH; + FLASH->SR = FLASH_SR_EOP | FLASH_SR_PGERR | FLASH_SR_WRPRTERR; // clear all flags + FLASH->CR |= FLASH_CR_PG; + const uint16_t *data = (const uint16_t*) wrdata; + volatile uint16_t *address = (volatile uint16_t*) start; + uint32_t i, count = (stor_size + 1) / 2; + for (i = 0; i < count; ++i){ + IWDG->KR = IWDG_REFRESH; + *(volatile uint16_t*)(address + i) = data[i]; + while (FLASH->SR & FLASH_SR_BSY) IWDG->KR = IWDG_REFRESH; + if(FLASH->SR & FLASH_SR_PGERR){ + //SEND("Prog err\n"); + ret = 1; // program error - meet not 0xffff + break; + } + FLASH->SR = FLASH_SR_EOP | FLASH_SR_PGERR | FLASH_SR_WRPRTERR; + } + FLASH->CR &= ~(FLASH_CR_PG); + return ret; +} + +/** + * @brief erase_flash - erase N pages of flash memory + * @param start - first address + * @param end - last address (or NULL if need to erase all flash remaining) + * @return 0 if succeed + */ +static int erase_flash(const void *start, const void *end){ + int ret = 0; + uint32_t nblocks = 1, flsz = 0; + if(!end){ // erase all remaining + if(FLASH_SIZE > 0 && FLASH_SIZE < 20000){ + flsz = FLASH_SIZE * blocksize; // size in bytes + flsz -= (uint32_t)start - FLASH_BASE; + } + }else{ // erase a part + flsz = (uint32_t)end - (uint32_t)start; + } + nblocks = flsz / blocksize; + if(nblocks == 0 || nblocks >= FLASH_SIZE) return 1; + if((FLASH->CR & FLASH_CR_LOCK) != 0){ + FLASH->KEYR = FLASH_KEY1; + FLASH->KEYR = FLASH_KEY2; + } + while(FLASH->SR & FLASH_SR_BSY) IWDG->KR = IWDG_REFRESH; + FLASH->SR = FLASH_SR_EOP | FLASH_SR_PGERR | FLASH_SR_WRPRTERR; + FLASH->CR |= FLASH_CR_PER; + for(uint32_t i = 0; i < nblocks; ++i){ + //SEND("Erase block #"); printu(i); newline(); + FLASH->AR = (uint32_t)Flash_Data + i * blocksize; + FLASH->CR |= FLASH_CR_STRT; + while(FLASH->SR & FLASH_SR_BSY) IWDG->KR = IWDG_REFRESH; + FLASH->SR = FLASH_SR_EOP; + if(FLASH->SR & FLASH_SR_WRPRTERR){ + ret = 1; + FLASH->SR = FLASH_SR_WRPRTERR; + break; + } + } + FLASH->CR &= ~FLASH_CR_PER; + return ret; +} + +int erase_storage(){ + return erase_flash(Flash_Data, NULL); +} diff --git a/F0:F030,F042,F072/usbcan_gpio/flash.h b/F0:F030,F042,F072/usbcan_gpio/flash.h new file mode 100644 index 0000000..843f4e7 --- /dev/null +++ b/F0:F030,F042,F072/usbcan_gpio/flash.h @@ -0,0 +1,56 @@ +/* + * flash.h + * + * Copyright 2017 Edward V. Emelianov + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, + * MA 02110-1301, USA. + * + */ + +#pragma once + +#include +#include "usb_descr.h" + +// register with flash size (in blocks) +#ifndef FLASH_SIZE_REG +#define FLASH_SIZE_REG ((uint32_t)0x1FFFF7CC) +#endif + +#define FLASH_SIZE *((uint16_t*)FLASH_SIZE_REG) + +// maximal size (in letters, ASCII, no ending \0) of iInterface for settings +#define MAX_IINTERFACE_SZ (16) + +/* + * struct to save user configurations + */ +typedef struct __attribute__((packed, aligned(4))){ + uint16_t userconf_sz; // "magick number" + uint16_t CANspeed; // default CAN speed (in kBaud!!!) + uint16_t iInterface[InterfacesAmount][MAX_IINTERFACE_SZ]; // we store Interface name here in UTF! + uint8_t iIlengths[InterfacesAmount]; // length in BYTES (symbols amount x2)! +} user_conf; + +extern user_conf the_conf; // global user config (read from FLASH to RAM) +extern int currentconfidx; + +// data from ld-file: start address of storage + +void flashstorage_init(); +int store_userconf(); +void dump_userconf(); +int erase_storage(); diff --git a/F0:F030,F042,F072/usbcan_gpio/gpioproto.c b/F0:F030,F042,F072/usbcan_gpio/gpioproto.c new file mode 100644 index 0000000..afcbda2 --- /dev/null +++ b/F0:F030,F042,F072/usbcan_gpio/gpioproto.c @@ -0,0 +1,146 @@ +/* + * This file is part of the usbcangpio project. + * Copyright 2026 Edward V. Emelianov . + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include + +#include "can.h" +#include "flash.h" +#include "gpioproto.h" + +#define USBIF IGPIO +#include "strfunc.h" + +extern volatile uint32_t Tms; +static const char *const sOKn = "OK\n", *const sERRn = "ERR\n"; + +const char *helpstring = + REPOURL + "d - dump flash\n" + "ix - rename interface number x (0 - CAN, 1 - GPIO)\n" + "Cx - starting CAN bus speed (kBaud)\n" + "Dx - send text x to CAN USB interface\n" + "E - erase storage\n" + "F - reinit configurations from flash\n" + "R - soft reset\n" + "S - store new parameters into flash\n" + "T - print current Tms\n" +; + +static void dumpflash(){ + SEND("userconf_sz="); SEND(u2str(the_conf.userconf_sz)); + SEND("\ncurrentconfidx="); SENDn(i2str(currentconfidx)); + for(int i = 0; i < InterfacesAmount; ++i){ + SEND("interface"); PUTCHAR('0' + i); + PUTCHAR('='); + int l = the_conf.iIlengths[i] / 2; + char *ptr = (char*) the_conf.iInterface[i]; + for(int j = 0; j < l; ++j){ + PUTCHAR(*ptr); + ptr += 2; + } + NL(); + } + SEND("canspeed="); SENDn(u2str(the_conf.CANspeed)); +} + +// set new interface name +static const char* setiface(char *str){ + if(!str || !*str) goto err; + uint32_t N; + const char *nxt = getnum(str, &N); + if(!nxt || nxt == str || N >= InterfacesAmount) goto err; + //nxt = strchr(nxt, '='); + //if(!nxt || !*(++nxt)) goto err; + nxt = omit_spaces(nxt); + if(!nxt || !*nxt) goto err; + int l = strlen(nxt); + if(l > MAX_IINTERFACE_SZ) goto err; + the_conf.iIlengths[N] = (uint8_t) l * 2; + char *ptr = (char*)the_conf.iInterface[N]; + for(int i = 0; i < l; ++i){ + char c = *nxt++; + *ptr++ = (c > ' ') ? c : '_'; + *ptr++ = 0; + } + return sOKn; +err: + return sERRn; +} + +static const char* setCANspeed(char *buf){ + uint32_t N; + if(buf == getnum(buf, &N)) return sERRn; + if(N < CAN_MIN_SPEED || N > CAN_MAX_SPEED) return sERRn; + the_conf.CANspeed = N; + return sOKn; +} + +static const char *cmd_parser(char *buf){ + if(!buf || !*buf) return NULL; + if(strlen(buf) > 1){ + // "long" commands + char c = *buf++; + switch(c){ + case 'C': + return setCANspeed(buf); + case 'D': + if(USB_sendstr(ICAN, buf)) return sOKn; + else return sERRn; + case 'i': + return setiface(buf); + default: + return buf-1; // echo wrong data + } + } + // "short" commands + switch(*buf){ + case 'd': + dumpflash(); + break; + case 'E': + if(erase_storage()) return sERRn; + return sOKn; + case 'F': + flashstorage_init(); + return sOKn; + case 'R': + NVIC_SystemReset(); + return NULL; + case 'S': + if(store_userconf()) return sERRn; + return sOKn; + case 'T': + SEND("T="); + SENDn(u2str(Tms)); + break; + default: // help + SEND(helpstring); + break; + } + return NULL; +} + +void GPIO_process(){ + char inbuff[MAXSTRLEN]; + int l = RECV(inbuff, MAXSTRLEN); + if(l < 0) SEND("ERROR: USB buffer overflow or string was too long\n"); + else if(l){ + const char *ans = cmd_parser(inbuff); + if(ans) SEND(ans); + } +} diff --git a/F0:F030,F042,F072/usbcan_gpio/gpioproto.h b/F0:F030,F042,F072/usbcan_gpio/gpioproto.h new file mode 100644 index 0000000..94bb96a --- /dev/null +++ b/F0:F030,F042,F072/usbcan_gpio/gpioproto.h @@ -0,0 +1,21 @@ +/* + * This file is part of the usbcangpio project. + * Copyright 2026 Edward V. Emelianov . + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#pragma once + +void GPIO_process(); diff --git a/F0:F030,F042,F072/usbcan_gpio/hardware.c b/F0:F030,F042,F072/usbcan_gpio/hardware.c new file mode 100644 index 0000000..74834b7 --- /dev/null +++ b/F0:F030,F042,F072/usbcan_gpio/hardware.c @@ -0,0 +1,85 @@ +/* + * This file is part of the usbcangpio project. + * Copyright 2022 Edward V. Emelianov . + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include "hardware.h" + +uint8_t ledsON = 0; + +void gpio_setup(void){ + RCC->AHBENR |= RCC_AHBENR_GPIOAEN | RCC_AHBENR_GPIOBEN; + // Set LEDS (PB15/PA8) as output + pin_set(LED0_port, LED0_pin); // clear LEDs + pin_set(LED1_port, LED1_pin); + GPIOB->MODER = (GPIOB->MODER & ~(GPIO_MODER_MODER15)) | + GPIO_MODER_MODER15_O; + GPIOA->MODER = (GPIOA->MODER & ~(GPIO_MODER_MODER8)) | + GPIO_MODER_MODER8_O; +} + +void iwdg_setup(){ + uint32_t tmout = 16000000; + /* Enable the peripheral clock RTC */ + /* (1) Enable the LSI (40kHz) */ + /* (2) Wait while it is not ready */ + RCC->CSR |= RCC_CSR_LSION; /* (1) */ + while((RCC->CSR & RCC_CSR_LSIRDY) != RCC_CSR_LSIRDY){if(--tmout == 0) break;} /* (2) */ + /* Configure IWDG */ + /* (1) Activate IWDG (not needed if done in option bytes) */ + /* (2) Enable write access to IWDG registers */ + /* (3) Set prescaler by 64 (1.6ms for each tick) */ + /* (4) Set reload value to have a rollover each 2s */ + /* (5) Check if flags are reset */ + /* (6) Refresh counter */ + IWDG->KR = IWDG_START; /* (1) */ + IWDG->KR = IWDG_WRITE_ACCESS; /* (2) */ + IWDG->PR = IWDG_PR_PR_1; /* (3) */ + IWDG->RLR = 1250; /* (4) */ + tmout = 16000000; + while(IWDG->SR){if(--tmout == 0) break;} /* (5) */ + IWDG->KR = IWDG_REFRESH; /* (6) */ +} + +#ifdef STM32F072xB +void Jump2Boot(){ + void (*SysMemBootJump)(void); + volatile uint32_t addr = 0x1FFFC800; + // reset systick + SysTick->CTRL = 0; + // reset clocks + + RCC->APB1RSTR = RCC_APB1RSTR_CECRST | RCC_APB1RSTR_DACRST | RCC_APB1RSTR_PWRRST | RCC_APB1RSTR_CRSRST | + RCC_APB1RSTR_CANRST | RCC_APB1RSTR_USBRST | RCC_APB1RSTR_I2C2RST | RCC_APB1RSTR_I2C1RST | + RCC_APB1RSTR_USART4RST | RCC_APB1RSTR_USART3RST | RCC_APB1RSTR_USART2RST | RCC_APB1RSTR_SPI2RST | + RCC_APB1RSTR_WWDGRST | RCC_APB1RSTR_TIM14RST | + RCC_APB1RSTR_TIM7RST | RCC_APB1RSTR_TIM6RST | + RCC_APB1RSTR_TIM3RST | RCC_APB1RSTR_TIM2RST; + RCC->APB2RSTR = RCC_APB2RSTR_DBGMCURST | RCC_APB2RSTR_TIM17RST | RCC_APB2RSTR_TIM16RST | + RCC_APB2RSTR_TIM15RST | + RCC_APB2RSTR_USART1RST | RCC_APB2RSTR_SPI1RST | RCC_APB2RSTR_TIM1RST | RCC_APB2RSTR_ADCRST | RCC_APB2RSTR_SYSCFGRST; + RCC->AHBRSTR = 0; + RCC->APB1RSTR = 0; + RCC->APB2RSTR = 0; + // remap memory to 0 (only for STM32F0) + SYSCFG->CFGR1 = 0x01; __DSB(); __ISB(); + SysMemBootJump = (void (*)(void)) (*((uint32_t *)(addr + 4))); + // set main stack pointer + __set_MSP(*((uint32_t *)addr)); + // jump to bootloader + SysMemBootJump(); +} +#endif diff --git a/F0:F030,F042,F072/usbcan_gpio/hardware.h b/F0:F030,F042,F072/usbcan_gpio/hardware.h new file mode 100644 index 0000000..d93dccc --- /dev/null +++ b/F0:F030,F042,F072/usbcan_gpio/hardware.h @@ -0,0 +1,51 @@ +/* + * This file is part of the usbcangpio project. + * Copyright 2022 Edward V. Emelianov . + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#pragma once + +#include + +#define CONCAT(a,b) a ## b +#define STR_HELPER(s) #s +#define STR(s) STR_HELPER(s) + +#define FORMUSART(X) CONCAT(USART, X) +#define USARTX FORMUSART(USARTNUM) + +// LEDS: 0 - PB15, 1 - PA8 +// LED0 +#define LED0_port GPIOB +#define LED0_pin (1<<15) +// LED1 +#define LED1_port GPIOA +#define LED1_pin (1<<8) + +#define LED_blink(x) do{if(ledsON) pin_toggle(x ## _port, x ## _pin);}while(0) +#define LED_on(x) do{if(ledsON) pin_clear(x ## _port, x ## _pin);}while(0) +#define LED_off(x) do{pin_set(x ## _port, x ## _pin);}while(0) + + +extern volatile uint32_t Tms; + +extern uint8_t ledsON; + +void gpio_setup(void); +void iwdg_setup(); +#ifdef STM32F072xB +void Jump2Boot(); +#endif diff --git a/F0:F030,F042,F072/usbcan_gpio/main.c b/F0:F030,F042,F072/usbcan_gpio/main.c new file mode 100644 index 0000000..9c6a9e2 --- /dev/null +++ b/F0:F030,F042,F072/usbcan_gpio/main.c @@ -0,0 +1,50 @@ +/* + * This file is part of the usbcangpio project. + * Copyright 2022 Edward V. Emelianov . + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include "can.h" +#include "flash.h" +#include "gpioproto.h" +#include "hardware.h" +#include "canproto.h" + +volatile uint32_t Tms = 0; + +/* Called when systick fires */ +void sys_tick_handler(void){ + ++Tms; +} + +int main(void){ + sysreset(); + SysTick_Config(6000, 1); + flashstorage_init(); + gpio_setup(); + USB_setup(); + CAN_setup(the_conf.CANspeed); + RCC->CSR |= RCC_CSR_RMVF; // remove reset flags +#ifndef EBUG + iwdg_setup(); +#endif + while (1){ + IWDG->KR = IWDG_REFRESH; // refresh watchdog + CANUSB_process(); + GPIO_process(); + } + return 0; +} + diff --git a/F0:F030,F042,F072/usbcan_gpio/openocd.cfg b/F0:F030,F042,F072/usbcan_gpio/openocd.cfg new file mode 100644 index 0000000..ca88787 --- /dev/null +++ b/F0:F030,F042,F072/usbcan_gpio/openocd.cfg @@ -0,0 +1,4 @@ +set FLASH_SIZE 0x8000 + +source [find interface/stlink-v2-1.cfg] +source [find target/stm32f0x.cfg] diff --git a/F0:F030,F042,F072/usbcan_gpio/ringbuffer.c b/F0:F030,F042,F072/usbcan_gpio/ringbuffer.c new file mode 100644 index 0000000..24c8b61 --- /dev/null +++ b/F0:F030,F042,F072/usbcan_gpio/ringbuffer.c @@ -0,0 +1,185 @@ +/* + * Copyright 2023 Edward V. Emelianov . + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include +#include +#include "ringbuffer.h" + +static int datalen(ringbuffer *b){ + if(b->tail >= b->head) return (b->tail - b->head); + else return (b->length - b->head + b->tail); +} + +// stored data length +int RB_datalen(ringbuffer *b){ + if(!b || b->busy) return -1; + b->busy = 1; + int l = datalen(b); + b->busy = 0; + return l; +} + +static int hasbyte(ringbuffer *b, uint8_t byte){ + if(!b || b->head == b->tail) return -1; // no data in buffer + int startidx = b->head; + if(b->head > b->tail){ // + for(int found = b->head; found < b->length; ++found) + if(b->data[found] == byte) return found; + startidx = 0; + } + for(int found = startidx; found < b->tail; ++found) + if(b->data[found] == byte) return found; + return -1; +} + +/** + * @brief RB_hasbyte - check if buffer has given byte stored + * @param b - buffer + * @param byte - byte to find + * @return index if found, -1 if none or busy + */ +int RB_hasbyte(ringbuffer *b, uint8_t byte){ + if(!b || b->busy) return -1; + b->busy = 1; + int ret = hasbyte(b, byte); + b->busy = 0; + return ret; +} + +// increment head or tail +TRUE_INLINE void incr(ringbuffer *b, volatile int *what, int n){ + *what += n; + if(*what >= b->length) *what -= b->length; +} + +static int read(ringbuffer *b, uint8_t *s, int len){ + int l = datalen(b); + if(!l) return 0; + if(l > len) l = len; + int _1st = b->length - b->head; + if(_1st > l) _1st = l; + if(_1st > len) _1st = len; + memcpy(s, b->data + b->head, _1st); + if(_1st < len && l > _1st){ + memcpy(s+_1st, b->data, l - _1st); + incr(b, &b->head, l); + return l; + } + incr(b, &b->head, _1st); + return _1st; +} + +/** + * @brief RB_read - read data from ringbuffer + * @param b - buffer + * @param s - array to write data + * @param len - max len of `s` + * @return bytes read or -1 if busy + */ +int RB_read(ringbuffer *b, uint8_t *s, int len){ + if(!b || b->busy || !s || len < 1) return -1; + b->busy = 1; + int r = read(b, s, len); + b->busy = 0; + return r; +} + +// length of data from current position to `byte` (including byte) +static int lento(ringbuffer *b, uint8_t byte){ + int idx = hasbyte(b, byte); + if(idx < 0) return 0; + int partlen = idx + 1 - b->head; + // now calculate length of new data portion + if(idx < b->head) partlen += b->length; + return partlen; +} + +static int readto(ringbuffer *b, uint8_t byte, uint8_t *s, int len){ + int partlen = lento(b, byte); + if(!partlen) return 0; + if(partlen > len) return -1; + return read(b, s, partlen); +} + +/** + * @brief RB_readto fill array `s` with data until byte `byte` (with it) + * @param b - ringbuffer + * @param byte - check byte + * @param s - buffer to write data or NULL to clear data + * @param len - length of `s` or 0 to clear data + * @return amount of bytes written (negative, if lenbusy) return -1; + b->busy = 1; + int n = 0; + if(s && len > 0){ + n = readto(b, byte, s, len); + }else{ + incr(b, &b->head, lento(b, byte)); // just throw data out + } + b->busy = 0; + return n; +} + +int RB_datalento(ringbuffer *b, uint8_t byte){ + if(!b || b->busy) return -1; + b->busy = 1; + int n = lento(b, byte); + b->busy = 0; + return n; +} + +// if l < rest of buffer, truncate and return actually written bytes +static int write(ringbuffer *b, const uint8_t *str, int l){ + int r = b->length - 1 - datalen(b); // rest length + if(r < 1) return 0; + if(l > r) l = r; + int _1st = b->length - b->tail; + if(_1st > l) _1st = l; + memcpy(b->data + b->tail, str, _1st); + if(_1st < l){ // add another piece from start + memcpy(b->data, str+_1st, l-_1st); + } + incr(b, &b->tail, l); + return l; +} + +/** + * @brief RB_write - write some data to ringbuffer + * @param b - buffer + * @param str - data + * @param l - length + * @return amount of bytes written or -1 if busy + */ +int RB_write(ringbuffer *b, const uint8_t *str, int l){ + if(!b || b->busy || !str || l < 1) return -1; + b->busy = 1; + int w = write(b, str, l); + b->busy = 0; + return w; +} + +// just delete all information in buffer `b` +int RB_clearbuf(ringbuffer *b){ + if(!b || b->busy) return -1; + b->busy = 1; + b->head = 0; + b->tail = 0; + b->busy = 0; + return 1; +} diff --git a/F0:F030,F042,F072/usbcan_gpio/ringbuffer.h b/F0:F030,F042,F072/usbcan_gpio/ringbuffer.h new file mode 100644 index 0000000..f9e1e64 --- /dev/null +++ b/F0:F030,F042,F072/usbcan_gpio/ringbuffer.h @@ -0,0 +1,36 @@ +/* + * Copyright 2023 Edward V. Emelianov . + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#pragma once + +#include + +typedef struct{ + uint8_t *data; // data buffer + const int length; // its length + int head; // head index + int tail; // tail index + volatile int busy; // == TRUE if buffer is busy now +} ringbuffer; + +int RB_read(ringbuffer *b, uint8_t *s, int len); +int RB_readto(ringbuffer *b, uint8_t byte, uint8_t *s, int len); +int RB_hasbyte(ringbuffer *b, uint8_t byte); +int RB_write(ringbuffer *b, const uint8_t *str, int l); +int RB_datalen(ringbuffer *b); +int RB_datalento(ringbuffer *b, uint8_t byte); +int RB_clearbuf(ringbuffer *b); diff --git a/F0:F030,F042,F072/usbcan_gpio/strfunc.c b/F0:F030,F042,F072/usbcan_gpio/strfunc.c new file mode 100644 index 0000000..279eaf4 --- /dev/null +++ b/F0:F030,F042,F072/usbcan_gpio/strfunc.c @@ -0,0 +1,264 @@ +/* + * Copyright 2026 Edward V. Emelianov . + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include + +/** + * @brief hexdump - dump hex array by 16 bytes in string + * @param sendfun - function to send data + * @param arr - array to dump + * @param len - length of `arr` + */ +void hexdump(int (*sendfun)(const char *s), uint8_t *arr, uint16_t len){ + char buf[52], *bptr = buf; + for(uint16_t l = 0; l < len; ++l, ++arr){ + for(int16_t j = 1; j > -1; --j){ + register uint8_t half = (*arr >> (4*j)) & 0x0f; + if(half < 10) *bptr++ = half + '0'; + else *bptr++ = half - 10 + 'a'; + } + if(l % 16 == 15){ + *bptr++ = '\n'; + *bptr = 0; + sendfun(buf); + bptr = buf; + }else *bptr++ = ' '; + } + if(bptr != buf){ + *bptr++ = '\n'; + *bptr = 0; + sendfun(buf); + } +} + +/** + * @brief _2str - convert value into string buffer + * @param val - |value| + * @param minus - ==0 if value > 0 + * @return buffer with number + */ +static char *_2str(uint32_t val, uint8_t minus){ + static char strbuf[12]; + char *bufptr = &strbuf[11]; + *bufptr = 0; + if(!val){ + *(--bufptr) = '0'; + }else{ + while(val){ + uint32_t x = val / 10; + *(--bufptr) = (val - 10*x) + '0'; + val = x; + } + } + if(minus) *(--bufptr) = '-'; + return bufptr; +} + +// return string with number `val` +char *u2str(uint32_t val){ + return _2str(val, 0); +} +char *i2str(int32_t i){ + uint8_t minus = 0; + uint32_t val; + if(i < 0){ + minus = 1; + val = -i; + }else val = i; + return _2str(val, minus); +} + +/** + * @brief uhex2str - print 32bit unsigned int as hex + * @param val - value + * @return string with number + */ +char *uhex2str(uint32_t val){ + static char buf[12] = "0x"; + int npos = 2; + uint8_t *ptr = (uint8_t*)&val + 3; + int8_t i, j, z=1; + for(i = 0; i < 4; ++i, --ptr){ + if(*ptr == 0){ // omit leading zeros + if(i == 3) z = 0; + if(z) continue; + } + else z = 0; + for(j = 1; j > -1; --j){ + uint8_t half = (*ptr >> (4*j)) & 0x0f; + if(half < 10) buf[npos++] = half + '0'; + else buf[npos++] = half - 10 + 'a'; + } + } + buf[npos] = 0; + return buf; +} + +/** + * @brief omit_spaces - eliminate leading spaces and other trash in string + * @param buf - string + * @return - pointer to first character in `buf` > ' ' + */ +const char *omit_spaces(const char *buf){ + while(*buf){ + if(*buf > ' ') break; + ++buf; + } + return buf; +} + +/** + * @brief getdec - read decimal number & return pointer to next non-number symbol + * @param buf - string + * @param N - number read + * @return Next non-number symbol. In case of overflow return `buf` and N==0xffffffff + */ +static const char *getdec(const char *buf, uint32_t *N){ + char *start = (char*)buf; + uint32_t num = 0; + while(*buf){ + char c = *buf; + if(c < '0' || c > '9'){ + break; + } + if(num > 429496729 || (num == 429496729 && c > '5')){ // overflow + *N = 0xffffff; + return start; + } + num *= 10; + num += c - '0'; + ++buf; + } + *N = num; + return buf; +} +// read hexadecimal number (without 0x prefix!) +static const char *gethex(const char *buf, uint32_t *N){ + const char *start = buf; + uint32_t num = 0; + while(*buf){ + char c = *buf; + uint8_t M = 0; + if(c >= '0' && c <= '9'){ + M = '0'; + }else if(c >= 'A' && c <= 'F'){ + M = 'A' - 10; + }else if(c >= 'a' && c <= 'f'){ + M = 'a' - 10; + } + if(M){ + if(num & 0xf0000000){ // overflow + *N = 0xffffff; + return start; + } + num <<= 4; + num += c - M; + }else{ + break; + } + ++buf; + } + *N = num; + return buf; +} +// read octal number (without 0 prefix!) +static const char *getoct(const char *buf, uint32_t *N){ + const char *start = (char*)buf; + uint32_t num = 0; + while(*buf){ + char c = *buf; + if(c < '0' || c > '7'){ + break; + } + if(num & 0xe0000000){ // overflow + *N = 0xffffff; + return start; + } + num <<= 3; + num += c - '0'; + ++buf; + } + *N = num; + return buf; +} +// read binary number (without b prefix!) +static const char *getbin(const char *buf, uint32_t *N){ + const char *start = (char*)buf; + uint32_t num = 0; + while(*buf){ + char c = *buf; + if(c < '0' || c > '1'){ + break; + } + if(num & 0x80000000){ // overflow + *N = 0xffffff; + return start; + } + num <<= 1; + if(c == '1') num |= 1; + ++buf; + } + *N = num; + return buf; +} + +/** + * @brief getnum - read uint32_t from string (dec, hex or bin: 127, 0x7f, 0b1111111) + * @param buf - buffer with number and so on + * @param N - the number read + * @return pointer to first non-number symbol in buf + * (if it is == buf, there's no number or if *N==0xffffffff there was overflow) + */ +const char *getnum(const char *txt, uint32_t *N){ + const char *nxt = NULL; + const char *s = omit_spaces(txt); + if(*s == '0'){ // hex, oct or 0 + if(s[1] == 'x' || s[1] == 'X'){ // hex + nxt = gethex(s+2, N); + if(nxt == s+2) nxt = (char*)txt; + }else if(s[1] > '0'-1 && s[1] < '8'){ // oct + nxt = getoct(s+1, N); + if(nxt == s+1) nxt = (char*)txt; + }else{ // 0 + nxt = s+1; + *N = 0; + } + }else if(*s == 'b' || *s == 'B'){ + nxt = getbin(s+1, N); + if(nxt == s+1) nxt = (char*)txt; + }else{ + nxt = getdec(s, N); + if(nxt == s) nxt = (char*)txt; + } + return nxt; +} + +// get signed integer +const char *getint(const char *txt, int32_t *I){ + const char *s = omit_spaces(txt); + int32_t sign = 1; + uint32_t U; + if(*s == '-'){ + sign = -1; + ++s; + } + const char *nxt = getnum(s, &U); + if(nxt == s) return txt; + if(U & 0x80000000) return txt; // overfull + *I = sign * (int32_t)U; + return nxt; +} diff --git a/F0:F030,F042,F072/usbcan_gpio/strfunc.h b/F0:F030,F042,F072/usbcan_gpio/strfunc.h new file mode 100644 index 0000000..194d0db --- /dev/null +++ b/F0:F030,F042,F072/usbcan_gpio/strfunc.h @@ -0,0 +1,52 @@ +/* + * Copyright 2026 Edward V. Emelianov . + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#pragma once + +#ifndef USBIF +#error "Define USBIF to used interface before including this!" +#endif + +#include +#include +#include "usb_dev.h" +#include "usb_descr.h" +#include "version.inc" + +// DEBUG/RELEASE build +#ifdef EBUG +#define RLSDBG "debug" +#else +#define RLSDBG "release" +#endif + +#define REPOURL "https://github.com/eddyem/stm32samples/tree/master/F0:F030,F042,F072/usbcan_gpio " RLSDBG " build #" BUILD_NUMBER "@" BUILD_DATE "\n" + +// max string len to '\n' (including '\0') +#define MAXSTRLEN 128 + +void hexdump(int (*sendfun)(const char *s), uint8_t *arr, uint16_t len); +const char *u2str(uint32_t val); +const char *i2str(int32_t i); +const char *uhex2str(uint32_t val); +char *getnum(const char *txt, uint32_t *N); +char *omit_spaces(const char *buf); +char *getint(const char *txt, int32_t *I); + +#define printu(u) USB_sendstr(USBIF, u2str(u)) +#define printuhex(u) USB_sendstr(USBIF, uhex2str(u)) + diff --git a/F0:F030,F042,F072/usbcan_gpio/usb_descr.c b/F0:F030,F042,F072/usbcan_gpio/usb_descr.c new file mode 100644 index 0000000..8a6919c --- /dev/null +++ b/F0:F030,F042,F072/usbcan_gpio/usb_descr.c @@ -0,0 +1,248 @@ +/* + * Copyright 2024 Edward V. Emelianov . + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include // memcpy + +#include "flash.h" // MAX_IINTERFACE_SZ +#include "usb_descr.h" + +// low/high for uint16_t +#define L16(x) (x & 0xff) +#define H16(x) (x >> 8) + +static const uint8_t USB_DeviceDescriptor[] = { + USB_DT_DEVICE_SIZE, // bLength + USB_DT_DEVICE, // bDescriptorType + L16(bcdUSB), // bcdUSB_L + H16(bcdUSB), // bcdUSB_H + USB_CLASS_MISC, // bDeviceClass + bDeviceSubClass, // bDeviceSubClass + bDeviceProtocol, // bDeviceProtocol + USB_EP0BUFSZ, // bMaxPacketSize + L16(idVendor), // idVendor_L + H16(idVendor), // idVendor_H + L16(idProduct), // idProduct_L + H16(idProduct), // idProduct_H + L16(bcdDevice_Ver), // bcdDevice_Ver_L + H16(bcdDevice_Ver), // bcdDevice_Ver_H + iMANUFACTURER_DESCR, // iManufacturer - indexes of string descriptors in array + iPRODUCT_DESCR, // iProduct + iSERIAL_DESCR, // iSerial + bNumConfigurations // bNumConfigurations +}; + +static const uint8_t USB_DeviceQualifierDescriptor[] = { + USB_DT_QUALIFIER_SIZE, //bLength + USB_DT_QUALIFIER, // bDescriptorType + L16(bcdUSB), // bcdUSB_L + H16(bcdUSB), // bcdUSB_H + USB_CLASS_PER_INTERFACE, // bDeviceClass + bDeviceSubClass, // bDeviceSubClass + bDeviceProtocol, // bDeviceProtocol + USB_EP0BUFSZ, // bMaxPacketSize0 + bNumConfigurations, // bNumConfigurations + 0 // Reserved +}; + +#define wTotalLength (USB_DT_CONFIG_SIZE + (bTotNumEndpoints * 66)) + +/* + * _1stI - number of first interface + * IDidx - 0 or index of string descriptor for given interface + * EPx - number of virtual interrupt EP + * EP - number of real EP in/out + */ +#define USB_IAD(_1stI, IDidx, EPx, EP) \ +USB_DT_IAD_SIZE, /* bLength: IAD size */ \ + USB_DT_IAD, /* bDescriptorType: IAD */ \ + _1stI, /* bFirstInterface */ \ + 2, /* bInterfaceCount */ \ + 2, /* bFunctionClass: CDC */ \ + 2, /* bFunctionSubClass */ \ + 0, /* bFunctionProtocol */ \ + 0, /* iFunction */ \ + /* Interface Descriptor */ \ + USB_DT_INTERFACE_SIZE, /* bLength: Interface Descriptor size */ \ + USB_DT_INTERFACE, /* bDescriptorType: Interface */ \ + _1stI, /* bInterfaceNumber: Number of Interface */ \ + 0, /* bAlternateSetting: Alternate setting */ \ + 1, /* bNumEndpoints: one for this */ \ + USB_CLASS_COMM, /* bInterfaceClass */ \ + 2, /* bInterfaceSubClass: ACM */ \ + 0, /* bInterfaceProtocol */ \ + IDidx, /* iInterface */ \ + /* CDC descriptor */ \ + USB_DT_CS_INTERFACE_SIZE, /* bLength */ \ + USB_DT_CS_INTERFACE, /* bDescriptorType: CS_INTERFACE */ \ + 0, /* bDescriptorSubtype: Header Func Desc */ \ + 0x10, /* bcdCDC: spec release number */ \ + 1, /* bDataInterface */ \ + USB_DT_CS_INTERFACE_SIZE, /* bLength */ \ + USB_DT_CS_INTERFACE, /* bDescriptorType: CS_INTERFACE */ \ + 1, /* bDescriptorSubtype: Call Management Func Desc */ \ + 0, /* bmCapabilities: D0+D1 */ \ + (_1stI+1), /* bDataInterface */ \ + USB_DT_CS_INTERFACE_SIZE-1, /* bLength */ \ + USB_DT_CS_INTERFACE, /* bDescriptorType: CS_INTERFACE */ \ + 2, /* bDescriptorSubtype: Abstract Control Management desc */ \ + 2, /* bmCapabilities */ \ + USB_DT_CS_INTERFACE_SIZE, /* bLength */ \ + USB_DT_CS_INTERFACE, /* bDescriptorType: CS_INTERFACE */ \ + 6, /* bDescriptorSubtype: Union func desc */ \ + _1stI, /* bMasterInterface: Communication class interface */ \ + (_1stI+1), /* bSlaveInterface0: Data Class Interface */ \ + /* Virtual endpoint 1 Descriptor */ \ + USB_DT_ENDPOINT_SIZE, /* bLength: Endpoint Descriptor size */ \ + USB_DT_ENDPOINT, /* bDescriptorType: Endpoint */ \ + (0x80+EPx), /* bEndpointAddress IN8 - non-existant */ \ + USB_BM_ATTR_INTERRUPT, /* bmAttributes: Interrupt */ \ + L16(USB_EP1BUFSZ), /* wMaxPacketSize LO */ \ + H16(USB_EP1BUFSZ), /* wMaxPacketSize HI */ \ + 0x10, /* bInterval: 16ms */ \ + /* DATA endpoint */ \ + USB_DT_INTERFACE_SIZE, /* bLength: Interface Descriptor size */ \ + USB_DT_INTERFACE, /* bDescriptorType: Interface */ \ + (_1stI+1), /* bInterfaceNumber: Number of Interface */ \ + 0, /* bAlternateSetting: Alternate setting */ \ + 2, /* bNumEndpoints: in and out */ \ + USB_CLASS_DATA, /* bInterfaceClass */ \ + 2, /* bInterfaceSubClass: ACM */ \ + 0, /* bInterfaceProtocol */ \ + 0, /* iInterface */ \ + /*Endpoint IN1 Descriptor */ \ + USB_DT_ENDPOINT_SIZE, /* bLength: Endpoint Descriptor size */ \ + USB_DT_ENDPOINT, /* bDescriptorType: Endpoint */ \ + (0x80+EP), /* bEndpointAddress: IN1 */ \ + USB_BM_ATTR_BULK, /* bmAttributes: Bulk */ \ + L16(USB_TXBUFSZ), /* wMaxPacketSize LO */ \ + H16(USB_TXBUFSZ), /* wMaxPacketSize HI */ \ + 0, /* bInterval: ignore for Bulk transfer */ \ + /* Endpoint OUT1 Descriptor */ \ + USB_DT_ENDPOINT_SIZE, /* bLength: Endpoint Descriptor size */ \ + USB_DT_ENDPOINT, /* bDescriptorType: Endpoint */ \ + EP, /* bEndpointAddress: OUT1 */ \ + USB_BM_ATTR_BULK, /* bmAttributes: Bulk */ \ + L16(USB_RXBUFSZ), /* wMaxPacketSize LO */ \ + H16(USB_RXBUFSZ), /* wMaxPacketSize HI */ \ + 0 /* bInterval: ignore for Bulk transfer */ + +static const uint8_t USB_ConfigDescriptor[] = { + // Configuration Descriptor + USB_DT_CONFIG_SIZE, // bLength: Configuration Descriptor size + USB_DT_CONFIG, // bDescriptorType: Configuration + L16(wTotalLength), // wTotalLength.L :no of returned bytes + H16(wTotalLength), // wTotalLength.H + bNumInterfaces, // bNumInterfaces + 1, // bConfigurationValue: Current configuration value + 0, // iConfiguration: Index of string descriptor describing the configuration or 0 + BusPowered, // bmAttributes - Bus powered + 50, // MaxPower in 2mA units + //--IADs------------------------------------------------------------------------- + USB_IAD(0, iINTERFACE_DESCR1, 8, 1), + USB_IAD(2, iINTERFACE_DESCR2, 9, 2), +}; + + +_USB_LANG_ID_(LD, LANG_US); +_USB_STRING_(SD, u"0.0.2"); +_USB_STRING_(MD, u"eddy@sao.ru"); +_USB_STRING_(PD, u"USB-Serial Controller"); + +// iInterface will change on initialisation by config +#define _USB_IIDESCR_(str) {sizeof(str), 0x03, str} +typedef struct{ + uint8_t bLength; + uint8_t bDescriptorType; + uint16_t bString[MAX_IINTERFACE_SZ]; +}iidescr_t; +static iidescr_t iids[InterfacesAmount] = { + _USB_IIDESCR_(u"iface0"), + _USB_IIDESCR_(u"iface1"), +}; + +static const void* const StringDescriptor[iDESCR_AMOUNT] = { + [iLANGUAGE_DESCR] = &LD, + [iMANUFACTURER_DESCR] = &MD, + [iPRODUCT_DESCR] = &PD, + [iSERIAL_DESCR] = &SD, + [iINTERFACE_DESCR1] = &iids[0], + [iINTERFACE_DESCR2] = &iids[1], +}; + +static void wr0(const uint8_t *buf, uint16_t size, uint16_t askedsize){ + if(askedsize < size) size = askedsize; // shortened request + if(size < USB_EP0BUFSZ){ + EP_WriteIRQ(0, buf, size); + return; + } + while(size){ + uint16_t l = size; + if(l > USB_EP0BUFSZ) l = USB_EP0BUFSZ; + EP_WriteIRQ(0, buf, l); + buf += l; + size -= l; + uint8_t needzlp = (l == USB_EP0BUFSZ) ? 1 : 0; + if(size || needzlp){ // send last data buffer + uint16_t epstatus = KEEP_DTOG(USB->EPnR[0]); + // keep DTOGs, clear CTR_RX,TX, set TX VALID, leave stat_Rx + USB->EPnR[0] = (epstatus & ~(USB_EPnR_CTR_RX|USB_EPnR_CTR_TX|USB_EPnR_STAT_RX)) + ^ USB_EPnR_STAT_TX; + uint32_t ctr = 1000000; + while(--ctr && (USB->ISTR & USB_ISTR_CTR) == 0){IWDG->KR = IWDG_REFRESH;}; + if((USB->ISTR & USB_ISTR_CTR) == 0){ + return; + } + if(needzlp) EP_WriteIRQ(0, NULL, 0); + } + } +} + +void get_descriptor(config_pack_t *pack){ + uint8_t descrtype = pack->wValue >> 8, + descridx = pack->wValue & 0xff; + switch(descrtype){ + case DEVICE_DESCRIPTOR: + wr0(USB_DeviceDescriptor, sizeof(USB_DeviceDescriptor), pack->wLength); + break; + case CONFIGURATION_DESCRIPTOR: + wr0(USB_ConfigDescriptor, sizeof(USB_ConfigDescriptor), pack->wLength); + break; + case STRING_DESCRIPTOR: + if(descridx < iDESCR_AMOUNT){ + wr0((const uint8_t *)StringDescriptor[descridx], *((uint8_t*)StringDescriptor[descridx]), pack->wLength); + }else{ + EP_WriteIRQ(0, NULL, 0); + } + break; + case DEVICE_QUALIFIER_DESCRIPTOR: + wr0(USB_DeviceQualifierDescriptor, sizeof(USB_DeviceQualifierDescriptor), pack->wLength); + break; + default: + break; + } +} + +// change values of iInterface by content of global config +void setup_interfaces(){ + for(int i = 0; i < InterfacesAmount; ++i){ + if(the_conf.iIlengths[i]){ + iids[i].bLength = the_conf.iIlengths[i] + 2; // +2 - for bLength and bDescriptorType + memcpy(iids[i].bString, the_conf.iInterface[i], the_conf.iIlengths[i]); + } + iids[i].bDescriptorType = 0x03; + } +} diff --git a/F0:F030,F042,F072/usbcan_gpio/usb_descr.h b/F0:F030,F042,F072/usbcan_gpio/usb_descr.h new file mode 100644 index 0000000..2cb6188 --- /dev/null +++ b/F0:F030,F042,F072/usbcan_gpio/usb_descr.h @@ -0,0 +1,76 @@ +/* + * Copyright 2024 Edward V. Emelianov . + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +#pragma once + +#include + +#include "usb_lib.h" + +// amount of interfaces +#define InterfacesAmount 2 +// index of interface (ep number minus one): IF1..IF7 +#define ICAN 0 +#define IGPIO 1 +// EP number of interface +#define EPNO(i) (i + 1) +// interface number of EPno +#define IFNO(e) (e - 1) + +// amount of interfaces (including virtual) except 0 +#define bNumInterfaces (2*InterfacesAmount) +// amount of endpoints used +#define bTotNumEndpoints (1+InterfacesAmount) + +// definition of parts common for USB_DeviceDescriptor & USB_DeviceQualifierDescriptor +// bcdUSB: 1.10 +#define bcdUSB 0x0110 +// Class - Misc (EF), subclass - common (2), protocol - interface association descr (1) +#define bDeviceSubClass 0x02 +#define bDeviceProtocol 0x01 +#define idVendor 0x0483 +#define idProduct 0x5740 +#define bcdDevice_Ver 0x0200 +#define bNumConfigurations 1 + +// powered +#define BusPowered (1<<7) +#define SelfPowered (1<<6) +#define RemoteWakeup (1<<5) + +// buffer sizes +// Rx buffer should be not more than 64 and multiple of 2 (or 4 for STM32G0), or multiple of 32 +// Tx buffer should be multiple of 2 (or 4 for STM32G0) +// for USB FS EP0 buffers are from 8 to 64 bytes long +#define USB_EP0BUFSZ 64 +#define USB_EP1BUFSZ 10 +// Rx/Tx EPs (not more than 64 bytes for CDC) +#define USB_RXBUFSZ 64 +#define USB_TXBUFSZ 64 + +// string descriptors +enum{ + iLANGUAGE_DESCR, + iMANUFACTURER_DESCR, + iPRODUCT_DESCR, + iSERIAL_DESCR, + iINTERFACE_DESCR1, + iINTERFACE_DESCR2, + iDESCR_AMOUNT +}; + +void get_descriptor(config_pack_t *pack); +void setup_interfaces(); diff --git a/F0:F030,F042,F072/usbcan_gpio/usb_dev.c b/F0:F030,F042,F072/usbcan_gpio/usb_dev.c new file mode 100644 index 0000000..249db9f --- /dev/null +++ b/F0:F030,F042,F072/usbcan_gpio/usb_dev.c @@ -0,0 +1,356 @@ +/* + * Copyright 2024 Edward V. Emelianov . + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include + +#include "ringbuffer.h" +#include "usb_descr.h" +#include "usb_dev.h" + +// Class-Specific Control Requests +#define SEND_ENCAPSULATED_COMMAND 0x00 // unused +#define GET_ENCAPSULATED_RESPONSE 0x01 // unused +#define SET_COMM_FEATURE 0x02 // unused +#define GET_COMM_FEATURE 0x03 // unused +#define CLEAR_COMM_FEATURE 0x04 // unused +#define SET_LINE_CODING 0x20 +#define GET_LINE_CODING 0x21 +#define SET_CONTROL_LINE_STATE 0x22 +#define SEND_BREAK 0x23 + +// control line states +#define CONTROL_DTR 0x01 +#define CONTROL_RTS 0x02 + +// inbuf overflow when receiving +static volatile uint8_t bufovrfl[InterfacesAmount] = {0}; + +extern volatile uint32_t Tms; + +// receive buffer: hold data until chkin() call +static uint8_t volatile rcvbuf[InterfacesAmount][USB_RXBUFSZ] __attribute__((aligned(4))); +static uint8_t volatile rcvbuflen[InterfacesAmount] = {0}; +// line coding +#define DEFL {9600, 0, 0, 8} +static usb_LineCoding lineCoding[InterfacesAmount] = {DEFL,DEFL}; +// CDC configured and ready to use +volatile uint8_t CDCready[InterfacesAmount] = {0}; +// also we need to check timeouts of sending data to detect disconnection as +// stupid CDC have no `break` signal and, of course, as we have more than one +// interface, there's no interrupt on disconnection + +// ring buffers for incoming and outgoing data +static uint8_t obuf[InterfacesAmount][RBOUTSZ], ibuf[InterfacesAmount][RBINSZ]; +#define OBUF(N) {.data = obuf[N], .length = RBOUTSZ, .head = 0, .tail = 0} +static volatile ringbuffer rbout[InterfacesAmount] = {OBUF(0), OBUF(1)}; +#define IBUF(N) {.data = ibuf[N], .length = RBINSZ, .head = 0, .tail = 0} +static volatile ringbuffer rbin[InterfacesAmount] = {IBUF(0), IBUF(1)}; +// last send data size (<0 if USB transfer ready) +static volatile int lastdsz[InterfacesAmount] = {-1, -1}; + +// check incoming data and set ACK if need +static void chkin(uint8_t ifno){ + if(bufovrfl[ifno]) return; // allow user to know that previous buffer was overflowed and cleared + if(!rcvbuflen[ifno]) return; + int w = RB_write((ringbuffer*)&rbin[ifno], (uint8_t*)rcvbuf[ifno], rcvbuflen[ifno]); + if(w < 0){ + return; + } + if(w != rcvbuflen[ifno]) bufovrfl[ifno] = 1; + rcvbuflen[ifno] = 0; + uint16_t status = KEEP_DTOG(USB->EPnR[EPNO(ifno)]); // don't change DTOG + USB->EPnR[EPNO(ifno)] = (status & ~(USB_EPnR_STAT_TX|USB_EPnR_CTR_RX)) ^ USB_EPnR_STAT_RX; // prepare to get next data portion +} + +// called from transmit EP to send next data portion or by user - when new transmission starts +static void send_next(uint8_t ifno){ + uint8_t usbbuff[USB_TXBUFSZ]; + int buflen = RB_read((ringbuffer*)&rbout[ifno], (uint8_t*)usbbuff, USB_TXBUFSZ); + if(!CDCready[ifno]){ + lastdsz[ifno] = -1; + return; + } + if(buflen == 0){ + if(lastdsz[ifno] == USB_TXBUFSZ){ + EP_Write(EPNO(ifno), NULL, 0); // send ZLP after 64 bits packet when nothing more to send + lastdsz[ifno] = 0; + }else lastdsz[ifno] = -1; // OK. User can start sending data + return; + }else if(buflen < 0){ + lastdsz[ifno] = -1; + return; + } + EP_Write(EPNO(ifno), (uint8_t*)usbbuff, buflen); + lastdsz[ifno] = buflen; +} + +// data IN/OUT handler +static void rxtx_handler(){ + uint8_t epno = (USB->ISTR & USB_ISTR_EPID), ifno = IFNO(epno); + if(ifno > InterfacesAmount-1){ + return; + } + uint16_t epstatus = KEEP_DTOG(USB->EPnR[epno]); + if(RX_FLAG(epstatus)){ // receive data + if(rcvbuflen[ifno]){ + bufovrfl[ifno] = 1; // lost last data + rcvbuflen[ifno] = 0; + } + rcvbuflen[ifno] = EP_Read(epno, (uint8_t*)rcvbuf[ifno]); + USB->EPnR[epno] = epstatus & ~(USB_EPnR_CTR_RX | USB_EPnR_STAT_RX | USB_EPnR_STAT_TX); // keep RX in STALL state until read data + chkin(ifno); // try to write current data into RXbuf if it's not busy + }else{ // tx successfull + USB->EPnR[epno] = (epstatus & ~(USB_EPnR_CTR_TX | USB_EPnR_STAT_TX)) ^ USB_EPnR_STAT_RX; + send_next(ifno); + } +} + +// clear IN/OUT buffers on connection +static void clearbufs(uint8_t ifno){ + uint32_t T0 = Tms; + while(Tms - T0 < 10){ // wait no more than 10ms + if(1 == RB_clearbuf((ringbuffer*)&rbin[ifno])) break; + } + T0 = Tms; + while(Tms - T0 < 10){ + if(1 == RB_clearbuf((ringbuffer*)&rbout[ifno])) break; + } +} + +// SET_LINE_CODING +void linecoding_handler(uint8_t ifno, usb_LineCoding *lc){ + lineCoding[ifno] = *lc; + // next lines could be using to add direct USART-USB interface + //usart_config(ifno, &lineCoding[ifno]); // lc would be real speed! + //usart_start(ifno); // restart again with new configuration +} + +// SET_CONTROL_LINE_STATE +void clstate_handler(uint8_t ifno, uint16_t val){ + CDCready[ifno] = val; // CONTROL_DTR | CONTROL_RTS -> interface connected; 0 -> disconnected + lastdsz[ifno] = -1; + if(val){ + clearbufs(ifno); + EP_reset(EPNO(ifno)); + // usart_start(ifno); + }//else usart_stop(ifno); // turn of USART (if it is @ this interface) +} + +// SEND_BREAK - disconnect interface and clear its buffers +// this is a fake handler as classic CDC ACM never receives this +void break_handler(uint8_t ifno){ + CDCready[ifno] = 0; + // usart_stop(ifno); // turn of USART (if it is @ this interface) +} + +// Interface is configured: setup endpoints +void set_configuration(){ + for(int i = 0; i < InterfacesAmount; ++i){ + IWDG->KR = IWDG_REFRESH; + int r = EP_Init(EPNO(i), EP_TYPE_BULK, USB_TXBUFSZ, USB_RXBUFSZ, rxtx_handler); + if(r){ + // OOPS, can't init EP. What to do? Cry? + break; + } + } +} + +// USB CDC CLASS request +void usb_class_request(config_pack_t *req, uint8_t *data, uint16_t datalen){ + uint8_t recipient = REQUEST_RECIPIENT(req->bmRequestType); + uint8_t dev2host = (req->bmRequestType & 0x80) ? 1 : 0; + uint8_t ifno = req->wIndex >> 1; + if(ifno > InterfacesAmount-1){ // wrong interface number + EP_WriteIRQ(0, NULL, 0); + return; + } + switch(recipient){ + case REQ_RECIPIENT_INTERFACE: + switch(req->bRequest){ + case SET_LINE_CODING: + if(!data || !datalen) break; // wait for data + if(datalen == sizeof(usb_LineCoding)) + linecoding_handler(ifno, (usb_LineCoding*)data); + break; + case GET_LINE_CODING: + EP_WriteIRQ(0, (uint8_t*)&lineCoding[ifno], sizeof(lineCoding)); + break; + case SET_CONTROL_LINE_STATE: + clstate_handler(ifno, req->wValue); + break; + case SEND_BREAK: + break_handler(ifno); + break; + default: // WTF? + break; + } + break; + default: // WTF? + if(dev2host) EP_WriteIRQ(0, NULL, 0); + } + if(!dev2host) EP_WriteIRQ(0, NULL, 0); +} + +// blocking send full content of ring buffer +int USB_sendall(uint8_t ifno){ + uint32_t T0 = Tms; + while(lastdsz[ifno] > 0){ + if(Tms - T0 > DISCONN_TMOUT){ + //break_handler(ifno); + return FALSE; + } + if(!CDCready[ifno]) return FALSE; + IWDG->KR = IWDG_REFRESH; + } + return TRUE; +} + +// return amount of free space in buffer +int USB_sendbufspace(uint8_t ifno){ + if(!CDCready[ifno]) return 0; + return rbout[ifno].length - RB_datalen((ringbuffer*)&rbout[ifno]); +} + +// put `buf` into queue to send +int USB_send(uint8_t ifno, const uint8_t *buf, int len){ + if(!buf || !CDCready[ifno] || !len){ + return FALSE; + } + uint32_t T0 = Tms; + while(len){ + if(Tms - T0 > DISCONN_TMOUT){ + //break_handler(ifno); + return FALSE; + } + if(!CDCready[ifno]){ + return FALSE; + } + IWDG->KR = IWDG_REFRESH; + int l = RB_datalen((ringbuffer*)&rbout[ifno]); + if(l < 0) continue; + int portion = rbout[ifno].length - 1 - l; + if(portion < 1){ + if(lastdsz[ifno] < 0) send_next(ifno); + continue; + } + if(portion > len) portion = len; + int a = RB_write((ringbuffer*)&rbout[ifno], buf, portion); + if(a > 0){ + len -= a; + buf += a; + }else if(a == 0){ // overfull + if(lastdsz[ifno] < 0) send_next(ifno); + } + } + if(buf[len-1] == '\n' && lastdsz[ifno] < 0){ + send_next(ifno); + } + return TRUE; +} + +int USB_putbyte(uint8_t ifno, uint8_t byte){ + if(!CDCready[ifno]) return FALSE; + int l = 0; + uint32_t T0 = Tms; + while((l = RB_write((ringbuffer*)&rbout[ifno], &byte, 1)) != 1){ + if(Tms - T0 > DISCONN_TMOUT){ + //break_handler(ifno); + return FALSE; + } + if(!CDCready[ifno]) return FALSE; + IWDG->KR = IWDG_REFRESH; + if(l == 0){ // overfull + if(lastdsz[ifno] < 0) send_next(ifno); + continue; + } + } + // send line if got EOL + if(byte == '\n' && lastdsz[ifno] < 0){ + send_next(ifno); + } + return TRUE; +} + +int USB_sendstr(uint8_t ifno, const char *string){ + if(!string || !CDCready[ifno]) return FALSE; + int len = strlen(string); + if(!len) return FALSE; + return USB_send(ifno, (const uint8_t*)string, len); +} + +int USB_rcvlen(uint8_t ifno){ + return RB_datalen((ringbuffer*)&rbin[ifno]); +} + +/** + * @brief USB_receive - get binary data from receiving ring-buffer + * @param buf (i) - buffer for received data + * @param len - length of `buf` + * @return amount of received bytes (negative, if overfull happened) + */ +int USB_receive(uint8_t ifno, uint8_t *buf, int len){ + if(!CDCready[ifno]) return 0; + chkin(ifno); // rxtx_handler could leave last message unwritten if buffer was busy + if(bufovrfl[ifno]){ + while(1 != RB_clearbuf((ringbuffer*)&rbin[ifno])); // run watchdog in case of problems + bufovrfl[ifno] = 0; + return -1; + } + int sz = RB_read((ringbuffer*)&rbin[ifno], buf, len); + if(sz < 0) return 0; // buffer in writting state + return sz; +} + +/** + * @brief USB_receivestr - get string up to '\n' and replace '\n' with 0 + * @param buf - receiving buffer + * @param len - its length + * @return strlen or negative value indicating overflow (if so, string won't be ends with 0 and buffer should be cleared) + */ +int USB_receivestr(uint8_t ifno, char *buf, int len){ + if(!CDCready[ifno]) return 0; + chkin(ifno); // rxtx_handler could leave last message unwritten if buffer was busy + if(bufovrfl[ifno]){ + while(1 != RB_clearbuf((ringbuffer*)&rbin[ifno])); + bufovrfl[ifno] = 0; + return -1; + } + int l = RB_readto((ringbuffer*)&rbin[ifno], '\n', (uint8_t*)buf, len); + if(l < 1){ + if((rbin[ifno].length <= RB_datalen((ringbuffer*)&rbin[ifno]) + 1) || + (RB_datalento((ringbuffer*)&rbin[ifno], '\n') > len - 1)){ // buffer is full but no '\n' found or string too long + while(1 != RB_clearbuf((ringbuffer*)&rbin[ifno])); + return -1; + } + return 0; + } + buf[l-1] = 0; // replace '\n' with strend + return l; +} + +/** + * @brief IFconfig - interface configuration + * @param ifno - index + * @param l (o, user allocated) - settings + * @return value of CDCready + */ +uint8_t IFconfig(uint8_t ifno, usb_LineCoding *l){ + if(ifno >= InterfacesAmount) return 0; + if(l) *l = lineCoding[ifno]; + return CDCready[ifno]; +} + diff --git a/F0:F030,F042,F072/usbcan_gpio/usb_dev.h b/F0:F030,F042,F072/usbcan_gpio/usb_dev.h new file mode 100644 index 0000000..ab7b3f9 --- /dev/null +++ b/F0:F030,F042,F072/usbcan_gpio/usb_dev.h @@ -0,0 +1,69 @@ +/* + * Copyright 2024 Edward V. Emelianov . + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +#pragma once + +#include +#include "usb_lib.h" + +typedef struct { + uint32_t dwDTERate; + uint8_t bCharFormat; +#define USB_CDC_1_STOP_BITS 0 +#define USB_CDC_1_5_STOP_BITS 1 +#define USB_CDC_2_STOP_BITS 2 + uint8_t bParityType; +#define USB_CDC_NO_PARITY 0 +#define USB_CDC_ODD_PARITY 1 +#define USB_CDC_EVEN_PARITY 2 +#define USB_CDC_MARK_PARITY 3 +#define USB_CDC_SPACE_PARITY 4 + uint8_t bDataBits; +} __attribute__ ((packed)) usb_LineCoding; + +extern volatile uint8_t CDCready[]; + +void break_handler(uint8_t ifno); +void clstate_handler(uint8_t ifno, uint16_t val); +void linecoding_handler(uint8_t ifno, usb_LineCoding *lc); + +// as ugly CDC have no BREAK after disconnected client in non-canonical mode, we should use timeout - near 2s +#define DISCONN_TMOUT (2) + +// sizes of ringbuffers for outgoing and incoming data +#define RBOUTSZ (1024) +#define RBINSZ (1024) + +#define newline(ifno) USB_putbyte(ifno, '\n') +#define USND(ifno, s) do{USB_sendstr(ifno, s); USB_putbyte(ifno, '\n');}while(0) +// 'shortcuts' for files used only one interface "USBIF" +#ifdef USBIF +#define SEND(x) USB_sendstr(USBIF, x) +#define RECV(b,l) USB_receivestr(USBIF, b, l) +#define PUTCHAR(x) USB_putbyte(USBIF, x) +#define SENDn(x) do{USB_sendstr(USBIF, x); USB_putbyte(USBIF, '\n');}while(0) +#define NL(x) USB_putbyte(USBIF, '\n') +#endif + +int USB_sendbufspace(uint8_t ifno); +int USB_sendall(uint8_t ifno); +int USB_send(uint8_t ifno, const uint8_t *buf, int len); +int USB_putbyte(uint8_t ifno, uint8_t byte); +int USB_sendstr(uint8_t ifno, const char *string); +int USB_rcvlen(uint8_t ifno); +int USB_receive(uint8_t ifno, uint8_t *buf, int len); +int USB_receivestr(uint8_t ifno, char *buf, int len); +uint8_t IFconfig(uint8_t ifno, usb_LineCoding *l); diff --git a/F0:F030,F042,F072/usbcan_gpio/usb_lib.c b/F0:F030,F042,F072/usbcan_gpio/usb_lib.c new file mode 100644 index 0000000..3bdfd8c --- /dev/null +++ b/F0:F030,F042,F072/usbcan_gpio/usb_lib.c @@ -0,0 +1,446 @@ +/* + * Copyright 2024 Edward V. Emelianov . + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +#include + +#include "usb_lib.h" +#include "usb_descr.h" +#include "usb_dev.h" + +static ep_t endpoints[STM32ENDPOINTS]; + +static uint16_t USB_Addr = 0; +static uint8_t setupdatabuf[EP0DATABUF_SIZE] __attribute__((aligned(4))); +static config_pack_t *setup_packet = (config_pack_t*) setupdatabuf; +volatile uint8_t usbON = 0; // device is configured and active + +static uint16_t configuration = 0; // reply for GET_CONFIGURATION (==1 if configured) +static inline void std_d2h_req(){ + uint16_t st = 0; + switch(setup_packet->bRequest){ + case GET_DESCRIPTOR: + get_descriptor(setup_packet); + break; + case GET_STATUS: + EP_WriteIRQ(0, (uint8_t *)&st, 2); // send status: Bus Powered + break; + case GET_CONFIGURATION: + EP_WriteIRQ(0, (uint8_t*)&configuration, 1); + break; + default: + EP_WriteIRQ(0, NULL, 0); + break; + } +} + +static inline void std_h2d_req(){ + switch(setup_packet->bRequest){ + case SET_ADDRESS: + // new address will be assigned later - after acknowlegement or request to host + USB_Addr = setup_packet->wValue; + break; + case SET_CONFIGURATION: + // Now device configured + configuration = setup_packet->wValue; + set_configuration(); + usbON = 1; + break; + default: + break; + } +} + +void WEAK usb_standard_request(){ + uint8_t recipient = REQUEST_RECIPIENT(setup_packet->bmRequestType); + uint8_t dev2host = (setup_packet->bmRequestType & 0x80) ? 1 : 0; + switch(recipient){ + case REQ_RECIPIENT_DEVICE: + if(dev2host){ + std_d2h_req(); + }else{ + std_h2d_req(); + } + break; + case REQ_RECIPIENT_INTERFACE: + if(dev2host && setup_packet->bRequest == GET_DESCRIPTOR){ + get_descriptor(setup_packet); + } + break; + case REQ_RECIPIENT_ENDPOINT: + if(setup_packet->bRequest == CLEAR_FEATURE){ + }else{ /* wrong */ } + break; + default: + break; + } + if(!dev2host) EP_WriteIRQ(0, NULL, 0); +} + +void WEAK usb_class_request(config_pack_t *req, uint8_t _U_ *data, uint16_t _U_ datalen){ + switch(req->bRequest){ + case GET_INTERFACE: + break; + case SET_CONFIGURATION: // set featuring by req->wValue + break; + default: + break; + } + if(0 == (setup_packet->bmRequestType & 0x80)) // host2dev + EP_WriteIRQ(0, NULL, 0); +} + +void WEAK usb_vendor_request(config_pack_t _U_ *packet, uint8_t _U_ *data, uint16_t _U_ datalen){ + if(0 == (setup_packet->bmRequestType & 0x80)) // host2dev + EP_WriteIRQ(0, NULL, 0); +} + +/* +bmRequestType: 76543210 +7 direction: 0 - host->device, 1 - device->host +65 type: 0 - standard, 1 - class, 2 - vendor +4..0 getter: 0 - device, 1 - interface, 2 - endpoint, 3 - other +*/ +/** + * Endpoint0 (control) handler + */ +static void EP0_Handler(){ + uint8_t ep0dbuflen = 0; + uint8_t ep0databuf[EP0DATABUF_SIZE] __attribute__((aligned(4))); + uint16_t epstatus = KEEP_DTOG(USB->EPnR[0]); // EP0R on input -> return this value after modifications + int rxflag = RX_FLAG(epstatus); + // check direction + if(USB->ISTR & USB_ISTR_DIR){ // OUT interrupt - receive data, CTR_RX==1 (if CTR_TX == 1 - two pending transactions: receive following by transmit) + if(epstatus & USB_EPnR_SETUP){ // setup packet -> copy data to conf_pack + EP_Read(0, setupdatabuf); + // interrupt handler will be called later + }else if(epstatus & USB_EPnR_CTR_RX){ // data packet -> push received data to ep0databuf + //if(endpoints[0].rx_cnt){ } + ep0dbuflen = EP_Read(0, ep0databuf); + } + } + if(rxflag){ + uint8_t reqtype = REQUEST_TYPE(setup_packet->bmRequestType); + switch(reqtype){ + case REQ_TYPE_STANDARD: + if(SETUP_FLAG(epstatus)){ + usb_standard_request(); + }else{ } + break; + case REQ_TYPE_CLASS: + usb_class_request(setup_packet, ep0databuf, ep0dbuflen); + break; + case REQ_TYPE_VENDOR: + usb_vendor_request(setup_packet, ep0databuf, ep0dbuflen); + break; + default: + EP_WriteIRQ(0, NULL, 0); + break; + } + } + if(TX_FLAG(epstatus)){ + // now we can change address after enumeration + if ((USB->DADDR & USB_DADDR_ADD) != USB_Addr){ + USB->DADDR = USB_DADDR_EF | USB_Addr; + usbON = 0; + } + } + //epstatus = KEEP_DTOG(USB->EPnR[0]); + if(rxflag) epstatus ^= USB_EPnR_STAT_TX; // start ZLP or data transmission + else epstatus &= ~USB_EPnR_STAT_TX; // or leave unchanged + // keep DTOGs, clear CTR_RX,TX, set RX VALID + USB->EPnR[0] = (epstatus & ~(USB_EPnR_CTR_RX|USB_EPnR_CTR_TX)) ^ USB_EPnR_STAT_RX; +} + +/** + * Write data to EP buffer (called from IRQ handler) + * @param number - EP number + * @param *buf - array with data + * @param size - its size + */ +void EP_WriteIRQ(uint8_t number, const uint8_t *buf, uint16_t size){ + if(size > endpoints[number].txbufsz) size = endpoints[number].txbufsz; +#ifndef USB32 + uint16_t N2 = (size + 1) >> 1; + // the buffer is 16-bit, so we should copy data as it would be uint16_t + uint16_t *buf16 = (uint16_t *)buf; +#else + int N4 = (size + 3) >> 2; + uint32_t *buf32 = (uint32_t *)buf; +#endif +#if defined USB1_16 + // very bad: what if `size` is odd? + uint32_t *out = (uint32_t *)endpoints[number].tx_buf; + for(int i = 0; i < N2; ++i, ++out){ + *out = buf16[i]; + } +#elif defined USB2_16 + // use memcpy instead? + for(int i = 0; i < N2; ++i){ + endpoints[number].tx_buf[i] = buf16[i]; + } +#elif defined USB32 + for(int i = 0; i < N4; ++i) endpoints[number].tx_buf[i] = buf32[i]; +#else +#error "Define USB1_16 / USB2_16 / USB32" +#endif +#ifndef USB32 + USB_BTABLE->EP[number].USB_COUNT_TX = size; +#else + USB_BTABLE->EP[number].USB_ADDR_COUNT_TX = (USB_BTABLE->EP[number].USB_ADDR_COUNT_TX & 0xffff) | (size << 16); +#endif +} + +/** + * Write data to EP buffer (called outside IRQ handler) + * @param number - EP number + * @param *buf - array with data + * @param size - its size + */ +void EP_Write(uint8_t number, const uint8_t *buf, uint16_t size){ + EP_WriteIRQ(number, buf, size); + uint16_t epstatus = KEEP_DTOG(USB->EPnR[number]); + // keep DTOGs and RX stat, clear CTR_TX & set TX VALID to start transmission + USB->EPnR[number] = (epstatus & ~(USB_EPnR_CTR_TX | USB_EPnR_STAT_RX)) ^ USB_EPnR_STAT_TX; +} + +/* + * Copy data from EP buffer into user buffer area + * @param *buf - user array for data + * @return amount of data read + */ +int EP_Read(uint8_t number, uint8_t *buf){ + int sz = endpoints[number].rx_cnt; + if(!sz) return 0; + endpoints[number].rx_cnt = 0; +#if defined USB1_16 + int n = (sz + 1) >> 1; + uint32_t *in = (uint32_t*)endpoints[number].rx_buf; + uint16_t *out = (uint16_t*)buf; + for(int i = 0; i < n; ++i, ++in) + out[i] = *(uint16_t*)in; +#elif defined USB2_16 + // use memcpy instead? + for(int i = 0; i < sz; ++i) + buf[i] = endpoints[number].rx_buf[i]; +#elif defined USB32 + uint32_t *u32buf = (uint32_t*) buf; + int N4 = (sz + 3) >> 2; + for(int i = 0; i < N4; ++i) u32buf[i] = endpoints[number].rx_buf[i]; +#else +#error "Define USB1_16 / USB2_16 / USB32" +#endif + return sz; +} + + +static uint16_t lastaddr = LASTADDR_DEFAULT; +/** + * Endpoint initialisation + * @param number - EP num (0...7) + * @param type - EP type (EP_TYPE_BULK, EP_TYPE_CONTROL, EP_TYPE_ISO, EP_TYPE_INTERRUPT) + * @param txsz - transmission buffer size @ USB/CAN buffer + * @param rxsz - reception buffer size @ USB/CAN buffer + * @param uint16_t (*func)(ep_t *ep) - EP handler function + * @return 0 if all OK + */ +int EP_Init(uint8_t number, uint8_t type, uint16_t txsz, uint16_t rxsz, void (*func)(ep_t ep)){ +#ifdef STM32G0 + // in STM32G0 all buffers should be aligned by 32 bits + if(txsz & 3) txsz = ((txsz >> 2)+1) << 2; + if(rxsz & 3) rxsz = ((rxsz >> 2)+1) << 2; +#endif + if(number >= STM32ENDPOINTS) return 4; // out of configured amount + if(txsz > USB_BTABLE_SIZE/ACCESSZ || rxsz > USB_BTABLE_SIZE/ACCESSZ) return 1; // buffer too large + if(lastaddr + txsz + rxsz >= USB_BTABLE_SIZE/ACCESSZ) return 2; // out of btable + USB->EPnR[number] = (type << 9) | (number & USB_EPnR_EA); + USB->EPnR[number] ^= USB_EPnR_STAT_RX | USB_EPnR_STAT_TX; + if(rxsz & 1) return 3; // wrong rx buffer size + uint16_t countrx = 0; + if(rxsz < 64) countrx = rxsz / 2; + else{ + if(rxsz & 0x1f) return 3; // should be multiple of 32 + countrx = 31 + rxsz / 32; + } +#ifdef USB32 + endpoints[number].tx_buf = (uint32_t *)(USB_BTABLE_BASE + lastaddr * ACCESSZ); +#else + endpoints[number].tx_buf = (uint16_t *)(USB_BTABLE_BASE + lastaddr * ACCESSZ); +#endif + endpoints[number].txbufsz = txsz; +#ifdef USB32 + USB_BTABLE->EP[number].USB_ADDR_COUNT_TX = (uint32_t) lastaddr; +#else + USB_BTABLE->EP[number].USB_ADDR_TX = lastaddr; + USB_BTABLE->EP[number].USB_COUNT_TX = 0; +#endif + lastaddr += txsz; +#ifdef USB32 + endpoints[number].rx_buf = (uint32_t *)(USB_BTABLE_BASE + lastaddr * ACCESSZ); + USB_BTABLE->EP[number].USB_ADDR_COUNT_RX = (uint32_t) lastaddr | countrx << 26; +#else + endpoints[number].rx_buf = (uint8_t *)(USB_BTABLE_BASE + lastaddr * ACCESSZ); + USB_BTABLE->EP[number].USB_ADDR_RX = lastaddr; + USB_BTABLE->EP[number].USB_COUNT_RX = countrx << 10; +#endif + lastaddr += rxsz; + endpoints[number].func = func; + return 0; +} + +// refresh EP after interface reconnected +void EP_reset(uint8_t number){ + if(number >= STM32ENDPOINTS) return; + USB->EPnR[number] ^= USB_EPnR_STAT_RX | USB_EPnR_STAT_TX; + USB_BTABLE->EP[number].USB_COUNT_TX = 0; +} + +// standard IRQ handler +void USB_IRQ(){ + uint32_t CNTR = USB->CNTR; + USB->CNTR = 0; + uint32_t istr = USB->ISTR; + if(istr & USB_ISTR_RESET){ + usbON = 0; + // Reinit registers + CNTR = USB_CNTR_RESETM | USB_CNTR_CTRM | USB_CNTR_SUSPM; + // Endpoint 0 - CONTROL + // ON USB LS size of EP0 may be 8 bytes, but on FS it should be 64 bytes! + lastaddr = LASTADDR_DEFAULT; + // clear address, leave only enable bit + USB->DADDR = USB_DADDR_EF; + //USB->ISTR = ~(USB_ISTR_RESET); // clear all flags + if(EP_Init(0, EP_TYPE_CONTROL, USB_EP0BUFSZ, USB_EP0BUFSZ, EP0_Handler)){ + return; + }; + } + if(istr & USB_ISTR_CTR){ + // EP number + uint8_t n = istr & USB_ISTR_EPID; + if (istr & USB_ISTR_DIR){ // OUT + }else{ // IN + } + // copy received bytes amount + endpoints[n].rx_cnt = +#ifdef USB32 + (USB_BTABLE->EP[n].USB_ADDR_COUNT_RX >> 16) & 0x3FF; +#else + USB_BTABLE->EP[n].USB_COUNT_RX & 0x3FF; // low 10 bits is counter +#endif + // call EP handler + if(endpoints[n].func) endpoints[n].func(); + } + if(istr & USB_ISTR_WKUP){ // wakeup +#if defined STM32F0 + CNTR &= ~(USB_CNTR_FSUSP | USB_CNTR_LPMODE | USB_CNTR_WKUPM); +#elif defined STM32G0 + CNTR &= ~(USB_CNTR_SUSPEN | USB_CNTR_PDWN | USB_CNTR_WKUPM); +#else + CNTR &= ~(USB_CNTR_FSUSP | USB_CNTR_LP_MODE | USB_CNTR_WKUPM); // clear suspend flags +#endif + //USB->ISTR = ~USB_ISTR_WKUP; + } + if(istr & USB_ISTR_SUSP){ // suspend -> still no connection, may sleep + usbON = 0; +#if defined STM32F0 + CNTR |= USB_CNTR_FSUSP | USB_CNTR_LPMODE | USB_CNTR_WKUPM; +#elif defined STM32G0 + CNTR |= USB_CNTR_SUSPEN | USB_CNTR_WKUPM; +#else + CNTR |= USB_CNTR_FSUSP | USB_CNTR_LP_MODE | USB_CNTR_WKUPM; +#endif + CNTR &= ~(USB_CNTR_SUSPM); + //USB->ISTR = ~USB_ISTR_SUSP; + } + USB->ISTR = 0; // clear all flags + USB->CNTR = CNTR; // rewoke interrupts +} + +// here we suppose that all PIN settings done in hw_setup earlier +void USB_setup(){ + lastaddr = LASTADDR_DEFAULT; // clear last address settings +#if defined STM32F3 + NVIC_DisableIRQ(USB_LP_IRQn); + // remap USB LP & Wakeup interrupts to 75 and 76 - works only on pure F303 + RCC->APB2ENR |= RCC_APB2ENR_SYSCFGEN; // enable tacting of SYSCFG + SYSCFG->CFGR1 |= SYSCFG_CFGR1_USB_IT_RMP; +#elif defined STM32F1 + NVIC_DisableIRQ(USB_LP_CAN1_RX0_IRQn); + NVIC_DisableIRQ(USB_HP_CAN1_TX_IRQn); +#elif defined STM32F0 + // All is clocking from HSI48 + NVIC_DisableIRQ(USB_IRQn); + RCC->APB1ENR |= RCC_APB1ENR_CRSEN; + RCC->CFGR3 &= ~RCC_CFGR3_USBSW; // reset USB + RCC->CR2 |= RCC_CR2_HSI48ON; // turn ON HSI48 + uint32_t tmout = 16000000; + while(!(RCC->CR2 & RCC_CR2_HSI48RDY)){if(--tmout == 0) break;} + FLASH->ACR = FLASH_ACR_PRFTBE | FLASH_ACR_LATENCY; + CRS->CFGR &= ~CRS_CFGR_SYNCSRC; + CRS->CFGR |= CRS_CFGR_SYNCSRC_1; // USB SOF selected as sync source + CRS->CR |= CRS_CR_AUTOTRIMEN; // enable auto trim + CRS->CR |= CRS_CR_CEN; // enable freq counter & block CRS->CFGR as read-only + RCC->CFGR |= RCC_CFGR_SW; +#elif defined STM32G0 + NVIC_DisableIRQ(USB_UCPD1_2_IRQn); + PWR->CR2 |= PWR_CR2_USV; // enable USB powering + //RCC->APBENR2 |= RCC_APBENR2_SYSCFGEN; // enable tacting of SYSCFG + // independent clocking of USB from HSI48 + RCC->CR |= RCC_CR_HSI48ON; + uint32_t tmout = 16000000; + while(!(RCC->CR & RCC_CR_HSI48RDY)) if(--tmout == 0) break; + RCC->CCIPR2 &= ~RCC_CCIPR2_USBSEL; // select HSI48 for USB + RCC->APBENR1 |= RCC_APBENR1_CRSEN; // CRS clocking + CRS->CFGR = (31LL << CRS_CFGR_FELIM_Pos) | // tolerance (usually 31) + (48000LL / 1LL - 1LL) << CRS_CFGR_RELOAD_Pos | // 48MHz / 1kHZ (SOF) + CRS_CFGR_SYNCSRC_1; // USB SOF as sync source (0x2) + CRS->CR |= CRS_CR_AUTOTRIMEN | CRS_CR_CEN; // Enable autotrim and turn on Clock Recovery System + RCC->APBENR1 |= RCC_APBENR1_USBEN; +#endif +#ifndef STM32G0 + RCC->APB1ENR |= RCC_APB1ENR_USBEN; + USB->CNTR = USB_CNTR_FRES; // Force USB Reset + USB->BTABLE = 0; +#else + USB->CNTR = USB_CNTR_USBRST; +#endif + for(uint32_t ctr = 0; ctr < 72000; ++ctr) nop(); // wait >1ms + USB->CNTR = USB_CNTR_RESETM; // allow only reset interrupts + USB->DADDR = 0; + USB->ISTR = 0; +#if defined STM32F3 + NVIC_EnableIRQ(USB_LP_IRQn); +#elif defined STM32F1 + NVIC_EnableIRQ(USB_LP_CAN1_RX0_IRQn); +#elif defined STM32F0 + USB->BCDR |= USB_BCDR_DPPU; + NVIC_EnableIRQ(USB_IRQn); +#elif defined STM32G0 + USB->BCDR |= USB_BCDR_DPPU; // turn ON DP pullup + NVIC_EnableIRQ(USB_UCPD1_2_IRQn); +#endif + setup_interfaces(); // refresh interfaces' names +} + + +#if defined STM32F3 +void usb_lp_isr() __attribute__ ((alias ("USB_IRQ"))); +#elif defined STM32F1 +void usb_lp_can_rx0_isr() __attribute__ ((alias ("USB_IRQ"))); +#elif defined STM32F0 +void usb_isr() __attribute__ ((alias ("USB_IRQ"))); +#elif defined STM32G0 +void usb_ucpd1_2_isr() __attribute__ ((alias ("USB_IRQ"))); +#endif diff --git a/F0:F030,F042,F072/usbcan_gpio/usb_lib.h b/F0:F030,F042,F072/usbcan_gpio/usb_lib.h new file mode 100644 index 0000000..18ede16 --- /dev/null +++ b/F0:F030,F042,F072/usbcan_gpio/usb_lib.h @@ -0,0 +1,353 @@ +/* + * Copyright 2024 Edward V. Emelianov . + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +#pragma once + +#include +#include + +#ifndef _U_ +#define _U_ __attribute__((unused)) +#endif + +/****************************************************************** + * Hardware registers etc * + *****************************************************************/ +#if defined STM32F0 +#include +#elif defined STM32F1 +#include +// there's no this define in standard header +#define USB_BASE ((uint32_t)0x40005C00) +#elif defined STM32F3 +#include +#elif defined STM32G0 +#include +#endif + +// max endpoints number +#define STM32ENDPOINTS 8 +/** + * Buffers size definition + **/ + +// F0 - USB2_16; F1 - USB1_16; F3 - 1/2 depending on series; G0 - USB32 +#if !defined USB1_16 && !defined USB2_16 && !defined USB32 +#if defined STM32F0 +#define USB2_16 +#elif defined STM32F1 +#define USB1_16 +#elif defined STM32G0 +#define USB32 +#else +#error "Can't determine USB1_16/USB2_16/USB32, define by hands" +#endif +#endif + +// BTABLE_SIZE FOR STM32F3: +// In STM32F303/302xB/C, 512 bytes SRAM is not shared with CAN. +// In STM32F302x6/x8 and STM32F30xxD/E, 726 bytes dedicated SRAM and 256 bytes shared SRAM with CAN i.e. +// 1Kbytes dedicated SRAM in case CAN is disabled. +// remember, that USB_BTABLE_SIZE will be divided by ACCESSZ, so don't divide it twice for 32-bit addressing + +#ifdef NOCAN +#if defined STM32F0 +#define USB_BTABLE_SIZE 1024 +#elif defined STM32F3 +#define USB_BTABLE_SIZE 1024 +//#warning "Please, check real buffer size due to docs" +#else +#error "define STM32F0 or STM32F3" +#endif +#else // !NOCAN: F0/F3 with CAN or F1 (can't simultaneously run CAN and USB) +#if defined STM32F0 +#define USB_BTABLE_SIZE 768 +#elif defined STM32F3 +#define USB_BTABLE_SIZE 768 +#elif defined STM32G0 +#define USB_BTABLE_SIZE 2048 +//#warning "Please, check real buffer size due to docs" +#else // STM32F103: 1024 bytes but with 32-bit addressing +#define USB_BTABLE_SIZE 1024 +#endif +#endif // NOCAN + +// first 64 bytes of USB_BTABLE are registers! +#ifndef STM32G0 +#define USB_BTABLE_BASE 0x40006000 +#else +#define USB_BTABLE_BASE 0x40009800 +#endif +#define USB ((USB_TypeDef *) USB_BASE) + +#ifdef USB_BTABLE +#undef USB_BTABLE +#endif +#define USB_BTABLE ((USB_BtableDef *)(USB_BTABLE_BASE)) +#define USB_ISTR_EPID 0x0000000F +#define USB_FNR_LSOF_0 0x00000800 +#define USB_FNR_lSOF_1 0x00001000 +#define USB_LPMCSR_BESL_0 0x00000010 +#define USB_LPMCSR_BESL_1 0x00000020 +#define USB_LPMCSR_BESL_2 0x00000040 +#define USB_LPMCSR_BESL_3 0x00000080 +#define USB_EPnR_CTR_RX 0x00008000 +#define USB_EPnR_DTOG_RX 0x00004000 +#define USB_EPnR_STAT_RX 0x00003000 +#define USB_EPnR_STAT_RX_0 0x00001000 +#define USB_EPnR_STAT_RX_1 0x00002000 +#define USB_EPnR_SETUP 0x00000800 +#define USB_EPnR_EP_TYPE 0x00000600 +#define USB_EPnR_EP_TYPE_0 0x00000200 +#define USB_EPnR_EP_TYPE_1 0x00000400 +#define USB_EPnR_EP_KIND 0x00000100 +#define USB_EPnR_CTR_TX 0x00000080 +#define USB_EPnR_DTOG_TX 0x00000040 +#define USB_EPnR_STAT_TX 0x00000030 +#define USB_EPnR_STAT_TX_0 0x00000010 +#define USB_EPnR_STAT_TX_1 0x00000020 +#define USB_EPnR_EA 0x0000000F +#define USB_COUNTn_RX_BLSIZE 0x00008000 +#define USB_COUNTn_NUM_BLOCK 0x00007C00 +#define USB_COUNTn_RX 0x0000003F + +#define USB_TypeDef USB_TypeDef_custom + +typedef struct { + __IO uint32_t EPnR[STM32ENDPOINTS]; + __IO uint32_t RESERVED[STM32ENDPOINTS]; + __IO uint32_t CNTR; + __IO uint32_t ISTR; + __IO uint32_t FNR; + __IO uint32_t DADDR; +#ifndef USB32 + __IO uint32_t BTABLE; +#else + __IO uint32_t RESERVED1; // there's no BTABLE register in STM32G0 +#endif +#if defined STM32F0 || defined USB32 + __IO uint32_t LPMCSR; + __IO uint32_t BCDR; +#endif +} USB_TypeDef; + +// F303 D/E have 2x16 access scheme +typedef struct{ +#if defined USB2_16 + __IO uint16_t USB_ADDR_TX; + __IO uint16_t USB_COUNT_TX; + __IO uint16_t USB_ADDR_RX; + __IO uint16_t USB_COUNT_RX; +#define ACCESSZ (1) +#elif defined USB1_16 + __IO uint32_t USB_ADDR_TX; + __IO uint32_t USB_COUNT_TX; + __IO uint32_t USB_ADDR_RX; + __IO uint32_t USB_COUNT_RX; +#define ACCESSZ (2) +#elif defined USB32 + // 32-bit registers: addr & count in one! + __IO uint32_t USB_ADDR_COUNT_TX; + __IO uint32_t USB_ADDR_COUNT_RX; +#define ACCESSZ (1) +#else +#error "Define USB1_16 (16 bits over 32bit register), USB2_16 (16 bits over 16 bit register) or USB32 (32 bist over 32 bit register)" +#endif +} USB_EPDATA_TypeDef; + + +typedef struct{ + __IO USB_EPDATA_TypeDef EP[STM32ENDPOINTS]; +} USB_BtableDef; + +#define EP0DATABUF_SIZE (64) +#define LASTADDR_DEFAULT (STM32ENDPOINTS * 8) + +/****************************************************************** + * Defines from usb.h * + *****************************************************************/ + +/* + * Device and/or Interface Class codes + */ +#define USB_CLASS_PER_INTERFACE 0 +#define USB_CLASS_AUDIO 1 +#define USB_CLASS_COMM 2 +#define USB_CLASS_HID 3 +#define USB_CLASS_PRINTER 7 +#define USB_CLASS_PTP 6 +#define USB_CLASS_MASS_STORAGE 8 +#define USB_CLASS_HUB 9 +#define USB_CLASS_DATA 10 +#define USB_CLASS_MISC 0xef +#define USB_CLASS_VENDOR_SPEC 0xff + +/* + * Descriptor types + */ +#define USB_DT_DEVICE 0x01 +#define USB_DT_CONFIG 0x02 +#define USB_DT_STRING 0x03 +#define USB_DT_INTERFACE 0x04 +#define USB_DT_ENDPOINT 0x05 +#define USB_DT_QUALIFIER 0x06 +#define USB_DT_IAD 0x0B + +#define USB_DT_HID 0x21 +#define USB_DT_REPORT 0x22 +#define USB_DT_PHYSICAL 0x23 +#define USB_DT_CS_INTERFACE 0x24 +#define USB_DT_HUB 0x29 + +/* + * Descriptor sizes per descriptor type + */ +#define USB_DT_DEVICE_SIZE 18 +#define USB_DT_CONFIG_SIZE 9 +#define USB_DT_INTERFACE_SIZE 9 +#define USB_DT_HID_SIZE 9 +#define USB_DT_ENDPOINT_SIZE 7 +#define USB_DT_QUALIFIER_SIZE 10 +#define USB_DT_CS_INTERFACE_SIZE 5 +#define USB_DT_IAD_SIZE 8 + + +// bmRequestType & 0x80 == dev2host (1) or host2dev (0) +// recipient: bmRequestType & 0x1f +#define REQUEST_RECIPIENT(b) (b & 0x1f) +#define REQ_RECIPIENT_DEVICE 0 +#define REQ_RECIPIENT_INTERFACE 1 +#define REQ_RECIPIENT_ENDPOINT 2 +#define REQ_RECIPIENT_OTHER 3 +// type: [bmRequestType & 0x60 >> 5] +#define REQUEST_TYPE(b) ((b&0x60)>>5) +#define REQ_TYPE_STANDARD 0 +#define REQ_TYPE_CLASS 1 +#define REQ_TYPE_VENDOR 2 +#define REQ_TYPE_RESERVED 3 + + +//#define VENDOR_REQUEST 0x01 + +// standard device requests +#define GET_STATUS 0x00 +#define CLEAR_FEATURE 0x01 +#define SET_FEATURE 0x03 +#define SET_ADDRESS 0x05 +#define GET_DESCRIPTOR 0x06 +#define SET_DESCRIPTOR 0x07 +#define GET_CONFIGURATION 0x08 +#define SET_CONFIGURATION 0x09 +// and some standard interface requests +#define GET_INTERFACE 0x0A +#define SET_INTERFACE 0x0B +// and some standard endpoint requests +#define SYNC_FRAME 0x0C + +// Types of descriptors +#define DEVICE_DESCRIPTOR 0x01 +#define CONFIGURATION_DESCRIPTOR 0x02 +#define STRING_DESCRIPTOR 0x03 +#define DEVICE_QUALIFIER_DESCRIPTOR 0x06 +#define DEBUG_DESCRIPTOR 0x0a +#define HID_REPORT_DESCRIPTOR 0x22 + +// EP types for EP_init +#define EP_TYPE_BULK 0x00 +#define EP_TYPE_CONTROL 0x01 +#define EP_TYPE_ISO 0x02 +#define EP_TYPE_INTERRUPT 0x03 + +// EP types for descriptors +#define USB_BM_ATTR_CONTROL 0x00 +#define USB_BM_ATTR_ISO 0x01 +#define USB_BM_ATTR_BULK 0x02 +#define USB_BM_ATTR_INTERRUPT 0x03 + + +/****************************************************************** + * Other stuff * + *****************************************************************/ + +#define RX_FLAG(epstat) (epstat & USB_EPnR_CTR_RX) +#define TX_FLAG(epstat) (epstat & USB_EPnR_CTR_TX) +#define SETUP_FLAG(epstat) (epstat & USB_EPnR_SETUP) + +// EPnR bits manipulation +#define KEEP_DTOG_STAT(EPnR) (EPnR & ~(USB_EPnR_STAT_RX|USB_EPnR_STAT_TX|USB_EPnR_DTOG_RX|USB_EPnR_DTOG_TX)) +#define KEEP_DTOG(EPnR) (EPnR & ~(USB_EPnR_DTOG_RX|USB_EPnR_DTOG_TX)) + +#define LANG_US (uint16_t)0x0409 + +#define _USB_STRING_(name, str) \ +static const struct name \ +{ \ + uint8_t bLength; \ + uint8_t bDescriptorType; \ + uint16_t bString[(sizeof(str) - 2) / 2]; \ + \ +} \ +name = {sizeof(name), 0x03, str} + +#define _USB_LANG_ID_(name, lng_id) \ +static const struct name \ +{ \ + uint8_t bLength; \ + uint8_t bDescriptorType; \ + uint16_t bString; \ + \ +} \ +name = {0x04, 0x03, lng_id} + +// EP0 configuration packet +typedef struct { + uint8_t bmRequestType; + uint8_t bRequest; + uint16_t wValue; + uint16_t wIndex; + uint16_t wLength; +} config_pack_t; + +// endpoints state +typedef struct{ +#ifdef USB32 + uint32_t *tx_buf; // transmission buffer address +#else + uint16_t *tx_buf; // transmission buffer address +#endif + uint16_t txbufsz; // transmission buffer size +#ifdef USB32 + uint32_t *rx_buf; // reception buffer address +#else + uint8_t *rx_buf; // reception buffer address +#endif + void (*func)(); // endpoint action function + unsigned rx_cnt : 10; // received data counter +} ep_t; + +extern volatile uint8_t usbON; + +void USB_setup(); +int EP_Init(uint8_t number, uint8_t type, uint16_t txsz, uint16_t rxsz, void (*func)()); +void EP_WriteIRQ(uint8_t number, const uint8_t *buf, uint16_t size); +void EP_Write(uint8_t number, const uint8_t *buf, uint16_t size); +int EP_Read(uint8_t number, uint8_t *buf); +void EP_reset(uint8_t number); + +// could be [re]defined in usb_dev.c +extern void usb_class_request(config_pack_t *packet, uint8_t *data, uint16_t datalen); +extern void usb_vendor_request(config_pack_t *packet, uint8_t *data, uint16_t datalen); +extern void set_configuration(); diff --git a/F0:F030,F042,F072/usbcan_gpio/usbcangpio.bin b/F0:F030,F042,F072/usbcan_gpio/usbcangpio.bin new file mode 100755 index 0000000..8716eef Binary files /dev/null and b/F0:F030,F042,F072/usbcan_gpio/usbcangpio.bin differ diff --git a/F0:F030,F042,F072/usbcan_gpio/usbcangpio.cflags b/F0:F030,F042,F072/usbcan_gpio/usbcangpio.cflags new file mode 100644 index 0000000..68d5165 --- /dev/null +++ b/F0:F030,F042,F072/usbcan_gpio/usbcangpio.cflags @@ -0,0 +1 @@ +-std=c17 \ No newline at end of file diff --git a/F0:F030,F042,F072/usbcan_gpio/usbcangpio.config b/F0:F030,F042,F072/usbcan_gpio/usbcangpio.config new file mode 100644 index 0000000..1ec56d2 --- /dev/null +++ b/F0:F030,F042,F072/usbcan_gpio/usbcangpio.config @@ -0,0 +1,6 @@ +// Add predefined macros for your project here. For example: +// #define THE_ANSWER 42 +#define EBUG +#define STM32F0 +#define STM32F042x6 +#define USB2_16 diff --git a/F0:F030,F042,F072/usbcan_gpio/usbcangpio.creator b/F0:F030,F042,F072/usbcan_gpio/usbcangpio.creator new file mode 100644 index 0000000..e94cbbd --- /dev/null +++ b/F0:F030,F042,F072/usbcan_gpio/usbcangpio.creator @@ -0,0 +1 @@ +[General] diff --git a/F0:F030,F042,F072/usbcan_gpio/usbcangpio.creator.user b/F0:F030,F042,F072/usbcan_gpio/usbcangpio.creator.user new file mode 100644 index 0000000..01b7cd6 --- /dev/null +++ b/F0:F030,F042,F072/usbcan_gpio/usbcangpio.creator.user @@ -0,0 +1,218 @@ + + + + + + EnvironmentId + {7bd84e39-ca37-46d3-be9d-99ebea85bc0d} + + + ProjectExplorer.Project.ActiveTarget + 0 + + + ProjectExplorer.Project.EditorSettings + + true + true + true + + Cpp + + CppGlobal + + + + QmlJS + + QmlJSGlobal + + + 2 + KOI8-R + false + 4 + false + 0 + 80 + true + true + 1 + 0 + false + true + false + 0 + true + true + 0 + 8 + true + false + 1 + true + false + true + *.md, *.MD, Makefile + false + true + true + + + + ProjectExplorer.Project.PluginSettings + + + true + false + true + true + true + true + + false + + + 0 + true + + true + true + Builtin.DefaultTidyAndClazy + 8 + true + + + + true + + 0 + + + + ProjectExplorer.Project.Target.0 + + Desktop + true + Desktop + Desktop + {65a14f9e-e008-4c1b-89df-4eaa4774b6e3} + 0 + 0 + 0 + + /Big/Data/00__Electronics/STM32/F0-nolib/usbcan_ringbuffer + + + + all + + true + GenericProjectManager.GenericMakeStep + + 1 + Build + Build + ProjectExplorer.BuildSteps.Build + + + + + clean + + true + GenericProjectManager.GenericMakeStep + + 1 + Clean + Clean + ProjectExplorer.BuildSteps.Clean + + 2 + false + + false + + Default + GenericProjectManager.GenericBuildConfiguration + 0 + 0 + + + 0 + Deploy + Deploy + ProjectExplorer.BuildSteps.Deploy + + 1 + + false + ProjectExplorer.DefaultDeployConfiguration + + 1 + + true + true + 0 + true + + + 2 + + false + -e cpu-cycles --call-graph dwarf,4096 -F 250 + + ProjectExplorer.CustomExecutableRunConfiguration + + false + + true + true + + 1 + + 1 + + + 0 + Deploy + Deploy + ProjectExplorer.BuildSteps.Deploy + + 1 + + false + ProjectExplorer.DefaultDeployConfiguration + + 1 + + true + true + 0 + true + + + 2 + + false + -e cpu-cycles --call-graph dwarf,4096 -F 250 + + ProjectExplorer.CustomExecutableRunConfiguration + + false + + true + true + + 1 + + + + ProjectExplorer.Project.TargetCount + 1 + + + Version + 22 + + diff --git a/F0:F030,F042,F072/usbcan_gpio/usbcangpio.cxxflags b/F0:F030,F042,F072/usbcan_gpio/usbcangpio.cxxflags new file mode 100644 index 0000000..6435dfc --- /dev/null +++ b/F0:F030,F042,F072/usbcan_gpio/usbcangpio.cxxflags @@ -0,0 +1 @@ +-std=c++17 \ No newline at end of file diff --git a/F0:F030,F042,F072/usbcan_gpio/usbcangpio.files b/F0:F030,F042,F072/usbcan_gpio/usbcangpio.files new file mode 100644 index 0000000..5976930 --- /dev/null +++ b/F0:F030,F042,F072/usbcan_gpio/usbcangpio.files @@ -0,0 +1,26 @@ +can.c +can.h +canproto.c +canproto.h +flash.c +flash.h +gpioproto.c +gpioproto.h +hardware.c +hardware.h +main.c +ringbuffer.c +ringbuffer.h +strfunc.c +strfunc.h +usb.c +usb.h +usb_defs.h +usb_descr.c +usb_descr.h +usb_dev.c +usb_dev.h +usb_lib.c +usb_lib.h +usbhw.c +usbhw.h diff --git a/F0:F030,F042,F072/usbcan_gpio/usbcangpio.includes b/F0:F030,F042,F072/usbcan_gpio/usbcangpio.includes new file mode 100644 index 0000000..06d1130 --- /dev/null +++ b/F0:F030,F042,F072/usbcan_gpio/usbcangpio.includes @@ -0,0 +1,6 @@ +. +../inc +../inc/Fx +../inc/cm +../inc/ld +../inc/startup diff --git a/F0:F030,F042,F072/usbcan_gpio/version.inc b/F0:F030,F042,F072/usbcan_gpio/version.inc new file mode 100644 index 0000000..b49f3d3 --- /dev/null +++ b/F0:F030,F042,F072/usbcan_gpio/version.inc @@ -0,0 +1,2 @@ +#define BUILD_NUMBER "81" +#define BUILD_DATE "2026-03-07" diff --git a/F0:F030,F042,F072/usbcan_ringbuffer/kicad/stm32.kicad_pcb b/F0:F030,F042,F072/usbcan_ringbuffer/kicad/stm32.kicad_pcb index 4c65172..943fbb3 100644 --- a/F0:F030,F042,F072/usbcan_ringbuffer/kicad/stm32.kicad_pcb +++ b/F0:F030,F042,F072/usbcan_ringbuffer/kicad/stm32.kicad_pcb @@ -1,7 +1,7 @@ (kicad_pcb - (version 20240108) + (version 20241229) (generator "pcbnew") - (generator_version "8.0") + (generator_version "9.0") (general (thickness 1.6) (legacy_teardrops no) @@ -9,25 +9,25 @@ (paper "A4") (layers (0 "F.Cu" signal) - (31 "B.Cu" signal) - (32 "B.Adhes" user "B.Adhesive") - (33 "F.Adhes" user "F.Adhesive") - (34 "B.Paste" user) - (35 "F.Paste" user) - (36 "B.SilkS" user "B.Silkscreen") - (37 "F.SilkS" user "F.Silkscreen") - (38 "B.Mask" user) - (39 "F.Mask" user) - (40 "Dwgs.User" user "User.Drawings") - (41 "Cmts.User" user "User.Comments") - (42 "Eco1.User" user "User.Eco1") - (43 "Eco2.User" user "User.Eco2") - (44 "Edge.Cuts" user) - (45 "Margin" user) - (46 "B.CrtYd" user "B.Courtyard") - (47 "F.CrtYd" user "F.Courtyard") - (48 "B.Fab" user) - (49 "F.Fab" user) + (2 "B.Cu" signal) + (9 "F.Adhes" user "F.Adhesive") + (11 "B.Adhes" user "B.Adhesive") + (13 "F.Paste" user) + (15 "B.Paste" user) + (5 "F.SilkS" user "F.Silkscreen") + (7 "B.SilkS" user "B.Silkscreen") + (1 "F.Mask" user) + (3 "B.Mask" user) + (17 "Dwgs.User" user "User.Drawings") + (19 "Cmts.User" user "User.Comments") + (21 "Eco1.User" user "User.Eco1") + (23 "Eco2.User" user "User.Eco2") + (25 "Edge.Cuts" user) + (27 "Margin" user) + (31 "F.CrtYd" user "F.Courtyard") + (29 "B.CrtYd" user "B.Courtyard") + (35 "F.Fab" user) + (33 "B.Fab" user) ) (setup (stackup @@ -75,9 +75,10 @@ ) (pad_to_mask_clearance 0) (allow_soldermask_bridges_in_footprints no) + (tenting front back) (pcbplotparams - (layerselection 0x00010f0_ffffffff) - (plot_on_all_layers_selection 0x0000000_00000000) + (layerselection 0x00000000_00000000_55555555_575555ff) + (plot_on_all_layers_selection 0x00000000_00000000_00000000_00000000) (disableapertmacros no) (usegerberextensions no) (usegerberattributes no) @@ -87,7 +88,6 @@ (dashed_line_gap_ratio 3.000000) (svgprecision 6) (plotframeref no) - (viasonmask no) (mode 1) (useauxorigin no) (hpglpennumber 1) @@ -95,16 +95,19 @@ (hpglpendiameter 15.000000) (pdf_front_fp_property_popups yes) (pdf_back_fp_property_popups yes) + (pdf_metadata yes) + (pdf_single_document no) (dxfpolygonmode yes) (dxfimperialunits yes) (dxfusepcbnewfont yes) (psnegative no) (psa4output no) - (plotreference yes) - (plotvalue yes) - (plotfptext yes) - (plotinvisibletext no) + (plot_black_and_white yes) (sketchpadsonfab no) + (plotpadnumbers no) + (hidednponfab no) + (sketchdnponfab yes) + (crossoutdnponfab yes) (subtractmaskfromsilk no) (outputformat 1) (mirror no) @@ -200,20 +203,8 @@ ) ) ) - (property "Footprint" "Capacitor_Tantalum_SMD:CP_EIA-3216-18_Kemet-A_Pad1.58x1.35mm_HandSolder" - (at 0 0 -90) - (unlocked yes) - (layer "F.Fab") - (hide yes) - (uuid "52648fcb-dfc2-4c35-864c-d659a661397d") - (effects - (font - (size 1.27 1.27) - ) - ) - ) (property "Datasheet" "" - (at 0 0 -90) + (at 0 0 270) (unlocked yes) (layer "F.Fab") (hide yes) @@ -221,11 +212,12 @@ (effects (font (size 1.27 1.27) + (thickness 0.15) ) ) ) (property "Description" "" - (at 0 0 -90) + (at 0 0 270) (unlocked yes) (layer "F.Fab") (hide yes) @@ -233,6 +225,7 @@ (effects (font (size 1.27 1.27) + (thickness 0.15) ) ) ) @@ -373,7 +366,7 @@ (pad "1" smd roundrect (at -1.4375 0 270) (size 1.575 1.35) - (layers "F.Cu" "F.Paste" "F.Mask") + (layers "F.Cu" "F.Mask" "F.Paste") (roundrect_rratio 0.1851851852) (net 2 "+3V3") (pintype "passive") @@ -382,12 +375,13 @@ (pad "2" smd roundrect (at 1.4375 0 270) (size 1.575 1.35) - (layers "F.Cu" "F.Paste" "F.Mask") + (layers "F.Cu" "F.Mask" "F.Paste") (roundrect_rratio 0.1851851852) (net 1 "GND") (pintype "passive") (uuid "4e66ace3-845a-4350-a4dc-3cf15042939c") ) + (embedded_fonts no) (model "${KISYS3DMOD}/Capacitor_Tantalum_SMD.3dshapes/CP_EIA-3216-18_Kemet-A.wrl" (offset (xyz 0 0 0) @@ -428,20 +422,8 @@ ) ) ) - (property "Footprint" "Capacitor_SMD:C_0603_1608Metric_Pad1.05x0.95mm_HandSolder" - (at 0 0 -90) - (unlocked yes) - (layer "F.Fab") - (hide yes) - (uuid "6fde15d6-50aa-49e3-b503-ac0118840692") - (effects - (font - (size 1.27 1.27) - ) - ) - ) (property "Datasheet" "" - (at 0 0 -90) + (at 0 0 270) (unlocked yes) (layer "F.Fab") (hide yes) @@ -449,11 +431,12 @@ (effects (font (size 1.27 1.27) + (thickness 0.15) ) ) ) (property "Description" "" - (at 0 0 -90) + (at 0 0 270) (unlocked yes) (layer "F.Fab") (hide yes) @@ -461,6 +444,7 @@ (effects (font (size 1.27 1.27) + (thickness 0.15) ) ) ) @@ -581,7 +565,7 @@ (pad "1" smd roundrect (at -0.875 0 270) (size 1.05 0.95) - (layers "F.Cu" "F.Paste" "F.Mask") + (layers "F.Cu" "F.Mask" "F.Paste") (roundrect_rratio 0.25) (net 1 "GND") (pintype "passive") @@ -590,12 +574,13 @@ (pad "2" smd roundrect (at 0.875 0 270) (size 1.05 0.95) - (layers "F.Cu" "F.Paste" "F.Mask") + (layers "F.Cu" "F.Mask" "F.Paste") (roundrect_rratio 0.25) (net 2 "+3V3") (pintype "passive") (uuid "4f373549-7811-4ea2-9431-c45e922df953") ) + (embedded_fonts no) (model "${KISYS3DMOD}/Capacitor_SMD.3dshapes/C_0603_1608Metric.wrl" (offset (xyz 0 0 0) @@ -636,18 +621,6 @@ ) ) ) - (property "Footprint" "Capacitor_SMD:C_0603_1608Metric_Pad1.05x0.95mm_HandSolder" - (at 0 0 180) - (unlocked yes) - (layer "F.Fab") - (hide yes) - (uuid "04ca83db-d177-4d12-a176-60820becd1d5") - (effects - (font - (size 1.27 1.27) - ) - ) - ) (property "Datasheet" "" (at 0 0 180) (unlocked yes) @@ -657,6 +630,7 @@ (effects (font (size 1.27 1.27) + (thickness 0.15) ) ) ) @@ -669,6 +643,7 @@ (effects (font (size 1.27 1.27) + (thickness 0.15) ) ) ) @@ -789,7 +764,7 @@ (pad "1" smd roundrect (at -0.875 0 180) (size 1.05 0.95) - (layers "F.Cu" "F.Paste" "F.Mask") + (layers "F.Cu" "F.Mask" "F.Paste") (roundrect_rratio 0.25) (net 1 "GND") (pintype "passive") @@ -798,12 +773,13 @@ (pad "2" smd roundrect (at 0.875 0 180) (size 1.05 0.95) - (layers "F.Cu" "F.Paste" "F.Mask") + (layers "F.Cu" "F.Mask" "F.Paste") (roundrect_rratio 0.25) (net 2 "+3V3") (pintype "passive") (uuid "0b1d8c24-ab95-41d9-83d9-85f98619ccd8") ) + (embedded_fonts no) (model "${KISYS3DMOD}/Capacitor_SMD.3dshapes/C_0603_1608Metric.wrl" (offset (xyz 0 0 0) @@ -844,18 +820,6 @@ ) ) ) - (property "Footprint" "Capacitor_SMD:C_0603_1608Metric_Pad1.05x0.95mm_HandSolder" - (at 0 0 90) - (unlocked yes) - (layer "F.Fab") - (hide yes) - (uuid "c703d7f9-e38b-4e12-8670-16fe3b05bcc2") - (effects - (font - (size 1.27 1.27) - ) - ) - ) (property "Datasheet" "" (at 0 0 90) (unlocked yes) @@ -865,6 +829,7 @@ (effects (font (size 1.27 1.27) + (thickness 0.15) ) ) ) @@ -877,6 +842,7 @@ (effects (font (size 1.27 1.27) + (thickness 0.15) ) ) ) @@ -997,7 +963,7 @@ (pad "1" smd roundrect (at -0.875 0 90) (size 1.05 0.95) - (layers "F.Cu" "F.Paste" "F.Mask") + (layers "F.Cu" "F.Mask" "F.Paste") (roundrect_rratio 0.25) (net 1 "GND") (pintype "passive") @@ -1006,12 +972,13 @@ (pad "2" smd roundrect (at 0.875 0 90) (size 1.05 0.95) - (layers "F.Cu" "F.Paste" "F.Mask") + (layers "F.Cu" "F.Mask" "F.Paste") (roundrect_rratio 0.25) (net 2 "+3V3") (pintype "passive") (uuid "eb41842e-1a01-4343-858f-baeb384f5fb1") ) + (embedded_fonts no) (model "${KISYS3DMOD}/Capacitor_SMD.3dshapes/C_0603_1608Metric.wrl" (offset (xyz 0 0 0) @@ -1052,20 +1019,8 @@ ) ) ) - (property "Footprint" "Capacitor_SMD:C_0603_1608Metric_Pad1.05x0.95mm_HandSolder" - (at 0 0 -90) - (unlocked yes) - (layer "F.Fab") - (hide yes) - (uuid "5dd36378-4819-4027-93ef-580f0779ced7") - (effects - (font - (size 1.27 1.27) - ) - ) - ) (property "Datasheet" "" - (at 0 0 -90) + (at 0 0 270) (unlocked yes) (layer "F.Fab") (hide yes) @@ -1073,11 +1028,12 @@ (effects (font (size 1.27 1.27) + (thickness 0.15) ) ) ) (property "Description" "" - (at 0 0 -90) + (at 0 0 270) (unlocked yes) (layer "F.Fab") (hide yes) @@ -1085,6 +1041,7 @@ (effects (font (size 1.27 1.27) + (thickness 0.15) ) ) ) @@ -1205,7 +1162,7 @@ (pad "1" smd roundrect (at -0.875 0 270) (size 1.05 0.95) - (layers "F.Cu" "F.Paste" "F.Mask") + (layers "F.Cu" "F.Mask" "F.Paste") (roundrect_rratio 0.25) (net 1 "GND") (pintype "passive") @@ -1214,12 +1171,13 @@ (pad "2" smd roundrect (at 0.875 0 270) (size 1.05 0.95) - (layers "F.Cu" "F.Paste" "F.Mask") + (layers "F.Cu" "F.Mask" "F.Paste") (roundrect_rratio 0.25) (net 2 "+3V3") (pintype "passive") (uuid "0c456f89-dc75-4bdb-9c3a-81335f4ea86b") ) + (embedded_fonts no) (model "${KISYS3DMOD}/Capacitor_SMD.3dshapes/C_0603_1608Metric.wrl" (offset (xyz 0 0 0) @@ -1260,18 +1218,6 @@ ) ) ) - (property "Footprint" "TO_SOT_Packages_SMD:SOT-23" - (at 0 0 180) - (unlocked yes) - (layer "F.Fab") - (hide yes) - (uuid "a13e0b31-1a72-4dcc-a57a-b0a699feedc6") - (effects - (font - (size 1.27 1.27) - ) - ) - ) (property "Datasheet" "" (at 0 0 180) (unlocked yes) @@ -1281,6 +1227,7 @@ (effects (font (size 1.27 1.27) + (thickness 0.15) ) ) ) @@ -1293,6 +1240,7 @@ (effects (font (size 1.27 1.27) + (thickness 0.15) ) ) ) @@ -1443,7 +1391,7 @@ (pad "1" smd rect (at -1 -0.95 180) (size 0.9 0.8) - (layers "F.Cu" "F.Paste" "F.Mask") + (layers "F.Cu" "F.Mask" "F.Paste") (net 11 "/CANL") (pinfunction "K") (pintype "passive") @@ -1452,7 +1400,7 @@ (pad "2" smd rect (at -1 0.95 180) (size 0.9 0.8) - (layers "F.Cu" "F.Paste" "F.Mask") + (layers "F.Cu" "F.Mask" "F.Paste") (net 12 "/CANH") (pinfunction "K") (pintype "passive") @@ -1461,12 +1409,13 @@ (pad "3" smd rect (at 1 0 180) (size 0.9 0.8) - (layers "F.Cu" "F.Paste" "F.Mask") + (layers "F.Cu" "F.Mask" "F.Paste") (net 21 "Earth") (pinfunction "O") (pintype "passive") (uuid "797a5e92-dbce-49e3-b8f5-d3387d2e1e15") ) + (embedded_fonts no) (model "${KISYS3DMOD}/Package_TO_SOT_SMD.3dshapes/SOT-23.wrl" (offset (xyz 0 0 0) @@ -1507,18 +1456,6 @@ ) ) ) - (property "Footprint" "my_footprints:Hole_3mm" - (at 0 0 0) - (unlocked yes) - (layer "F.Fab") - (hide yes) - (uuid "10cb92b8-789b-4a0a-8588-246a5c8d093d") - (effects - (font - (size 1.27 1.27) - ) - ) - ) (property "Datasheet" "" (at 0 0 0) (unlocked yes) @@ -1528,6 +1465,7 @@ (effects (font (size 1.27 1.27) + (thickness 0.15) ) ) ) @@ -1540,6 +1478,7 @@ (effects (font (size 1.27 1.27) + (thickness 0.15) ) ) ) @@ -1557,6 +1496,7 @@ (pintype "passive+no_connect") (uuid "67827316-1e98-45bb-aef4-a69f9ac83532") ) + (embedded_fonts no) ) (footprint "my_footprints:Hole_3mm" (layer "F.Cu") @@ -1586,18 +1526,6 @@ ) ) ) - (property "Footprint" "my_footprints:Hole_3mm" - (at 0 0 0) - (unlocked yes) - (layer "F.Fab") - (hide yes) - (uuid "a4335e53-655e-4831-bf4f-992eeeac1cb7") - (effects - (font - (size 1.27 1.27) - ) - ) - ) (property "Datasheet" "" (at 0 0 0) (unlocked yes) @@ -1607,6 +1535,7 @@ (effects (font (size 1.27 1.27) + (thickness 0.15) ) ) ) @@ -1619,6 +1548,7 @@ (effects (font (size 1.27 1.27) + (thickness 0.15) ) ) ) @@ -1636,6 +1566,7 @@ (pintype "passive+no_connect") (uuid "3ee56326-aed8-4ff5-b6b4-a8138eec7301") ) + (embedded_fonts no) ) (footprint "my_footprints:Hole_3mm" (layer "F.Cu") @@ -1665,18 +1596,6 @@ ) ) ) - (property "Footprint" "my_footprints:Hole_3mm" - (at 0 0 0) - (unlocked yes) - (layer "F.Fab") - (hide yes) - (uuid "d5c1a8fa-fd64-4111-82fb-dc37245620a6") - (effects - (font - (size 1.27 1.27) - ) - ) - ) (property "Datasheet" "" (at 0 0 0) (unlocked yes) @@ -1686,6 +1605,7 @@ (effects (font (size 1.27 1.27) + (thickness 0.15) ) ) ) @@ -1698,6 +1618,7 @@ (effects (font (size 1.27 1.27) + (thickness 0.15) ) ) ) @@ -1715,6 +1636,7 @@ (pintype "passive+no_connect") (uuid "fa68c0ec-c340-455a-8859-1a35b51f668b") ) + (embedded_fonts no) ) (footprint "my_footprints:Hole_3mm" (layer "F.Cu") @@ -1744,18 +1666,6 @@ ) ) ) - (property "Footprint" "my_footprints:Hole_3mm" - (at 0 0 0) - (unlocked yes) - (layer "F.Fab") - (hide yes) - (uuid "98fd2932-526a-4aa0-8384-7678f0e63595") - (effects - (font - (size 1.27 1.27) - ) - ) - ) (property "Datasheet" "" (at 0 0 0) (unlocked yes) @@ -1765,6 +1675,7 @@ (effects (font (size 1.27 1.27) + (thickness 0.15) ) ) ) @@ -1777,6 +1688,7 @@ (effects (font (size 1.27 1.27) + (thickness 0.15) ) ) ) @@ -1794,6 +1706,7 @@ (pintype "passive+no_connect") (uuid "2aab595b-f4e2-4d30-b462-8014ef9f52a3") ) + (embedded_fonts no) ) (footprint "Resistor_SMD:R_0603_1608Metric_Pad1.05x0.95mm_HandSolder" (layer "F.Cu") @@ -1823,18 +1736,6 @@ ) ) ) - (property "Footprint" "Resistor_SMD:R_0603_1608Metric_Pad1.05x0.95mm_HandSolder" - (at 0 0 180) - (unlocked yes) - (layer "F.Fab") - (hide yes) - (uuid "b94ac635-2b87-437b-bd06-addb19ed868e") - (effects - (font - (size 1.27 1.27) - ) - ) - ) (property "Datasheet" "" (at 0 0 180) (unlocked yes) @@ -1844,6 +1745,7 @@ (effects (font (size 1.27 1.27) + (thickness 0.15) ) ) ) @@ -1856,6 +1758,7 @@ (effects (font (size 1.27 1.27) + (thickness 0.15) ) ) ) @@ -1976,7 +1879,7 @@ (pad "1" smd roundrect (at -0.875 0 180) (size 1.05 0.95) - (layers "F.Cu" "F.Paste" "F.Mask") + (layers "F.Cu" "F.Mask" "F.Paste") (roundrect_rratio 0.25) (net 35 "Net-(J4-Pad2)") (pintype "passive") @@ -1985,12 +1888,13 @@ (pad "2" smd roundrect (at 0.875 0 180) (size 1.05 0.95) - (layers "F.Cu" "F.Paste" "F.Mask") + (layers "F.Cu" "F.Mask" "F.Paste") (roundrect_rratio 0.25) (net 37 "Net-(R3-Pad2)") (pintype "passive") (uuid "d49a2c43-e71f-4bce-9983-9416560f88f7") ) + (embedded_fonts no) (model "${KISYS3DMOD}/Resistor_SMD.3dshapes/R_0603_1608Metric.wrl" (offset (xyz 0 0 0) @@ -2031,18 +1935,6 @@ ) ) ) - (property "Footprint" "Resistor_SMD:R_0603_1608Metric_Pad1.05x0.95mm_HandSolder" - (at 0 0 180) - (unlocked yes) - (layer "F.Fab") - (hide yes) - (uuid "ab963168-dcf0-45c3-aaa1-e2bf028f9d0b") - (effects - (font - (size 1.27 1.27) - ) - ) - ) (property "Datasheet" "" (at 0 0 180) (unlocked yes) @@ -2052,6 +1944,7 @@ (effects (font (size 1.27 1.27) + (thickness 0.15) ) ) ) @@ -2064,6 +1957,7 @@ (effects (font (size 1.27 1.27) + (thickness 0.15) ) ) ) @@ -2184,7 +2078,7 @@ (pad "1" smd roundrect (at -0.875 0 180) (size 1.05 0.95) - (layers "F.Cu" "F.Paste" "F.Mask") + (layers "F.Cu" "F.Mask" "F.Paste") (roundrect_rratio 0.25) (net 36 "Net-(J4-Pad3)") (pintype "passive") @@ -2193,12 +2087,13 @@ (pad "2" smd roundrect (at 0.875 0 180) (size 1.05 0.95) - (layers "F.Cu" "F.Paste" "F.Mask") + (layers "F.Cu" "F.Mask" "F.Paste") (roundrect_rratio 0.25) (net 38 "Net-(R4-Pad2)") (pintype "passive") (uuid "6ec4ad7e-2ece-4d8c-8432-328b36ddf027") ) + (embedded_fonts no) (model "${KISYS3DMOD}/Resistor_SMD.3dshapes/R_0603_1608Metric.wrl" (offset (xyz 0 0 0) @@ -2239,18 +2134,6 @@ ) ) ) - (property "Footprint" "Resistor_SMD:R_0603_1608Metric_Pad1.05x0.95mm_HandSolder" - (at 0 0 180) - (unlocked yes) - (layer "F.Fab") - (hide yes) - (uuid "e941adf9-5039-4c90-8f8c-e7695eac039a") - (effects - (font - (size 1.27 1.27) - ) - ) - ) (property "Datasheet" "" (at 0 0 180) (unlocked yes) @@ -2260,6 +2143,7 @@ (effects (font (size 1.27 1.27) + (thickness 0.15) ) ) ) @@ -2272,6 +2156,7 @@ (effects (font (size 1.27 1.27) + (thickness 0.15) ) ) ) @@ -2392,7 +2277,7 @@ (pad "1" smd roundrect (at -0.875 0 180) (size 1.05 0.95) - (layers "F.Cu" "F.Paste" "F.Mask") + (layers "F.Cu" "F.Mask" "F.Paste") (roundrect_rratio 0.25) (net 1 "GND") (pintype "passive") @@ -2401,12 +2286,13 @@ (pad "2" smd roundrect (at 0.875 0 180) (size 1.05 0.95) - (layers "F.Cu" "F.Paste" "F.Mask") + (layers "F.Cu" "F.Mask" "F.Paste") (roundrect_rratio 0.25) (net 5 "/BOOT0") (pintype "passive") (uuid "c14493c3-c66d-4298-b0aa-568ee9272f41") ) + (embedded_fonts no) (model "${KISYS3DMOD}/Resistor_SMD.3dshapes/R_0603_1608Metric.wrl" (offset (xyz 0 0 0) @@ -2447,18 +2333,6 @@ ) ) ) - (property "Footprint" "Resistor_SMD:R_0603_1608Metric_Pad1.05x0.95mm_HandSolder" - (at 0 0 90) - (unlocked yes) - (layer "F.Fab") - (hide yes) - (uuid "51261897-70ad-4e43-852d-3f81d7e21a17") - (effects - (font - (size 1.27 1.27) - ) - ) - ) (property "Datasheet" "" (at 0 0 90) (unlocked yes) @@ -2468,6 +2342,7 @@ (effects (font (size 1.27 1.27) + (thickness 0.15) ) ) ) @@ -2480,6 +2355,7 @@ (effects (font (size 1.27 1.27) + (thickness 0.15) ) ) ) @@ -2600,7 +2476,7 @@ (pad "1" smd roundrect (at -0.875 0 90) (size 1.05 0.95) - (layers "F.Cu" "F.Paste" "F.Mask") + (layers "F.Cu" "F.Mask" "F.Paste") (roundrect_rratio 0.25) (net 2 "+3V3") (pintype "passive") @@ -2609,12 +2485,13 @@ (pad "2" smd roundrect (at 0.875 0 90) (size 1.05 0.95) - (layers "F.Cu" "F.Paste" "F.Mask") + (layers "F.Cu" "F.Mask" "F.Paste") (roundrect_rratio 0.25) (net 24 "Net-(J3-Pad4)") (pintype "passive") (uuid "de42b3ac-8694-419a-b66a-a0e7729267ba") ) + (embedded_fonts no) (model "${KISYS3DMOD}/Resistor_SMD.3dshapes/R_0603_1608Metric.wrl" (offset (xyz 0 0 0) @@ -2655,18 +2532,6 @@ ) ) ) - (property "Footprint" "Package_QFP:LQFP-48_7x7mm_P0.5mm" - (at 0 0 0) - (unlocked yes) - (layer "F.Fab") - (hide yes) - (uuid "a2e89889-e037-40cb-b2b0-b9a1bc275119") - (effects - (font - (size 1.27 1.27) - ) - ) - ) (property "Datasheet" "" (at 0 0 0) (unlocked yes) @@ -2676,6 +2541,7 @@ (effects (font (size 1.27 1.27) + (thickness 0.15) ) ) ) @@ -2688,6 +2554,7 @@ (effects (font (size 1.27 1.27) + (thickness 0.15) ) ) ) @@ -3088,7 +2955,7 @@ (pad "1" smd roundrect (at -4.1625 -2.75) (size 1.475 0.3) - (layers "F.Cu" "F.Paste" "F.Mask") + (layers "F.Cu" "F.Mask" "F.Paste") (roundrect_rratio 0.25) (net 2 "+3V3") (pinfunction "VBAT") @@ -3098,7 +2965,7 @@ (pad "2" smd roundrect (at -4.1625 -2.25) (size 1.475 0.3) - (layers "F.Cu" "F.Paste" "F.Mask") + (layers "F.Cu" "F.Mask" "F.Paste") (roundrect_rratio 0.25) (net 25 "unconnected-(U3-Pad2)") (pinfunction "PC13") @@ -3108,7 +2975,7 @@ (pad "3" smd roundrect (at -4.1625 -1.75) (size 1.475 0.3) - (layers "F.Cu" "F.Paste" "F.Mask") + (layers "F.Cu" "F.Mask" "F.Paste") (roundrect_rratio 0.25) (net 26 "unconnected-(U3-Pad3)") (pinfunction "PC14") @@ -3118,7 +2985,7 @@ (pad "4" smd roundrect (at -4.1625 -1.25) (size 1.475 0.3) - (layers "F.Cu" "F.Paste" "F.Mask") + (layers "F.Cu" "F.Mask" "F.Paste") (roundrect_rratio 0.25) (net 27 "unconnected-(U3-Pad4)") (pinfunction "PC15") @@ -3128,7 +2995,7 @@ (pad "5" smd roundrect (at -4.1625 -0.75) (size 1.475 0.3) - (layers "F.Cu" "F.Paste" "F.Mask") + (layers "F.Cu" "F.Mask" "F.Paste") (roundrect_rratio 0.25) (net 28 "unconnected-(U3-Pad5)") (pinfunction "PF0") @@ -3138,7 +3005,7 @@ (pad "6" smd roundrect (at -4.1625 -0.25) (size 1.475 0.3) - (layers "F.Cu" "F.Paste" "F.Mask") + (layers "F.Cu" "F.Mask" "F.Paste") (roundrect_rratio 0.25) (net 29 "unconnected-(U3-Pad6)") (pinfunction "PF1") @@ -3148,7 +3015,7 @@ (pad "7" smd roundrect (at -4.1625 0.25) (size 1.475 0.3) - (layers "F.Cu" "F.Paste" "F.Mask") + (layers "F.Cu" "F.Mask" "F.Paste") (roundrect_rratio 0.25) (net 4 "/NRST") (pinfunction "NRST") @@ -3158,7 +3025,7 @@ (pad "8" smd roundrect (at -4.1625 0.75) (size 1.475 0.3) - (layers "F.Cu" "F.Paste" "F.Mask") + (layers "F.Cu" "F.Mask" "F.Paste") (roundrect_rratio 0.25) (net 1 "GND") (pinfunction "VSSA") @@ -3168,7 +3035,7 @@ (pad "9" smd roundrect (at -4.1625 1.25) (size 1.475 0.3) - (layers "F.Cu" "F.Paste" "F.Mask") + (layers "F.Cu" "F.Mask" "F.Paste") (roundrect_rratio 0.25) (net 2 "+3V3") (pinfunction "VDDA") @@ -3178,7 +3045,7 @@ (pad "10" smd roundrect (at -4.1625 1.75) (size 1.475 0.3) - (layers "F.Cu" "F.Paste" "F.Mask") + (layers "F.Cu" "F.Mask" "F.Paste") (roundrect_rratio 0.25) (net 51 "Net-(J21-Pad1)") (pinfunction "PA0") @@ -3188,7 +3055,7 @@ (pad "11" smd roundrect (at -4.1625 2.25) (size 1.475 0.3) - (layers "F.Cu" "F.Paste" "F.Mask") + (layers "F.Cu" "F.Mask" "F.Paste") (roundrect_rratio 0.25) (net 52 "Net-(J22-Pad1)") (pinfunction "PA1") @@ -3198,7 +3065,7 @@ (pad "12" smd roundrect (at -4.1625 2.75) (size 1.475 0.3) - (layers "F.Cu" "F.Paste" "F.Mask") + (layers "F.Cu" "F.Mask" "F.Paste") (roundrect_rratio 0.25) (net 53 "Net-(J23-Pad1)") (pinfunction "PA2") @@ -3208,7 +3075,7 @@ (pad "13" smd roundrect (at -2.75 4.1625) (size 0.3 1.475) - (layers "F.Cu" "F.Paste" "F.Mask") + (layers "F.Cu" "F.Mask" "F.Paste") (roundrect_rratio 0.25) (net 54 "Net-(J24-Pad1)") (pinfunction "PA3") @@ -3218,7 +3085,7 @@ (pad "14" smd roundrect (at -2.25 4.1625) (size 0.3 1.475) - (layers "F.Cu" "F.Paste" "F.Mask") + (layers "F.Cu" "F.Mask" "F.Paste") (roundrect_rratio 0.25) (net 30 "unconnected-(U3-Pad14)") (pinfunction "PA4") @@ -3228,7 +3095,7 @@ (pad "15" smd roundrect (at -1.75 4.1625) (size 0.3 1.475) - (layers "F.Cu" "F.Paste" "F.Mask") + (layers "F.Cu" "F.Mask" "F.Paste") (roundrect_rratio 0.25) (net 23 "Net-(J2-Pad1)") (pinfunction "PA5") @@ -3238,7 +3105,7 @@ (pad "16" smd roundrect (at -1.25 4.1625) (size 0.3 1.475) - (layers "F.Cu" "F.Paste" "F.Mask") + (layers "F.Cu" "F.Mask" "F.Paste") (roundrect_rratio 0.25) (net 39 "Net-(J5-Pad1)") (pinfunction "PA6") @@ -3248,7 +3115,7 @@ (pad "17" smd roundrect (at -0.75 4.1625) (size 0.3 1.475) - (layers "F.Cu" "F.Paste" "F.Mask") + (layers "F.Cu" "F.Mask" "F.Paste") (roundrect_rratio 0.25) (net 40 "Net-(J6-Pad1)") (pinfunction "PA7") @@ -3258,7 +3125,7 @@ (pad "18" smd roundrect (at -0.25 4.1625) (size 0.3 1.475) - (layers "F.Cu" "F.Paste" "F.Mask") + (layers "F.Cu" "F.Mask" "F.Paste") (roundrect_rratio 0.25) (net 45 "Net-(J11-Pad1)") (pinfunction "PB0") @@ -3268,7 +3135,7 @@ (pad "19" smd roundrect (at 0.25 4.1625) (size 0.3 1.475) - (layers "F.Cu" "F.Paste" "F.Mask") + (layers "F.Cu" "F.Mask" "F.Paste") (roundrect_rratio 0.25) (net 46 "Net-(J12-Pad1)") (pinfunction "PB1") @@ -3278,7 +3145,7 @@ (pad "20" smd roundrect (at 0.75 4.1625) (size 0.3 1.475) - (layers "F.Cu" "F.Paste" "F.Mask") + (layers "F.Cu" "F.Mask" "F.Paste") (roundrect_rratio 0.25) (net 49 "Net-(J15-Pad1)") (pinfunction "PB2") @@ -3288,7 +3155,7 @@ (pad "21" smd roundrect (at 1.25 4.1625) (size 0.3 1.475) - (layers "F.Cu" "F.Paste" "F.Mask") + (layers "F.Cu" "F.Mask" "F.Paste") (roundrect_rratio 0.25) (net 55 "Net-(J25-Pad1)") (pinfunction "PB10") @@ -3298,7 +3165,7 @@ (pad "22" smd roundrect (at 1.75 4.1625) (size 0.3 1.475) - (layers "F.Cu" "F.Paste" "F.Mask") + (layers "F.Cu" "F.Mask" "F.Paste") (roundrect_rratio 0.25) (net 56 "Net-(J26-Pad1)") (pinfunction "PB11") @@ -3308,7 +3175,7 @@ (pad "23" smd roundrect (at 2.25 4.1625) (size 0.3 1.475) - (layers "F.Cu" "F.Paste" "F.Mask") + (layers "F.Cu" "F.Mask" "F.Paste") (roundrect_rratio 0.25) (net 1 "GND") (pinfunction "VSS") @@ -3318,7 +3185,7 @@ (pad "24" smd roundrect (at 2.75 4.1625) (size 0.3 1.475) - (layers "F.Cu" "F.Paste" "F.Mask") + (layers "F.Cu" "F.Mask" "F.Paste") (roundrect_rratio 0.25) (net 2 "+3V3") (pinfunction "VDD") @@ -3328,7 +3195,7 @@ (pad "25" smd roundrect (at 4.1625 2.75) (size 1.475 0.3) - (layers "F.Cu" "F.Paste" "F.Mask") + (layers "F.Cu" "F.Mask" "F.Paste") (roundrect_rratio 0.25) (net 31 "unconnected-(U3-Pad25)") (pinfunction "PB12") @@ -3338,7 +3205,7 @@ (pad "26" smd roundrect (at 4.1625 2.25) (size 1.475 0.3) - (layers "F.Cu" "F.Paste" "F.Mask") + (layers "F.Cu" "F.Mask" "F.Paste") (roundrect_rratio 0.25) (net 32 "unconnected-(U3-Pad26)") (pinfunction "PB13") @@ -3348,7 +3215,7 @@ (pad "27" smd roundrect (at 4.1625 1.75) (size 1.475 0.3) - (layers "F.Cu" "F.Paste" "F.Mask") + (layers "F.Cu" "F.Mask" "F.Paste") (roundrect_rratio 0.25) (net 33 "unconnected-(U3-Pad27)") (pinfunction "PB14") @@ -3358,7 +3225,7 @@ (pad "28" smd roundrect (at 4.1625 1.25) (size 1.475 0.3) - (layers "F.Cu" "F.Paste" "F.Mask") + (layers "F.Cu" "F.Mask" "F.Paste") (roundrect_rratio 0.25) (net 7 "/LED0") (pinfunction "PB15") @@ -3368,7 +3235,7 @@ (pad "29" smd roundrect (at 4.1625 0.75) (size 1.475 0.3) - (layers "F.Cu" "F.Paste" "F.Mask") + (layers "F.Cu" "F.Mask" "F.Paste") (roundrect_rratio 0.25) (net 8 "/LED1") (pinfunction "PA8") @@ -3378,7 +3245,7 @@ (pad "30" smd roundrect (at 4.1625 0.25) (size 1.475 0.3) - (layers "F.Cu" "F.Paste" "F.Mask") + (layers "F.Cu" "F.Mask" "F.Paste") (roundrect_rratio 0.25) (net 41 "Net-(J7-Pad1)") (pinfunction "PA9") @@ -3388,7 +3255,7 @@ (pad "31" smd roundrect (at 4.1625 -0.25) (size 1.475 0.3) - (layers "F.Cu" "F.Paste" "F.Mask") + (layers "F.Cu" "F.Mask" "F.Paste") (roundrect_rratio 0.25) (net 42 "Net-(J8-Pad1)") (pinfunction "PA10") @@ -3398,7 +3265,7 @@ (pad "32" smd roundrect (at 4.1625 -0.75) (size 1.475 0.3) - (layers "F.Cu" "F.Paste" "F.Mask") + (layers "F.Cu" "F.Mask" "F.Paste") (roundrect_rratio 0.25) (net 58 "Net-(U2-Pad3)") (pinfunction "PA11") @@ -3408,7 +3275,7 @@ (pad "33" smd roundrect (at 4.1625 -1.25) (size 1.475 0.3) - (layers "F.Cu" "F.Paste" "F.Mask") + (layers "F.Cu" "F.Mask" "F.Paste") (roundrect_rratio 0.25) (net 57 "Net-(U2-Pad1)") (pinfunction "PA12") @@ -3418,7 +3285,7 @@ (pad "34" smd roundrect (at 4.1625 -1.75) (size 1.475 0.3) - (layers "F.Cu" "F.Paste" "F.Mask") + (layers "F.Cu" "F.Mask" "F.Paste") (roundrect_rratio 0.25) (net 14 "/SWDIO") (pinfunction "PA13") @@ -3428,7 +3295,7 @@ (pad "35" smd roundrect (at 4.1625 -2.25) (size 1.475 0.3) - (layers "F.Cu" "F.Paste" "F.Mask") + (layers "F.Cu" "F.Mask" "F.Paste") (roundrect_rratio 0.25) (net 1 "GND") (pinfunction "VSS") @@ -3438,7 +3305,7 @@ (pad "36" smd roundrect (at 4.1625 -2.75) (size 1.475 0.3) - (layers "F.Cu" "F.Paste" "F.Mask") + (layers "F.Cu" "F.Mask" "F.Paste") (roundrect_rratio 0.25) (net 2 "+3V3") (pinfunction "VDDIO2") @@ -3448,7 +3315,7 @@ (pad "37" smd roundrect (at 2.75 -4.1625) (size 0.3 1.475) - (layers "F.Cu" "F.Paste" "F.Mask") + (layers "F.Cu" "F.Mask" "F.Paste") (roundrect_rratio 0.25) (net 15 "/SWCLK") (pinfunction "PA14") @@ -3458,7 +3325,7 @@ (pad "38" smd roundrect (at 2.25 -4.1625) (size 0.3 1.475) - (layers "F.Cu" "F.Paste" "F.Mask") + (layers "F.Cu" "F.Mask" "F.Paste") (roundrect_rratio 0.25) (net 34 "unconnected-(U3-Pad38)") (pinfunction "PA15") @@ -3468,7 +3335,7 @@ (pad "39" smd roundrect (at 1.75 -4.1625) (size 0.3 1.475) - (layers "F.Cu" "F.Paste" "F.Mask") + (layers "F.Cu" "F.Mask" "F.Paste") (roundrect_rratio 0.25) (net 50 "Net-(J16-Pad1)") (pinfunction "PB3") @@ -3478,7 +3345,7 @@ (pad "40" smd roundrect (at 1.25 -4.1625) (size 0.3 1.475) - (layers "F.Cu" "F.Paste" "F.Mask") + (layers "F.Cu" "F.Mask" "F.Paste") (roundrect_rratio 0.25) (net 47 "Net-(J13-Pad1)") (pinfunction "PB4") @@ -3488,7 +3355,7 @@ (pad "41" smd roundrect (at 0.75 -4.1625) (size 0.3 1.475) - (layers "F.Cu" "F.Paste" "F.Mask") + (layers "F.Cu" "F.Mask" "F.Paste") (roundrect_rratio 0.25) (net 48 "Net-(J14-Pad1)") (pinfunction "PB5") @@ -3498,7 +3365,7 @@ (pad "42" smd roundrect (at 0.25 -4.1625) (size 0.3 1.475) - (layers "F.Cu" "F.Paste" "F.Mask") + (layers "F.Cu" "F.Mask" "F.Paste") (roundrect_rratio 0.25) (net 43 "Net-(J9-Pad1)") (pinfunction "PB6") @@ -3508,7 +3375,7 @@ (pad "43" smd roundrect (at -0.25 -4.1625) (size 0.3 1.475) - (layers "F.Cu" "F.Paste" "F.Mask") + (layers "F.Cu" "F.Mask" "F.Paste") (roundrect_rratio 0.25) (net 44 "Net-(J10-Pad1)") (pinfunction "PB7") @@ -3518,7 +3385,7 @@ (pad "44" smd roundrect (at -0.75 -4.1625) (size 0.3 1.475) - (layers "F.Cu" "F.Paste" "F.Mask") + (layers "F.Cu" "F.Mask" "F.Paste") (roundrect_rratio 0.25) (net 5 "/BOOT0") (pinfunction "BOOT0") @@ -3528,7 +3395,7 @@ (pad "45" smd roundrect (at -1.25 -4.1625) (size 0.3 1.475) - (layers "F.Cu" "F.Paste" "F.Mask") + (layers "F.Cu" "F.Mask" "F.Paste") (roundrect_rratio 0.25) (net 10 "/CAN_Rx") (pinfunction "PB8") @@ -3538,7 +3405,7 @@ (pad "46" smd roundrect (at -1.75 -4.1625) (size 0.3 1.475) - (layers "F.Cu" "F.Paste" "F.Mask") + (layers "F.Cu" "F.Mask" "F.Paste") (roundrect_rratio 0.25) (net 9 "/CAN_Tx") (pinfunction "PB9") @@ -3548,7 +3415,7 @@ (pad "47" smd roundrect (at -2.25 -4.1625) (size 0.3 1.475) - (layers "F.Cu" "F.Paste" "F.Mask") + (layers "F.Cu" "F.Mask" "F.Paste") (roundrect_rratio 0.25) (net 1 "GND") (pinfunction "VSS") @@ -3558,13 +3425,14 @@ (pad "48" smd roundrect (at -2.75 -4.1625) (size 0.3 1.475) - (layers "F.Cu" "F.Paste" "F.Mask") + (layers "F.Cu" "F.Mask" "F.Paste") (roundrect_rratio 0.25) (net 2 "+3V3") (pinfunction "VDD") (pintype "power_in") (uuid "17569b5c-ab61-4dff-af4c-d24cf26a779a") ) + (embedded_fonts no) (model "${KISYS3DMOD}/Package_QFP.3dshapes/LQFP-48_7x7mm_P0.5mm.wrl" (offset (xyz 0 0 0) @@ -3605,18 +3473,6 @@ ) ) ) - (property "Footprint" "Capacitor_SMD:C_0603_1608Metric_Pad1.05x0.95mm_HandSolder" - (at 0 0 0) - (unlocked yes) - (layer "F.Fab") - (hide yes) - (uuid "4b7410d6-6fc4-4d93-bea5-cf2aacd95176") - (effects - (font - (size 1.27 1.27) - ) - ) - ) (property "Datasheet" "" (at 0 0 0) (unlocked yes) @@ -3626,6 +3482,7 @@ (effects (font (size 1.27 1.27) + (thickness 0.15) ) ) ) @@ -3638,6 +3495,7 @@ (effects (font (size 1.27 1.27) + (thickness 0.15) ) ) ) @@ -3758,7 +3616,7 @@ (pad "1" smd roundrect (at -0.875 0) (size 1.05 0.95) - (layers "F.Cu" "F.Paste" "F.Mask") + (layers "F.Cu" "F.Mask" "F.Paste") (roundrect_rratio 0.25) (net 3 "+5V") (pintype "passive") @@ -3767,12 +3625,13 @@ (pad "2" smd roundrect (at 0.875 0) (size 1.05 0.95) - (layers "F.Cu" "F.Paste" "F.Mask") + (layers "F.Cu" "F.Mask" "F.Paste") (roundrect_rratio 0.25) (net 1 "GND") (pintype "passive") (uuid "ac4dd1c3-0ecd-49ee-9a0f-58d463a25519") ) + (embedded_fonts no) (model "${KISYS3DMOD}/Capacitor_SMD.3dshapes/C_0603_1608Metric.wrl" (offset (xyz 0 0 0) @@ -3813,18 +3672,6 @@ ) ) ) - (property "Footprint" "Capacitor_SMD:C_0805_2012Metric_Pad1.15x1.40mm_HandSolder" - (at 0 0 0) - (unlocked yes) - (layer "F.Fab") - (hide yes) - (uuid "e688f0aa-5728-4d3f-806e-7c8d45e8305f") - (effects - (font - (size 1.27 1.27) - ) - ) - ) (property "Datasheet" "" (at 0 0 0) (unlocked yes) @@ -3834,6 +3681,7 @@ (effects (font (size 1.27 1.27) + (thickness 0.15) ) ) ) @@ -3846,6 +3694,7 @@ (effects (font (size 1.27 1.27) + (thickness 0.15) ) ) ) @@ -3966,7 +3815,7 @@ (pad "1" smd roundrect (at -1.025 0) (size 1.15 1.4) - (layers "F.Cu" "F.Paste" "F.Mask") + (layers "F.Cu" "F.Mask" "F.Paste") (roundrect_rratio 0.2173913043) (net 3 "+5V") (pintype "passive") @@ -3975,12 +3824,13 @@ (pad "2" smd roundrect (at 1.025 0) (size 1.15 1.4) - (layers "F.Cu" "F.Paste" "F.Mask") + (layers "F.Cu" "F.Mask" "F.Paste") (roundrect_rratio 0.2173913043) (net 1 "GND") (pintype "passive") (uuid "a89649c3-9ca0-4b6a-a3e5-60aa4c6c5944") ) + (embedded_fonts no) (model "${KISYS3DMOD}/Capacitor_SMD.3dshapes/C_0805_2012Metric.wrl" (offset (xyz 0 0 0) @@ -4021,18 +3871,6 @@ ) ) ) - (property "Footprint" "Capacitor_SMD:C_0805_2012Metric_Pad1.15x1.40mm_HandSolder" - (at 0 0 0) - (unlocked yes) - (layer "F.Fab") - (hide yes) - (uuid "1456ffd7-90f0-4a17-9a8c-7286ce3f6ee3") - (effects - (font - (size 1.27 1.27) - ) - ) - ) (property "Datasheet" "" (at 0 0 0) (unlocked yes) @@ -4042,6 +3880,7 @@ (effects (font (size 1.27 1.27) + (thickness 0.15) ) ) ) @@ -4054,6 +3893,7 @@ (effects (font (size 1.27 1.27) + (thickness 0.15) ) ) ) @@ -4174,7 +4014,7 @@ (pad "1" smd roundrect (at -1.025 0) (size 1.15 1.4) - (layers "F.Cu" "F.Paste" "F.Mask") + (layers "F.Cu" "F.Mask" "F.Paste") (roundrect_rratio 0.2173913043) (net 20 "Net-(C9-Pad1)") (pintype "passive") @@ -4183,12 +4023,13 @@ (pad "2" smd roundrect (at 1.025 0) (size 1.15 1.4) - (layers "F.Cu" "F.Paste" "F.Mask") + (layers "F.Cu" "F.Mask" "F.Paste") (roundrect_rratio 0.2173913043) (net 21 "Earth") (pintype "passive") (uuid "36f13f0c-b945-4e09-bfe0-40e6e59b4336") ) + (embedded_fonts no) (model "${KISYS3DMOD}/Capacitor_SMD.3dshapes/C_0805_2012Metric.wrl" (offset (xyz 0 0 0) @@ -4229,20 +4070,8 @@ ) ) ) - (property "Footprint" "Resistor_SMD:R_1210_3225Metric_Pad1.42x2.65mm_HandSolder" - (at 0 0 -90) - (unlocked yes) - (layer "F.Fab") - (hide yes) - (uuid "81188053-e1ca-492a-b0e7-668fa2b78e5e") - (effects - (font - (size 1.27 1.27) - ) - ) - ) (property "Datasheet" "" - (at 0 0 -90) + (at 0 0 270) (unlocked yes) (layer "F.Fab") (hide yes) @@ -4250,11 +4079,12 @@ (effects (font (size 1.27 1.27) + (thickness 0.15) ) ) ) (property "Description" "" - (at 0 0 -90) + (at 0 0 270) (unlocked yes) (layer "F.Fab") (hide yes) @@ -4262,6 +4092,7 @@ (effects (font (size 1.27 1.27) + (thickness 0.15) ) ) ) @@ -4382,7 +4213,7 @@ (pad "1" smd roundrect (at -1.4875 0 270) (size 1.425 2.65) - (layers "F.Cu" "F.Paste" "F.Mask") + (layers "F.Cu" "F.Mask" "F.Paste") (roundrect_rratio 0.1754392982) (net 16 "Net-(R1-Pad1)") (pintype "passive") @@ -4391,12 +4222,13 @@ (pad "2" smd roundrect (at 1.4875 0 270) (size 1.425 2.65) - (layers "F.Cu" "F.Paste" "F.Mask") + (layers "F.Cu" "F.Mask" "F.Paste") (roundrect_rratio 0.1754392982) (net 12 "/CANH") (pintype "passive") (uuid "7eec4ac8-03b9-42d3-9c2e-78a4423b2288") ) + (embedded_fonts no) (model "${KISYS3DMOD}/Resistor_SMD.3dshapes/R_1210_3225Metric.wrl" (offset (xyz 0 0 0) @@ -4437,18 +4269,6 @@ ) ) ) - (property "Footprint" "TO_SOT_Packages_SMD:SOT-223-3_TabPin2" - (at 0 0 180) - (unlocked yes) - (layer "F.Fab") - (hide yes) - (uuid "45f80d9f-57c6-4fc3-8b18-4d9ff3fb7693") - (effects - (font - (size 1.27 1.27) - ) - ) - ) (property "Datasheet" "" (at 0 0 180) (unlocked yes) @@ -4458,6 +4278,7 @@ (effects (font (size 1.27 1.27) + (thickness 0.15) ) ) ) @@ -4470,6 +4291,7 @@ (effects (font (size 1.27 1.27) + (thickness 0.15) ) ) ) @@ -4620,7 +4442,7 @@ (pad "1" smd rect (at -3.15 -2.3 180) (size 2 1.5) - (layers "F.Cu" "F.Paste" "F.Mask") + (layers "F.Cu" "F.Mask" "F.Paste") (net 1 "GND") (pinfunction "GND") (pintype "power_in") @@ -4629,7 +4451,7 @@ (pad "2" smd rect (at -3.15 0 180) (size 2 1.5) - (layers "F.Cu" "F.Paste" "F.Mask") + (layers "F.Cu" "F.Mask" "F.Paste") (net 2 "+3V3") (pinfunction "VO") (pintype "power_out") @@ -4638,7 +4460,7 @@ (pad "2" smd rect (at 3.15 0 180) (size 2 3.8) - (layers "F.Cu" "F.Paste" "F.Mask") + (layers "F.Cu" "F.Mask" "F.Paste") (net 2 "+3V3") (pinfunction "VO") (pintype "power_out") @@ -4647,12 +4469,13 @@ (pad "3" smd rect (at -3.15 2.3 180) (size 2 1.5) - (layers "F.Cu" "F.Paste" "F.Mask") + (layers "F.Cu" "F.Mask" "F.Paste") (net 3 "+5V") (pinfunction "VI") (pintype "power_in") (uuid "7cd01229-23c8-4025-b90d-4a7fb55732e1") ) + (embedded_fonts no) (model "${KISYS3DMOD}/Package_TO_SOT_SMD.3dshapes/SOT-223.wrl" (offset (xyz 0 0 0) @@ -4693,18 +4516,6 @@ ) ) ) - (property "Footprint" "Package_TO_SOT_SMD:SOT-23-6_Handsoldering" - (at 0 0 0) - (unlocked yes) - (layer "F.Fab") - (hide yes) - (uuid "38621a48-196c-4852-8cde-b1d97f2b3867") - (effects - (font - (size 1.27 1.27) - ) - ) - ) (property "Datasheet" "" (at 0 0 0) (unlocked yes) @@ -4714,6 +4525,7 @@ (effects (font (size 1.27 1.27) + (thickness 0.15) ) ) ) @@ -4726,6 +4538,7 @@ (effects (font (size 1.27 1.27) + (thickness 0.15) ) ) ) @@ -4856,7 +4669,7 @@ (pad "1" smd rect (at -1.35 -0.95) (size 1.56 0.65) - (layers "F.Cu" "F.Paste" "F.Mask") + (layers "F.Cu" "F.Mask" "F.Paste") (net 57 "Net-(U2-Pad1)") (pinfunction "I/O1") (pintype "passive") @@ -4865,7 +4678,7 @@ (pad "2" smd rect (at -1.35 0) (size 1.56 0.65) - (layers "F.Cu" "F.Paste" "F.Mask") + (layers "F.Cu" "F.Mask" "F.Paste") (net 1 "GND") (pinfunction "GND") (pintype "passive") @@ -4874,7 +4687,7 @@ (pad "3" smd rect (at -1.35 0.95) (size 1.56 0.65) - (layers "F.Cu" "F.Paste" "F.Mask") + (layers "F.Cu" "F.Mask" "F.Paste") (net 58 "Net-(U2-Pad3)") (pinfunction "I/O2") (pintype "passive") @@ -4883,7 +4696,7 @@ (pad "4" smd rect (at 1.35 0.95) (size 1.56 0.65) - (layers "F.Cu" "F.Paste" "F.Mask") + (layers "F.Cu" "F.Mask" "F.Paste") (net 37 "Net-(R3-Pad2)") (pinfunction "I/O2") (pintype "passive") @@ -4892,7 +4705,7 @@ (pad "5" smd rect (at 1.35 0) (size 1.56 0.65) - (layers "F.Cu" "F.Paste" "F.Mask") + (layers "F.Cu" "F.Mask" "F.Paste") (net 3 "+5V") (pinfunction "VBUS") (pintype "passive") @@ -4901,12 +4714,13 @@ (pad "6" smd rect (at 1.35 -0.95) (size 1.56 0.65) - (layers "F.Cu" "F.Paste" "F.Mask") + (layers "F.Cu" "F.Mask" "F.Paste") (net 38 "Net-(R4-Pad2)") (pinfunction "I/O1") (pintype "passive") (uuid "ac557813-52a4-4be1-b9a0-9f377121a8aa") ) + (embedded_fonts no) (model "${KICAD6_3DMODEL_DIR}/Package_TO_SOT_SMD.3dshapes/SOT-23-6.wrl" (offset (xyz 0 0 0) @@ -4950,18 +4764,6 @@ (justify mirror) ) ) - (property "Footprint" "LED_SMD:LED_0805_2012Metric_Pad1.15x1.40mm_HandSolder" - (at 0 0 0) - (unlocked yes) - (layer "F.Fab") - (hide yes) - (uuid "85b990fb-6e4d-4df5-8ce5-a90514cc7889") - (effects - (font - (size 1.27 1.27) - ) - ) - ) (property "Datasheet" "" (at 0 0 0) (unlocked yes) @@ -4971,6 +4773,7 @@ (effects (font (size 1.27 1.27) + (thickness 0.15) ) ) ) @@ -4983,6 +4786,7 @@ (effects (font (size 1.27 1.27) + (thickness 0.15) ) ) ) @@ -5124,7 +4928,7 @@ (pad "1" smd roundrect (at -1.025 0) (size 1.15 1.4) - (layers "B.Cu" "B.Paste" "B.Mask") + (layers "B.Cu" "B.Mask" "B.Paste") (roundrect_rratio 0.2173913043) (net 7 "/LED0") (pinfunction "K") @@ -5134,13 +4938,14 @@ (pad "2" smd roundrect (at 1.025 0) (size 1.15 1.4) - (layers "B.Cu" "B.Paste" "B.Mask") + (layers "B.Cu" "B.Mask" "B.Paste") (roundrect_rratio 0.2173913043) (net 6 "Net-(D3-Pad2)") (pinfunction "A") (pintype "passive") (uuid "0ec726fa-75a1-4ef5-8d05-0dd29ba061e2") ) + (embedded_fonts no) (model "${KISYS3DMOD}/LED_SMD.3dshapes/LED_0805_2012Metric.wrl" (offset (xyz 0 0 0) @@ -5184,18 +4989,6 @@ (justify mirror) ) ) - (property "Footprint" "LED_SMD:LED_0805_2012Metric_Pad1.15x1.40mm_HandSolder" - (at 0 0 0) - (unlocked yes) - (layer "F.Fab") - (hide yes) - (uuid "ec79e86b-18e1-4fad-acbb-b141cd06b650") - (effects - (font - (size 1.27 1.27) - ) - ) - ) (property "Datasheet" "" (at 0 0 0) (unlocked yes) @@ -5205,6 +4998,7 @@ (effects (font (size 1.27 1.27) + (thickness 0.15) ) ) ) @@ -5217,6 +5011,7 @@ (effects (font (size 1.27 1.27) + (thickness 0.15) ) ) ) @@ -5358,7 +5153,7 @@ (pad "1" smd roundrect (at -1.025 0) (size 1.15 1.4) - (layers "B.Cu" "B.Paste" "B.Mask") + (layers "B.Cu" "B.Mask" "B.Paste") (roundrect_rratio 0.2173913043) (net 8 "/LED1") (pinfunction "K") @@ -5368,13 +5163,14 @@ (pad "2" smd roundrect (at 1.025 0) (size 1.15 1.4) - (layers "B.Cu" "B.Paste" "B.Mask") + (layers "B.Cu" "B.Mask" "B.Paste") (roundrect_rratio 0.2173913043) (net 13 "Net-(D4-Pad2)") (pinfunction "A") (pintype "passive") (uuid "a66248ab-e3bb-4a8b-b5aa-0d0089ab551e") ) + (embedded_fonts no) (model "${KISYS3DMOD}/LED_SMD.3dshapes/LED_0805_2012Metric.wrl" (offset (xyz 0 0 0) @@ -5406,7 +5202,7 @@ ) ) (property "Value" "Screw_Terminal_01x03" - (at 5 -5.66 -90) + (at 5 -5.66 270) (layer "B.Fab") (uuid "8f40022b-3db5-4fbc-aa13-5bb2b6c2bd93") (effects @@ -5417,20 +5213,8 @@ (justify mirror) ) ) - (property "Footprint" "TerminalBlock_Phoenix:TerminalBlock_Phoenix_MKDS-1,5-3_1x03_P5.00mm_Horizontal" - (at 0 0 -90) - (unlocked yes) - (layer "F.Fab") - (hide yes) - (uuid "baa182e3-64f9-46d7-a992-b2276311042e") - (effects - (font - (size 1.27 1.27) - ) - ) - ) (property "Datasheet" "" - (at 0 0 -90) + (at 0 0 270) (unlocked yes) (layer "F.Fab") (hide yes) @@ -5438,11 +5222,12 @@ (effects (font (size 1.27 1.27) + (thickness 0.15) ) ) ) (property "Description" "" - (at 0 0 -90) + (at 0 0 270) (unlocked yes) (layer "F.Fab") (hide yes) @@ -5450,6 +5235,7 @@ (effects (font (size 1.27 1.27) + (thickness 0.15) ) ) ) @@ -5688,7 +5474,7 @@ (width 0.12) (type solid) ) - (fill none) + (fill no) (layer "B.SilkS") (uuid "f1a4f19c-3166-4bd1-ae1b-a45df46885b0") ) @@ -5699,7 +5485,7 @@ (width 0.12) (type solid) ) - (fill none) + (fill no) (layer "B.SilkS") (uuid "4d3ba732-ccbf-4740-8337-a18d14832d82") ) @@ -5890,7 +5676,7 @@ (width 0.1) (type solid) ) - (fill none) + (fill no) (layer "B.Fab") (uuid "907dc274-2e77-4e73-821c-5c57d886807e") ) @@ -5901,7 +5687,7 @@ (width 0.1) (type solid) ) - (fill none) + (fill no) (layer "B.Fab") (uuid "44217ab6-02b7-4d47-b41a-3a309f37d382") ) @@ -5912,12 +5698,12 @@ (width 0.1) (type solid) ) - (fill none) + (fill no) (layer "B.Fab") (uuid "9fc4ed72-56fc-4ee8-baba-437efde230ec") ) (fp_text user "${REFERENCE}" - (at 5 -3.2 -90) + (at 5 -3.2 270) (layer "B.Fab") (uuid "227de3e0-9108-4939-aabf-557036f462ce") (effects @@ -5961,6 +5747,7 @@ (pintype "passive") (uuid "ded4ea42-044a-4476-98e5-73b5411a7216") ) + (embedded_fonts no) (model "${KISYS3DMOD}/TerminalBlock_Phoenix.3dshapes/TerminalBlock_Phoenix_MKDS-1,5-3_1x03_P5.00mm_Horizontal.wrl" (offset (xyz 0 0 0) @@ -6004,20 +5791,8 @@ (justify mirror) ) ) - (property "Footprint" "Connector_PinHeader_1.27mm:PinHeader_1x06_P1.27mm_Vertical" - (at 0 0 -90) - (unlocked yes) - (layer "F.Fab") - (hide yes) - (uuid "722eb54c-85c4-4348-a0e2-f9810db080d5") - (effects - (font - (size 1.27 1.27) - ) - ) - ) (property "Datasheet" "" - (at 0 0 -90) + (at 0 0 270) (unlocked yes) (layer "F.Fab") (hide yes) @@ -6025,11 +5800,12 @@ (effects (font (size 1.27 1.27) + (thickness 0.15) ) ) ) (property "Description" "" - (at 0 0 -90) + (at 0 0 270) (unlocked yes) (layer "F.Fab") (hide yes) @@ -6037,6 +5813,7 @@ (effects (font (size 1.27 1.27) + (thickness 0.15) ) ) ) @@ -6291,6 +6068,7 @@ (pintype "passive") (uuid "c5f6c793-e615-453d-8a30-0dec886c95b5") ) + (embedded_fonts no) (model "${KICAD6_3DMODEL_DIR}/Connector_PinHeader_1.27mm.3dshapes/PinHeader_1x06_P1.27mm_Vertical.wrl" (offset (xyz 0 0 0) @@ -6333,18 +6111,6 @@ (justify mirror) ) ) - (property "Footprint" "Resistor_SMD:R_0603_1608Metric_Pad1.05x0.95mm_HandSolder" - (at 0 0 0) - (unlocked yes) - (layer "F.Fab") - (hide yes) - (uuid "28bea5cf-e354-45e6-9a30-9707a43b66a3") - (effects - (font - (size 1.27 1.27) - ) - ) - ) (property "Datasheet" "" (at 0 0 0) (unlocked yes) @@ -6354,6 +6120,7 @@ (effects (font (size 1.27 1.27) + (thickness 0.15) ) ) ) @@ -6366,6 +6133,7 @@ (effects (font (size 1.27 1.27) + (thickness 0.15) ) ) ) @@ -6487,7 +6255,7 @@ (pad "1" smd roundrect (at -0.875 0) (size 1.05 0.95) - (layers "B.Cu" "B.Paste" "B.Mask") + (layers "B.Cu" "B.Mask" "B.Paste") (roundrect_rratio 0.25) (net 6 "Net-(D3-Pad2)") (pintype "passive") @@ -6496,12 +6264,13 @@ (pad "2" smd roundrect (at 0.875 0) (size 1.05 0.95) - (layers "B.Cu" "B.Paste" "B.Mask") + (layers "B.Cu" "B.Mask" "B.Paste") (roundrect_rratio 0.25) (net 2 "+3V3") (pintype "passive") (uuid "fae8f8c2-d089-42c4-8e36-83ba838f1f22") ) + (embedded_fonts no) (model "${KISYS3DMOD}/Resistor_SMD.3dshapes/R_0603_1608Metric.wrl" (offset (xyz 0 0 0) @@ -6544,18 +6313,6 @@ (justify mirror) ) ) - (property "Footprint" "Resistor_SMD:R_0603_1608Metric_Pad1.05x0.95mm_HandSolder" - (at 0 0 0) - (unlocked yes) - (layer "F.Fab") - (hide yes) - (uuid "8db568f2-5f9a-40e5-9d33-9a03852274bc") - (effects - (font - (size 1.27 1.27) - ) - ) - ) (property "Datasheet" "" (at 0 0 0) (unlocked yes) @@ -6565,6 +6322,7 @@ (effects (font (size 1.27 1.27) + (thickness 0.15) ) ) ) @@ -6577,6 +6335,7 @@ (effects (font (size 1.27 1.27) + (thickness 0.15) ) ) ) @@ -6698,7 +6457,7 @@ (pad "1" smd roundrect (at -0.875 0) (size 1.05 0.95) - (layers "B.Cu" "B.Paste" "B.Mask") + (layers "B.Cu" "B.Mask" "B.Paste") (roundrect_rratio 0.25) (net 13 "Net-(D4-Pad2)") (pintype "passive") @@ -6707,12 +6466,13 @@ (pad "2" smd roundrect (at 0.875 0) (size 1.05 0.95) - (layers "B.Cu" "B.Paste" "B.Mask") + (layers "B.Cu" "B.Mask" "B.Paste") (roundrect_rratio 0.25) (net 2 "+3V3") (pintype "passive") (uuid "fdf54b81-ccb8-4136-b997-2afbf8f2ff33") ) + (embedded_fonts no) (model "${KISYS3DMOD}/Resistor_SMD.3dshapes/R_0603_1608Metric.wrl" (offset (xyz 0 0 0) @@ -6755,18 +6515,6 @@ (justify mirror) ) ) - (property "Footprint" "Button_Switch_THT:SW_DIP_SPSTx01_Slide_6.7x4.1mm_W7.62mm_P2.54mm_LowProfile" - (at 0 0 90) - (unlocked yes) - (layer "F.Fab") - (hide yes) - (uuid "d1ccfa58-d540-490f-ab37-ab80b82e7ddd") - (effects - (font - (size 1.27 1.27) - ) - ) - ) (property "Datasheet" "" (at 0 0 90) (unlocked yes) @@ -6776,6 +6524,7 @@ (effects (font (size 1.27 1.27) + (thickness 0.15) ) ) ) @@ -6788,6 +6537,7 @@ (effects (font (size 1.27 1.27) + (thickness 0.15) ) ) ) @@ -7328,6 +7078,7 @@ (pintype "passive") (uuid "5e5c719e-c708-43db-9ee6-303831826008") ) + (embedded_fonts no) (model "${KISYS3DMOD}/Button_Switch_THT.3dshapes/SW_DIP_SPSTx01_Slide_6.7x4.1mm_W7.62mm_P2.54mm_LowProfile.wrl" (offset (xyz 0 0 0) @@ -7370,18 +7121,6 @@ (justify mirror) ) ) - (property "Footprint" "Package_SO:SOP-8_6.62x9.15mm_P2.54mm" - (at 0 0 180) - (unlocked yes) - (layer "F.Fab") - (hide yes) - (uuid "94b6b51a-64b6-4a87-a800-e20251958c69") - (effects - (font - (size 1.27 1.27) - ) - ) - ) (property "Datasheet" "" (at 0 0 180) (unlocked yes) @@ -7391,6 +7130,7 @@ (effects (font (size 1.27 1.27) + (thickness 0.15) ) ) ) @@ -7403,6 +7143,7 @@ (effects (font (size 1.27 1.27) + (thickness 0.15) ) ) ) @@ -7604,7 +7345,7 @@ (pad "1" smd roundrect (at -4.525 3.81 180) (size 2.35 0.65) - (layers "B.Cu" "B.Paste" "B.Mask") + (layers "B.Cu" "B.Mask" "B.Paste") (roundrect_rratio 0.25) (net 3 "+5V") (pinfunction "VCC1") @@ -7614,7 +7355,7 @@ (pad "2" smd roundrect (at -4.525 1.27 180) (size 2.35 0.65) - (layers "B.Cu" "B.Paste" "B.Mask") + (layers "B.Cu" "B.Mask" "B.Paste") (roundrect_rratio 0.25) (net 10 "/CAN_Rx") (pinfunction "RXD") @@ -7624,7 +7365,7 @@ (pad "3" smd roundrect (at -4.525 -1.27 180) (size 2.35 0.65) - (layers "B.Cu" "B.Paste" "B.Mask") + (layers "B.Cu" "B.Mask" "B.Paste") (roundrect_rratio 0.25) (net 9 "/CAN_Tx") (pinfunction "TXD") @@ -7634,7 +7375,7 @@ (pad "4" smd roundrect (at -4.525 -3.81 180) (size 2.35 0.65) - (layers "B.Cu" "B.Paste" "B.Mask") + (layers "B.Cu" "B.Mask" "B.Paste") (roundrect_rratio 0.25) (net 1 "GND") (pinfunction "GND1") @@ -7644,7 +7385,7 @@ (pad "5" smd roundrect (at 4.525 -3.81 180) (size 2.35 0.65) - (layers "B.Cu" "B.Paste" "B.Mask") + (layers "B.Cu" "B.Mask" "B.Paste") (roundrect_rratio 0.25) (net 21 "Earth") (pinfunction "GND2") @@ -7654,7 +7395,7 @@ (pad "6" smd roundrect (at 4.525 -1.27 180) (size 2.35 0.65) - (layers "B.Cu" "B.Paste" "B.Mask") + (layers "B.Cu" "B.Mask" "B.Paste") (roundrect_rratio 0.25) (net 11 "/CANL") (pinfunction "CANL") @@ -7664,7 +7405,7 @@ (pad "7" smd roundrect (at 4.525 1.27 180) (size 2.35 0.65) - (layers "B.Cu" "B.Paste" "B.Mask") + (layers "B.Cu" "B.Mask" "B.Paste") (roundrect_rratio 0.25) (net 12 "/CANH") (pinfunction "CANH") @@ -7674,13 +7415,14 @@ (pad "8" smd roundrect (at 4.525 3.81 180) (size 2.35 0.65) - (layers "B.Cu" "B.Paste" "B.Mask") + (layers "B.Cu" "B.Mask" "B.Paste") (roundrect_rratio 0.25) (net 20 "Net-(C9-Pad1)") (pinfunction "VCC2") (pintype "power_in") (uuid "47f4eb1e-5024-4f27-850b-8a1a2b635dde") ) + (embedded_fonts no) (model "${KISYS3DMOD}/Package_SO.3dshapes/SOP-8_6.62x9.15mm_P2.54mm.wrl" (offset (xyz 0 0 0) @@ -7721,18 +7463,6 @@ (justify mirror) ) ) - (property "Footprint" "my_footprints:B0x0xS" - (at 0 0 180) - (unlocked yes) - (layer "F.Fab") - (hide yes) - (uuid "1d2ba7bf-8768-4b5d-a39e-5cd477e21beb") - (effects - (font - (size 1.27 1.27) - ) - ) - ) (property "Datasheet" "" (at 0 0 180) (unlocked yes) @@ -7742,6 +7472,7 @@ (effects (font (size 1.27 1.27) + (thickness 0.15) ) ) ) @@ -7754,6 +7485,7 @@ (effects (font (size 1.27 1.27) + (thickness 0.15) ) ) ) @@ -7864,6 +7596,7 @@ (pintype "power_out") (uuid "46a25d44-5be6-4138-ab8a-7c556acc9870") ) + (embedded_fonts no) ) (footprint "Connector_USB:USB_B_Lumberg_2411_02_Horizontal" (layer "B.Cu") @@ -7895,18 +7628,6 @@ (justify mirror) ) ) - (property "Footprint" "Connector_USB:USB_B_Lumberg_2411_02_Horizontal" - (at 0 0 0) - (unlocked yes) - (layer "F.Fab") - (hide yes) - (uuid "6e2298e4-cae4-4320-bb28-e3d3ac020d6f") - (effects - (font - (size 1.27 1.27) - ) - ) - ) (property "Datasheet" "" (at 0 0 0) (unlocked yes) @@ -7916,6 +7637,7 @@ (effects (font (size 1.27 1.27) + (thickness 0.15) ) ) ) @@ -7928,6 +7650,7 @@ (effects (font (size 1.27 1.27) + (thickness 0.15) ) ) ) @@ -8202,6 +7925,7 @@ (pintype "passive") (uuid "10cd62a2-8438-4bc2-85d7-2310c5389487") ) + (embedded_fonts no) (model "${KICAD6_3DMODEL_DIR}/Connector_USB.3dshapes/USB_B_Lumberg_2411_02_Horizontal.wrl" (offset (xyz 0 0 0) @@ -8245,18 +7969,6 @@ (justify mirror) ) ) - (property "Footprint" "TestPoint:TestPoint_THTPad_1.5x1.5mm_Drill0.7mm" - (at 0 0 0) - (unlocked yes) - (layer "F.Fab") - (hide yes) - (uuid "b560e88b-f67b-42f8-b862-2cb160c9e36c") - (effects - (font - (size 1.27 1.27) - ) - ) - ) (property "Datasheet" "" (at 0 0 0) (unlocked yes) @@ -8266,6 +7978,7 @@ (effects (font (size 1.27 1.27) + (thickness 0.15) ) ) ) @@ -8278,6 +7991,7 @@ (effects (font (size 1.27 1.27) + (thickness 0.15) ) ) ) @@ -8387,6 +8101,7 @@ (pintype "passive") (uuid "24c59d70-de09-40a5-b0a2-aff4a8baf99c") ) + (embedded_fonts no) ) (footprint "TestPoint:TestPoint_THTPad_1.5x1.5mm_Drill0.7mm" (layer "B.Cu") @@ -8419,18 +8134,6 @@ (justify mirror) ) ) - (property "Footprint" "TestPoint:TestPoint_THTPad_1.5x1.5mm_Drill0.7mm" - (at 0 0 180) - (unlocked yes) - (layer "F.Fab") - (hide yes) - (uuid "a7632312-7e49-41c0-994d-50ea2d6e593d") - (effects - (font - (size 1.27 1.27) - ) - ) - ) (property "Datasheet" "" (at 0 0 180) (unlocked yes) @@ -8440,6 +8143,7 @@ (effects (font (size 1.27 1.27) + (thickness 0.15) ) ) ) @@ -8452,6 +8156,7 @@ (effects (font (size 1.27 1.27) + (thickness 0.15) ) ) ) @@ -8561,6 +8266,7 @@ (pintype "passive") (uuid "ccf33ca6-c516-4b60-8f26-e879ecf4d0f2") ) + (embedded_fonts no) ) (footprint "TestPoint:TestPoint_THTPad_1.5x1.5mm_Drill0.7mm" (layer "B.Cu") @@ -8593,18 +8299,6 @@ (justify mirror) ) ) - (property "Footprint" "TestPoint:TestPoint_THTPad_1.5x1.5mm_Drill0.7mm" - (at 0 0 180) - (unlocked yes) - (layer "F.Fab") - (hide yes) - (uuid "5aac2344-eba6-4dee-82a1-4e8761c34d33") - (effects - (font - (size 1.27 1.27) - ) - ) - ) (property "Datasheet" "" (at 0 0 180) (unlocked yes) @@ -8614,6 +8308,7 @@ (effects (font (size 1.27 1.27) + (thickness 0.15) ) ) ) @@ -8626,6 +8321,7 @@ (effects (font (size 1.27 1.27) + (thickness 0.15) ) ) ) @@ -8735,6 +8431,7 @@ (pintype "passive") (uuid "3a35ad85-a341-42e8-b482-aac9c7b2b9cd") ) + (embedded_fonts no) ) (footprint "TestPoint:TestPoint_THTPad_1.5x1.5mm_Drill0.7mm" (layer "B.Cu") @@ -8767,18 +8464,6 @@ (justify mirror) ) ) - (property "Footprint" "TestPoint:TestPoint_THTPad_1.5x1.5mm_Drill0.7mm" - (at 0 0 180) - (unlocked yes) - (layer "F.Fab") - (hide yes) - (uuid "ff2279cb-ae00-4987-97d5-031d0baac5bd") - (effects - (font - (size 1.27 1.27) - ) - ) - ) (property "Datasheet" "" (at 0 0 180) (unlocked yes) @@ -8788,6 +8473,7 @@ (effects (font (size 1.27 1.27) + (thickness 0.15) ) ) ) @@ -8800,6 +8486,7 @@ (effects (font (size 1.27 1.27) + (thickness 0.15) ) ) ) @@ -8909,6 +8596,7 @@ (pintype "passive") (uuid "632d8246-9a15-4d0a-8f8a-1a8dbc30f20d") ) + (embedded_fonts no) ) (footprint "TestPoint:TestPoint_THTPad_1.5x1.5mm_Drill0.7mm" (layer "B.Cu") @@ -8941,18 +8629,6 @@ (justify mirror) ) ) - (property "Footprint" "TestPoint:TestPoint_THTPad_1.5x1.5mm_Drill0.7mm" - (at 0 0 180) - (unlocked yes) - (layer "F.Fab") - (hide yes) - (uuid "dbbed68e-f63a-4a66-9eb5-b16acc1c11ce") - (effects - (font - (size 1.27 1.27) - ) - ) - ) (property "Datasheet" "" (at 0 0 180) (unlocked yes) @@ -8962,6 +8638,7 @@ (effects (font (size 1.27 1.27) + (thickness 0.15) ) ) ) @@ -8974,6 +8651,7 @@ (effects (font (size 1.27 1.27) + (thickness 0.15) ) ) ) @@ -9083,6 +8761,7 @@ (pintype "passive") (uuid "f4cd7c80-7836-44a7-b216-147578e4e6e7") ) + (embedded_fonts no) ) (footprint "TestPoint:TestPoint_THTPad_1.0x1.0mm_Drill0.5mm" (layer "B.Cu") @@ -9115,18 +8794,6 @@ (justify mirror) ) ) - (property "Footprint" "TestPoint:TestPoint_THTPad_1.0x1.0mm_Drill0.5mm" - (at 0 0 0) - (unlocked yes) - (layer "F.Fab") - (hide yes) - (uuid "c054b672-251a-479a-8a24-e4a80039b83f") - (effects - (font - (size 1.27 1.27) - ) - ) - ) (property "Datasheet" "" (at 0 0 0) (unlocked yes) @@ -9136,6 +8803,7 @@ (effects (font (size 1.27 1.27) + (thickness 0.15) ) ) ) @@ -9148,6 +8816,7 @@ (effects (font (size 1.27 1.27) + (thickness 0.15) ) ) ) @@ -9257,6 +8926,7 @@ (pintype "passive") (uuid "5d92e619-b122-4114-b4d5-c3a8a2d90154") ) + (embedded_fonts no) ) (footprint "TestPoint:TestPoint_THTPad_1.5x1.5mm_Drill0.7mm" (layer "B.Cu") @@ -9289,18 +8959,6 @@ (justify mirror) ) ) - (property "Footprint" "TestPoint:TestPoint_THTPad_1.5x1.5mm_Drill0.7mm" - (at 0 0 180) - (unlocked yes) - (layer "F.Fab") - (hide yes) - (uuid "3ea2d8e1-6e41-479a-8e4e-09905165de9c") - (effects - (font - (size 1.27 1.27) - ) - ) - ) (property "Datasheet" "" (at 0 0 180) (unlocked yes) @@ -9310,6 +8968,7 @@ (effects (font (size 1.27 1.27) + (thickness 0.15) ) ) ) @@ -9322,6 +8981,7 @@ (effects (font (size 1.27 1.27) + (thickness 0.15) ) ) ) @@ -9431,6 +9091,7 @@ (pintype "passive") (uuid "18f48a68-313c-4469-adec-7624c0ce0186") ) + (embedded_fonts no) ) (footprint "TestPoint:TestPoint_THTPad_1.0x1.0mm_Drill0.5mm" (layer "B.Cu") @@ -9463,18 +9124,6 @@ (justify mirror) ) ) - (property "Footprint" "TestPoint:TestPoint_THTPad_1.0x1.0mm_Drill0.5mm" - (at 0 0 180) - (unlocked yes) - (layer "F.Fab") - (hide yes) - (uuid "6e2faf6b-a609-4b52-b88e-a50ba513a049") - (effects - (font - (size 1.27 1.27) - ) - ) - ) (property "Datasheet" "" (at 0 0 180) (unlocked yes) @@ -9484,6 +9133,7 @@ (effects (font (size 1.27 1.27) + (thickness 0.15) ) ) ) @@ -9496,6 +9146,7 @@ (effects (font (size 1.27 1.27) + (thickness 0.15) ) ) ) @@ -9605,6 +9256,7 @@ (pintype "passive") (uuid "2a105204-84ce-42ef-9159-3b36adf486a7") ) + (embedded_fonts no) ) (footprint "TestPoint:TestPoint_THTPad_1.5x1.5mm_Drill0.7mm" (layer "B.Cu") @@ -9637,18 +9289,6 @@ (justify mirror) ) ) - (property "Footprint" "TestPoint:TestPoint_THTPad_1.5x1.5mm_Drill0.7mm" - (at 0 0 180) - (unlocked yes) - (layer "F.Fab") - (hide yes) - (uuid "c4cbb989-297b-4707-b2eb-6a8edf3da699") - (effects - (font - (size 1.27 1.27) - ) - ) - ) (property "Datasheet" "" (at 0 0 180) (unlocked yes) @@ -9658,6 +9298,7 @@ (effects (font (size 1.27 1.27) + (thickness 0.15) ) ) ) @@ -9670,6 +9311,7 @@ (effects (font (size 1.27 1.27) + (thickness 0.15) ) ) ) @@ -9779,6 +9421,7 @@ (pintype "passive") (uuid "aeb6f65d-8d41-4580-b72e-ff6dce27e532") ) + (embedded_fonts no) ) (footprint "TestPoint:TestPoint_THTPad_1.5x1.5mm_Drill0.7mm" (layer "B.Cu") @@ -9811,18 +9454,6 @@ (justify mirror) ) ) - (property "Footprint" "TestPoint:TestPoint_THTPad_1.5x1.5mm_Drill0.7mm" - (at 0 0 180) - (unlocked yes) - (layer "F.Fab") - (hide yes) - (uuid "a39c2033-0e2f-4b30-8c44-1260e7624887") - (effects - (font - (size 1.27 1.27) - ) - ) - ) (property "Datasheet" "" (at 0 0 180) (unlocked yes) @@ -9832,6 +9463,7 @@ (effects (font (size 1.27 1.27) + (thickness 0.15) ) ) ) @@ -9844,6 +9476,7 @@ (effects (font (size 1.27 1.27) + (thickness 0.15) ) ) ) @@ -9953,6 +9586,7 @@ (pintype "passive") (uuid "e693e014-3b04-417a-b5fa-0bde4ebeb941") ) + (embedded_fonts no) ) (footprint "TestPoint:TestPoint_THTPad_1.5x1.5mm_Drill0.7mm" (layer "B.Cu") @@ -9985,18 +9619,6 @@ (justify mirror) ) ) - (property "Footprint" "TestPoint:TestPoint_THTPad_1.5x1.5mm_Drill0.7mm" - (at 0 0 180) - (unlocked yes) - (layer "F.Fab") - (hide yes) - (uuid "5a87d580-19d3-47d2-a6ec-7f0d3c668798") - (effects - (font - (size 1.27 1.27) - ) - ) - ) (property "Datasheet" "" (at 0 0 180) (unlocked yes) @@ -10006,6 +9628,7 @@ (effects (font (size 1.27 1.27) + (thickness 0.15) ) ) ) @@ -10018,6 +9641,7 @@ (effects (font (size 1.27 1.27) + (thickness 0.15) ) ) ) @@ -10127,6 +9751,7 @@ (pintype "passive") (uuid "345156e0-47cf-4e12-b5a4-f16df1a79a53") ) + (embedded_fonts no) ) (footprint "TestPoint:TestPoint_THTPad_1.5x1.5mm_Drill0.7mm" (layer "B.Cu") @@ -10159,18 +9784,6 @@ (justify mirror) ) ) - (property "Footprint" "TestPoint:TestPoint_THTPad_1.5x1.5mm_Drill0.7mm" - (at 0 0 180) - (unlocked yes) - (layer "F.Fab") - (hide yes) - (uuid "33b71050-df75-4e89-97a6-46e8e3d10a1e") - (effects - (font - (size 1.27 1.27) - ) - ) - ) (property "Datasheet" "" (at 0 0 180) (unlocked yes) @@ -10180,6 +9793,7 @@ (effects (font (size 1.27 1.27) + (thickness 0.15) ) ) ) @@ -10192,6 +9806,7 @@ (effects (font (size 1.27 1.27) + (thickness 0.15) ) ) ) @@ -10301,6 +9916,7 @@ (pintype "passive") (uuid "131a4053-ce6e-4684-bc1a-5cd4cff6744c") ) + (embedded_fonts no) ) (footprint "TestPoint:TestPoint_THTPad_1.0x1.0mm_Drill0.5mm" (layer "B.Cu") @@ -10333,18 +9949,6 @@ (justify mirror) ) ) - (property "Footprint" "TestPoint:TestPoint_THTPad_1.0x1.0mm_Drill0.5mm" - (at 0 0 180) - (unlocked yes) - (layer "F.Fab") - (hide yes) - (uuid "d7ef6ce0-4ad9-4a69-b38b-55f4ba261259") - (effects - (font - (size 1.27 1.27) - ) - ) - ) (property "Datasheet" "" (at 0 0 180) (unlocked yes) @@ -10354,6 +9958,7 @@ (effects (font (size 1.27 1.27) + (thickness 0.15) ) ) ) @@ -10366,6 +9971,7 @@ (effects (font (size 1.27 1.27) + (thickness 0.15) ) ) ) @@ -10475,6 +10081,7 @@ (pintype "passive") (uuid "61a8ed51-7f02-49e5-b3c5-1cd3c3ea6253") ) + (embedded_fonts no) ) (footprint "TestPoint:TestPoint_THTPad_1.5x1.5mm_Drill0.7mm" (layer "B.Cu") @@ -10507,18 +10114,6 @@ (justify mirror) ) ) - (property "Footprint" "TestPoint:TestPoint_THTPad_1.5x1.5mm_Drill0.7mm" - (at 0 0 180) - (unlocked yes) - (layer "F.Fab") - (hide yes) - (uuid "2a6b4b06-adfc-4e6e-9d80-47bee5d4775e") - (effects - (font - (size 1.27 1.27) - ) - ) - ) (property "Datasheet" "" (at 0 0 180) (unlocked yes) @@ -10528,6 +10123,7 @@ (effects (font (size 1.27 1.27) + (thickness 0.15) ) ) ) @@ -10540,6 +10136,7 @@ (effects (font (size 1.27 1.27) + (thickness 0.15) ) ) ) @@ -10649,6 +10246,7 @@ (pintype "passive") (uuid "a9572fbb-ea09-4ef1-9de7-68598a033071") ) + (embedded_fonts no) ) (footprint "TestPoint:TestPoint_THTPad_1.5x1.5mm_Drill0.7mm" (layer "B.Cu") @@ -10681,18 +10279,6 @@ (justify mirror) ) ) - (property "Footprint" "TestPoint:TestPoint_THTPad_1.5x1.5mm_Drill0.7mm" - (at 0 0 180) - (unlocked yes) - (layer "F.Fab") - (hide yes) - (uuid "7d633c93-1049-41b5-aaa2-9da4456c825e") - (effects - (font - (size 1.27 1.27) - ) - ) - ) (property "Datasheet" "" (at 0 0 180) (unlocked yes) @@ -10702,6 +10288,7 @@ (effects (font (size 1.27 1.27) + (thickness 0.15) ) ) ) @@ -10714,6 +10301,7 @@ (effects (font (size 1.27 1.27) + (thickness 0.15) ) ) ) @@ -10823,6 +10411,7 @@ (pintype "passive") (uuid "b9bd9d94-a0ce-4590-9e48-57cddb835eae") ) + (embedded_fonts no) ) (footprint "TestPoint:TestPoint_THTPad_1.5x1.5mm_Drill0.7mm" (layer "B.Cu") @@ -10855,18 +10444,6 @@ (justify mirror) ) ) - (property "Footprint" "TestPoint:TestPoint_THTPad_1.5x1.5mm_Drill0.7mm" - (at 0 0 180) - (unlocked yes) - (layer "F.Fab") - (hide yes) - (uuid "b048616f-55bd-42d3-ab04-701f7c7c5906") - (effects - (font - (size 1.27 1.27) - ) - ) - ) (property "Datasheet" "" (at 0 0 180) (unlocked yes) @@ -10876,6 +10453,7 @@ (effects (font (size 1.27 1.27) + (thickness 0.15) ) ) ) @@ -10888,6 +10466,7 @@ (effects (font (size 1.27 1.27) + (thickness 0.15) ) ) ) @@ -10997,6 +10576,7 @@ (pintype "passive") (uuid "bd3fd940-7757-4f0b-8439-fa444a68f143") ) + (embedded_fonts no) ) (footprint "TestPoint:TestPoint_THTPad_1.5x1.5mm_Drill0.7mm" (layer "B.Cu") @@ -11029,18 +10609,6 @@ (justify mirror) ) ) - (property "Footprint" "TestPoint:TestPoint_THTPad_1.5x1.5mm_Drill0.7mm" - (at 0 0 180) - (unlocked yes) - (layer "F.Fab") - (hide yes) - (uuid "b6838a99-6442-4ddb-ae10-4f2794071ae7") - (effects - (font - (size 1.27 1.27) - ) - ) - ) (property "Datasheet" "" (at 0 0 180) (unlocked yes) @@ -11050,6 +10618,7 @@ (effects (font (size 1.27 1.27) + (thickness 0.15) ) ) ) @@ -11062,6 +10631,7 @@ (effects (font (size 1.27 1.27) + (thickness 0.15) ) ) ) @@ -11171,6 +10741,7 @@ (pintype "passive") (uuid "153bb952-2e77-426b-991e-f874a5257c2c") ) + (embedded_fonts no) ) (footprint "TestPoint:TestPoint_THTPad_1.5x1.5mm_Drill0.7mm" (layer "B.Cu") @@ -11203,18 +10774,6 @@ (justify mirror) ) ) - (property "Footprint" "TestPoint:TestPoint_THTPad_1.5x1.5mm_Drill0.7mm" - (at 0 0 180) - (unlocked yes) - (layer "F.Fab") - (hide yes) - (uuid "e1978ea8-9924-4981-88c6-feb8301543ac") - (effects - (font - (size 1.27 1.27) - ) - ) - ) (property "Datasheet" "" (at 0 0 180) (unlocked yes) @@ -11224,6 +10783,7 @@ (effects (font (size 1.27 1.27) + (thickness 0.15) ) ) ) @@ -11236,6 +10796,7 @@ (effects (font (size 1.27 1.27) + (thickness 0.15) ) ) ) @@ -11345,6 +10906,7 @@ (pintype "passive") (uuid "cc24dbeb-9838-475d-a607-8dd732bb8aee") ) + (embedded_fonts no) ) (footprint "TestPoint:TestPoint_THTPad_1.0x1.0mm_Drill0.5mm" (layer "B.Cu") @@ -11377,18 +10939,6 @@ (justify mirror) ) ) - (property "Footprint" "TestPoint:TestPoint_THTPad_1.0x1.0mm_Drill0.5mm" - (at 0 0 180) - (unlocked yes) - (layer "F.Fab") - (hide yes) - (uuid "ef7bebce-05b3-43af-b3fc-0b7d05908970") - (effects - (font - (size 1.27 1.27) - ) - ) - ) (property "Datasheet" "" (at 0 0 180) (unlocked yes) @@ -11398,6 +10948,7 @@ (effects (font (size 1.27 1.27) + (thickness 0.15) ) ) ) @@ -11410,6 +10961,7 @@ (effects (font (size 1.27 1.27) + (thickness 0.15) ) ) ) @@ -11519,6 +11071,7 @@ (pintype "passive") (uuid "8bc8f554-24a3-49a5-a37f-ebfa16d7869e") ) + (embedded_fonts no) ) (footprint "TestPoint:TestPoint_THTPad_1.5x1.5mm_Drill0.7mm" (layer "B.Cu") @@ -11551,18 +11104,6 @@ (justify mirror) ) ) - (property "Footprint" "TestPoint:TestPoint_THTPad_1.5x1.5mm_Drill0.7mm" - (at 0 0 0) - (unlocked yes) - (layer "F.Fab") - (hide yes) - (uuid "eb3af2c9-2a0d-48f1-b01b-4988f7a0e0b0") - (effects - (font - (size 1.27 1.27) - ) - ) - ) (property "Datasheet" "" (at 0 0 0) (unlocked yes) @@ -11572,6 +11113,7 @@ (effects (font (size 1.27 1.27) + (thickness 0.15) ) ) ) @@ -11584,6 +11126,7 @@ (effects (font (size 1.27 1.27) + (thickness 0.15) ) ) ) @@ -11693,6 +11236,7 @@ (pintype "passive") (uuid "d83022d1-929b-4585-bffa-db9d9cc77cbc") ) + (embedded_fonts no) ) (footprint "TestPoint:TestPoint_THTPad_1.5x1.5mm_Drill0.7mm" (layer "B.Cu") @@ -11725,18 +11269,6 @@ (justify mirror) ) ) - (property "Footprint" "TestPoint:TestPoint_THTPad_1.5x1.5mm_Drill0.7mm" - (at 0 0 180) - (unlocked yes) - (layer "F.Fab") - (hide yes) - (uuid "eace31d6-f4bb-413a-8031-53dc07d9f893") - (effects - (font - (size 1.27 1.27) - ) - ) - ) (property "Datasheet" "" (at 0 0 180) (unlocked yes) @@ -11746,6 +11278,7 @@ (effects (font (size 1.27 1.27) + (thickness 0.15) ) ) ) @@ -11758,6 +11291,7 @@ (effects (font (size 1.27 1.27) + (thickness 0.15) ) ) ) @@ -11867,6 +11401,7 @@ (pintype "passive") (uuid "acf5df8e-532a-4862-9ea2-f6b9ee89842a") ) + (embedded_fonts no) ) (footprint "TestPoint:TestPoint_THTPad_1.5x1.5mm_Drill0.7mm" (layer "B.Cu") @@ -11899,18 +11434,6 @@ (justify mirror) ) ) - (property "Footprint" "TestPoint:TestPoint_THTPad_1.5x1.5mm_Drill0.7mm" - (at 0 0 180) - (unlocked yes) - (layer "F.Fab") - (hide yes) - (uuid "b998e816-f5ec-4524-806e-6c116522c380") - (effects - (font - (size 1.27 1.27) - ) - ) - ) (property "Datasheet" "" (at 0 0 180) (unlocked yes) @@ -11920,6 +11443,7 @@ (effects (font (size 1.27 1.27) + (thickness 0.15) ) ) ) @@ -11932,6 +11456,7 @@ (effects (font (size 1.27 1.27) + (thickness 0.15) ) ) ) @@ -12041,6 +11566,7 @@ (pintype "passive") (uuid "0ba1bc30-47bf-4a58-80a7-49a735f2345a") ) + (embedded_fonts no) ) (footprint "TestPoint:TestPoint_THTPad_1.5x1.5mm_Drill0.7mm" (layer "B.Cu") @@ -12073,18 +11599,6 @@ (justify mirror) ) ) - (property "Footprint" "TestPoint:TestPoint_THTPad_1.5x1.5mm_Drill0.7mm" - (at 0 0 180) - (unlocked yes) - (layer "F.Fab") - (hide yes) - (uuid "5277439d-173b-4cd6-9469-540dd1668413") - (effects - (font - (size 1.27 1.27) - ) - ) - ) (property "Datasheet" "" (at 0 0 180) (unlocked yes) @@ -12094,6 +11608,7 @@ (effects (font (size 1.27 1.27) + (thickness 0.15) ) ) ) @@ -12106,6 +11621,7 @@ (effects (font (size 1.27 1.27) + (thickness 0.15) ) ) ) @@ -12215,6 +11731,7 @@ (pintype "passive") (uuid "c00807f1-d555-4936-888b-93096d0b82b2") ) + (embedded_fonts no) ) (gr_line (start 125.5 50) @@ -12308,6 +11825,39 @@ (layer "Edge.Cuts") (uuid "f48473a9-6470-4d06-a43f-7124347e1c3e") ) + (gr_text "GND" + (at 66.7512 60.1472 0) + (layer "F.SilkS") + (uuid "1f56a3c9-3ad3-4cb1-99eb-712f8d0bfe40") + (effects + (font + (size 1 1) + (thickness 0.15) + ) + ) + ) + (gr_text "CANH" + (at 66.7512 55.0672 0) + (layer "F.SilkS") + (uuid "7d43d7e5-7544-4051-8e25-7bc2e0b73be0") + (effects + (font + (size 1 1) + (thickness 0.15) + ) + ) + ) + (gr_text "CANL" + (at 66.802 65.1764 0) + (layer "F.SilkS") + (uuid "bfa82123-73d3-4336-aa5f-32572330ea72") + (effects + (font + (size 1 1) + (thickness 0.15) + ) + ) + ) (gr_text "SWCLK" (at 94.1832 54.7116 90) (layer "B.SilkS") @@ -12416,39 +11966,6 @@ (justify mirror) ) ) - (gr_text "GND" - (at 66.7512 60.1472 0) - (layer "F.SilkS") - (uuid "1f56a3c9-3ad3-4cb1-99eb-712f8d0bfe40") - (effects - (font - (size 1 1) - (thickness 0.15) - ) - ) - ) - (gr_text "CANH" - (at 66.7512 55.0672 0) - (layer "F.SilkS") - (uuid "7d43d7e5-7544-4051-8e25-7bc2e0b73be0") - (effects - (font - (size 1 1) - (thickness 0.15) - ) - ) - ) - (gr_text "CANL" - (at 66.802 65.1764 0) - (layer "F.SilkS") - (uuid "bfa82123-73d3-4336-aa5f-32572330ea72") - (effects - (font - (size 1 1) - (thickness 0.15) - ) - ) - ) (dimension (type aligned) (layer "Dwgs.User") @@ -12457,6 +11974,22 @@ (xy 61 75.5) (xy 61 49.5) ) (height -1.5) + (format + (prefix "") + (suffix "") + (units 2) + (units_format 1) + (precision 4) + ) + (style + (thickness 0.15) + (arrow_length 1.27) + (text_position_mode 0) + (arrow_direction outward) + (extension_height 0.58642) + (extension_offset 0) + (keep_text_aligned yes) + ) (gr_text "26.0000 mm" (at 58.35 62.5 90) (layer "Dwgs.User") @@ -12468,6 +12001,15 @@ ) ) ) + ) + (dimension + (type aligned) + (layer "Dwgs.User") + (uuid "77e2f975-93f0-4cb8-9cc6-baba8322b1ae") + (pts + (xy 125.5 75.5) (xy 61 75.5) + ) + (height -1.5) (format (prefix "") (suffix "") @@ -12479,17 +12021,11 @@ (thickness 0.15) (arrow_length 1.27) (text_position_mode 0) + (arrow_direction outward) (extension_height 0.58642) - (extension_offset 0) keep_text_aligned) - ) - (dimension - (type aligned) - (layer "Dwgs.User") - (uuid "77e2f975-93f0-4cb8-9cc6-baba8322b1ae") - (pts - (xy 125.5 75.5) (xy 61 75.5) + (extension_offset 0) + (keep_text_aligned yes) ) - (height -1.5) (gr_text "64.5000 mm" (at 93.25 75.85 0) (layer "Dwgs.User") @@ -12501,19 +12037,6 @@ ) ) ) - (format - (prefix "") - (suffix "") - (units 2) - (units_format 1) - (precision 4) - ) - (style - (thickness 0.15) - (arrow_length 1.27) - (text_position_mode 0) - (extension_height 0.58642) - (extension_offset 0) keep_text_aligned) ) (segment (start 95.159 59.654) @@ -15982,7 +15505,7 @@ (zone (net 1) (net_name "GND") - (layers "F&B.Cu") + (layers "F.Cu" "B.Cu") (uuid "ac62b21d-e71c-437e-b7e3-cb3c126ff74f") (hatch edge 0.508) (connect_pads @@ -17806,4 +17329,5 @@ ) ) ) + (embedded_fonts no) ) diff --git a/F0:F030,F042,F072/usbcan_ringbuffer/kicad/stm32.kicad_prl b/F0:F030,F042,F072/usbcan_ringbuffer/kicad/stm32.kicad_prl index 6360a48..0bed213 100644 --- a/F0:F030,F042,F072/usbcan_ringbuffer/kicad/stm32.kicad_prl +++ b/F0:F030,F042,F072/usbcan_ringbuffer/kicad/stm32.kicad_prl @@ -10,6 +10,7 @@ "opacity": { "images": 0.6, "pads": 1.0, + "shapes": 1.0, "tracks": 1.0, "vias": 1.0, "zones": 0.6 @@ -29,42 +30,25 @@ "zones": true }, "visible_items": [ - 0, - 1, - 2, - 3, - 4, - 5, - 8, - 9, - 10, - 11, - 12, - 13, - 14, - 15, - 16, - 17, - 18, - 19, - 20, - 21, - 22, - 23, - 24, - 25, - 26, - 27, - 28, - 29, - 30, - 32, - 33, - 34, - 35, - 36 + "vias", + "footprint_text", + "footprint_anchors", + "ratsnest", + "grid", + "footprints_front", + "footprints_back", + "footprint_values", + "footprint_references", + "tracks", + "drc_errors", + "drawing_sheet", + "bitmaps", + "pads", + "zones", + "drc_warnings", + "shapes" ], - "visible_layers": "00290a0_00000000", + "visible_layers": "00000000_00000000_00000008_82000022", "zone_display_mode": 1 }, "git": { @@ -75,9 +59,72 @@ }, "meta": { "filename": "stm32.kicad_prl", - "version": 3 + "version": 5 }, + "net_inspector_panel": { + "col_hidden": [ + false, + false, + false, + false, + false, + false, + false, + false, + false, + false + ], + "col_order": [ + 0, + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9 + ], + "col_widths": [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ], + "custom_group_rules": [], + "expanded_rows": [], + "filter_by_net_name": true, + "filter_by_netclass": true, + "filter_text": "", + "group_by_constraint": false, + "group_by_netclass": false, + "show_unconnected_nets": false, + "show_zero_pad_nets": false, + "sort_ascending": true, + "sorting_column": 0 + }, + "open_jobsets": [], "project": { "files": [] + }, + "schematic": { + "selection_filter": { + "graphics": true, + "images": true, + "labels": true, + "lockedItems": false, + "otherItems": true, + "pins": true, + "symbols": true, + "text": true, + "wires": true + } } } diff --git a/F0:F030,F042,F072/usbcan_ringbuffer/kicad/stm32.kicad_pro b/F0:F030,F042,F072/usbcan_ringbuffer/kicad/stm32.kicad_pro index 55e0664..7522123 100644 --- a/F0:F030,F042,F072/usbcan_ringbuffer/kicad/stm32.kicad_pro +++ b/F0:F030,F042,F072/usbcan_ringbuffer/kicad/stm32.kicad_pro @@ -3,14 +3,17 @@ "3dviewports": [], "design_settings": { "defaults": { + "apply_defaults_to_fp_fields": false, + "apply_defaults_to_fp_shapes": false, + "apply_defaults_to_fp_text": false, "board_outline_line_width": 0.15, - "copper_line_width": 0.19999999999999998, + "copper_line_width": 0.2, "copper_text_italic": false, "copper_text_size_h": 1.5, "copper_text_size_v": 1.5, "copper_text_thickness": 0.3, "copper_text_upright": false, - "courtyard_line_width": 0.049999999999999996, + "courtyard_line_width": 0.05, "dimension_precision": 4, "dimension_units": 3, "dimensions": { @@ -21,13 +24,13 @@ "text_position": 0, "units_format": 1 }, - "fab_line_width": 0.09999999999999999, + "fab_line_width": 0.1, "fab_text_italic": false, "fab_text_size_h": 1.0, "fab_text_size_v": 1.0, "fab_text_thickness": 0.15, "fab_text_upright": false, - "other_line_width": 0.09999999999999999, + "other_line_width": 0.1, "other_text_italic": false, "other_text_size_h": 1.0, "other_text_size_v": 1.0, @@ -68,15 +71,20 @@ "copper_edge_clearance": "error", "copper_sliver": "warning", "courtyards_overlap": "warning", + "creepage": "error", "diff_pair_gap_out_of_range": "error", "diff_pair_uncoupled_length_too_long": "error", "drill_out_of_range": "error", "duplicate_footprints": "warning", "extra_footprint": "warning", "footprint": "error", + "footprint_filters_mismatch": "ignore", + "footprint_symbol_mismatch": "warning", "footprint_type_mismatch": "error", "hole_clearance": "error", "hole_near_hole": "error", + "hole_to_hole": "error", + "holes_co_located": "warning", "invalid_outline": "error", "isolated_copper": "warning", "item_on_disabled_layer": "error", @@ -86,9 +94,11 @@ "lib_footprint_mismatch": "warning", "malformed_courtyard": "error", "microvia_drill_out_of_range": "error", + "mirrored_text_on_front_layer": "warning", "missing_courtyard": "ignore", "missing_footprint": "warning", "net_conflict": "warning", + "nonmirrored_text_on_back_layer": "warning", "npth_inside_courtyard": "ignore", "padstack": "error", "pth_inside_courtyard": "ignore", @@ -100,10 +110,13 @@ "solder_mask_bridge": "error", "starved_thermal": "error", "text_height": "warning", + "text_on_edge_cuts": "error", "text_thickness": "warning", "through_hole_pad_without_hole": "error", "too_many_vias": "error", + "track_angle": "error", "track_dangling": "warning", + "track_segment_length": "error", "track_width": "error", "tracks_crossing": "error", "unconnected_items": "error", @@ -119,58 +132,63 @@ "max_error": 0.005, "min_clearance": 0.0, "min_connection": 0.0, - "min_copper_edge_clearance": 0.09999999999999999, + "min_copper_edge_clearance": 0.1, + "min_groove_width": 0.0, "min_hole_clearance": 0.25, "min_hole_to_hole": 0.25, - "min_microvia_diameter": 0.19999999999999998, - "min_microvia_drill": 0.09999999999999999, + "min_microvia_diameter": 0.2, + "min_microvia_drill": 0.1, "min_resolved_spokes": 2, "min_silk_clearance": 0.0, - "min_text_height": 0.7999999999999999, + "min_text_height": 0.8, "min_text_thickness": 0.08, "min_through_hole_diameter": 0.3, "min_track_width": 0.15, - "min_via_annular_width": 0.049999999999999996, - "min_via_diameter": 0.39999999999999997, + "min_via_annular_width": 0.05, + "min_via_diameter": 0.4, "solder_mask_to_copper_clearance": 0.0, "use_height_for_length_calcs": true }, "teardrop_options": [ { - "td_allow_use_two_tracks": true, - "td_curve_segcount": 5, - "td_on_pad_in_zone": false, - "td_onpadsmd": true, + "td_onpthpad": true, "td_onroundshapesonly": false, + "td_onsmdpad": true, "td_ontrackend": false, - "td_onviapad": true + "td_onvia": true } ], "teardrop_parameters": [ { - "td_curve_segcount": 0, + "td_allow_use_two_tracks": true, + "td_curve_segcount": 1, "td_height_ratio": 1.0, "td_length_ratio": 0.5, "td_maxheight": 2.0, "td_maxlen": 1.0, + "td_on_pad_in_zone": false, "td_target_name": "td_round_shape", "td_width_to_size_filter_ratio": 0.9 }, { - "td_curve_segcount": 0, + "td_allow_use_two_tracks": true, + "td_curve_segcount": 1, "td_height_ratio": 1.0, "td_length_ratio": 0.5, "td_maxheight": 2.0, "td_maxlen": 1.0, + "td_on_pad_in_zone": false, "td_target_name": "td_rect_shape", "td_width_to_size_filter_ratio": 0.9 }, { - "td_curve_segcount": 0, + "td_allow_use_two_tracks": true, + "td_curve_segcount": 1, "td_height_ratio": 1.0, "td_length_ratio": 0.5, "td_maxheight": 2.0, "td_maxlen": 1.0, + "td_on_pad_in_zone": false, "td_target_name": "td_track_end", "td_width_to_size_filter_ratio": 0.9 } @@ -181,6 +199,32 @@ 0.25, 0.5 ], + "tuning_pattern_settings": { + "diff_pair_defaults": { + "corner_radius_percentage": 80, + "corner_style": 1, + "max_amplitude": 1.0, + "min_amplitude": 0.2, + "single_sided": false, + "spacing": 1.0 + }, + "diff_pair_skew_defaults": { + "corner_radius_percentage": 80, + "corner_style": 1, + "max_amplitude": 1.0, + "min_amplitude": 0.2, + "single_sided": false, + "spacing": 0.6 + }, + "single_track_defaults": { + "corner_radius_percentage": 80, + "corner_style": 1, + "max_amplitude": 1.0, + "min_amplitude": 0.2, + "single_sided": false, + "spacing": 0.6 + } + }, "via_dimensions": [ { "diameter": 0.0, @@ -209,6 +253,7 @@ "mfg": "", "mpn": "" }, + "layer_pairs": [], "layer_presets": [], "viewports": [] }, @@ -403,10 +448,15 @@ "duplicate_sheet_names": "error", "endpoint_off_grid": "warning", "extra_units": "error", + "footprint_filter": "ignore", + "footprint_link_issues": "warning", + "four_way_junction": "ignore", "global_label_dangling": "warning", "hier_label_mismatch": "error", "label_dangling": "error", + "label_multiple_wires": "warning", "lib_symbol_issues": "warning", + "lib_symbol_mismatch": "warning", "missing_bidi_pin": "warning", "missing_input_pin": "warning", "missing_power_pin": "error", @@ -419,9 +469,15 @@ "pin_not_driven": "error", "pin_to_pin": "warning", "power_pin_not_driven": "error", + "same_local_global_label": "warning", + "similar_label_and_power": "warning", "similar_labels": "warning", + "similar_power": "warning", "simulation_model_issue": "ignore", + "single_global_label": "ignore", "unannotated": "error", + "unconnected_wire_endpoint": "warning", + "undefined_netclass": "error", "unit_value_mismatch": "error", "unresolved_variable": "error", "wire_dangling": "error" @@ -433,7 +489,7 @@ }, "meta": { "filename": "stm32.kicad_pro", - "version": 1 + "version": 3 }, "net_settings": { "classes": [ @@ -448,6 +504,7 @@ "microvia_drill": 0.1, "name": "Default", "pcb_color": "rgba(0, 0, 0, 0.000)", + "priority": 2147483647, "schematic_color": "rgba(0, 0, 0, 0.000)", "track_width": 0.2, "via_diameter": 0.8, @@ -465,6 +522,7 @@ "microvia_drill": 0.1, "name": "0.25", "pcb_color": "rgba(0, 0, 0, 0.000)", + "priority": 0, "schematic_color": "rgba(0, 0, 0, 0.000)", "track_width": 0.25, "via_diameter": 1.0, @@ -482,6 +540,7 @@ "microvia_drill": 0.1, "name": "0.5", "pcb_color": "rgba(0, 0, 0, 0.000)", + "priority": 1, "schematic_color": "rgba(0, 0, 0, 0.000)", "track_width": 0.5, "via_diameter": 1.4, @@ -490,7 +549,7 @@ } ], "meta": { - "version": 3 + "version": 4 }, "net_colors": null, "netclass_assignments": null, @@ -512,6 +571,7 @@ }, "schematic": { "annotate_start_num": 0, + "bom_export_filename": "${PROJECTNAME}.csv", "bom_fmt_presets": [], "bom_fmt_settings": { "field_delimiter": ",", @@ -565,6 +625,7 @@ ], "filter_string": "", "group_symbols": true, + "include_excluded_from_bom": false, "name": "Grouped By Value", "sort_asc": true, "sort_field": "Обозначение" @@ -611,6 +672,7 @@ }, "page_layout_descr_file": "", "plot_directory": "", + "space_save_all_events": true, "spice_adjust_passive_values": false, "spice_current_sheet_as_root": false, "spice_external_command": "spice \"%I\"", @@ -624,7 +686,7 @@ "sheets": [ [ "ce45f0ed-5b96-460f-9f82-e8a7af322e24", - "Корневой лист" + "Root" ] ], "text_variables": {} diff --git a/F0:F030,F042,F072/usbcan_ringbuffer/kicad/stm32.kicad_sch b/F0:F030,F042,F072/usbcan_ringbuffer/kicad/stm32.kicad_sch index e93c9de..6b2fed3 100644 --- a/F0:F030,F042,F072/usbcan_ringbuffer/kicad/stm32.kicad_sch +++ b/F0:F030,F042,F072/usbcan_ringbuffer/kicad/stm32.kicad_sch @@ -1,7 +1,7 @@ (kicad_sch - (version 20231120) + (version 20250114) (generator "eeschema") - (generator_version "8.0") + (generator_version "9.0") (uuid "ce45f0ed-5b96-460f-9f82-e8a7af322e24") (paper "A4") (title_block @@ -10,9 +10,13 @@ ) (lib_symbols (symbol "Connector:Conn_01x01_Female" - (pin_numbers hide) + (pin_numbers + (hide yes) + ) (pin_names - (offset 1.016) hide) + (offset 1.016) + (hide yes) + ) (exclude_from_sim no) (in_bom yes) (on_board yes) @@ -91,9 +95,9 @@ ) ) (arc - (start 0 0.508) + (start 0 -0.508) (mid -0.5058 0) - (end 0 -0.508) + (end 0 0.508) (stroke (width 0.1524) (type default) @@ -121,10 +125,13 @@ ) ) ) + (embedded_fonts no) ) (symbol "Connector:Conn_01x06_Female" (pin_names - (offset 1.016) hide) + (offset 1.016) + (hide yes) + ) (exclude_from_sim no) (in_bom yes) (on_board yes) @@ -190,81 +197,9 @@ ) ) (symbol "Conn_01x06_Female_1_1" - (arc - (start 0 -7.112) - (mid -0.5058 -7.62) - (end 0 -8.128) - (stroke - (width 0.1524) - (type default) - ) - (fill - (type none) - ) - ) - (arc - (start 0 -4.572) - (mid -0.5058 -5.08) - (end 0 -5.588) - (stroke - (width 0.1524) - (type default) - ) - (fill - (type none) - ) - ) - (arc - (start 0 -2.032) - (mid -0.5058 -2.54) - (end 0 -3.048) - (stroke - (width 0.1524) - (type default) - ) - (fill - (type none) - ) - ) (polyline (pts - (xy -1.27 -7.62) (xy -0.508 -7.62) - ) - (stroke - (width 0.1524) - (type default) - ) - (fill - (type none) - ) - ) - (polyline - (pts - (xy -1.27 -5.08) (xy -0.508 -5.08) - ) - (stroke - (width 0.1524) - (type default) - ) - (fill - (type none) - ) - ) - (polyline - (pts - (xy -1.27 -2.54) (xy -0.508 -2.54) - ) - (stroke - (width 0.1524) - (type default) - ) - (fill - (type none) - ) - ) - (polyline - (pts - (xy -1.27 0) (xy -0.508 0) + (xy -1.27 5.08) (xy -0.508 5.08) ) (stroke (width 0.1524) @@ -288,7 +223,43 @@ ) (polyline (pts - (xy -1.27 5.08) (xy -0.508 5.08) + (xy -1.27 0) (xy -0.508 0) + ) + (stroke + (width 0.1524) + (type default) + ) + (fill + (type none) + ) + ) + (polyline + (pts + (xy -1.27 -2.54) (xy -0.508 -2.54) + ) + (stroke + (width 0.1524) + (type default) + ) + (fill + (type none) + ) + ) + (polyline + (pts + (xy -1.27 -5.08) (xy -0.508 -5.08) + ) + (stroke + (width 0.1524) + (type default) + ) + (fill + (type none) + ) + ) + (polyline + (pts + (xy -1.27 -7.62) (xy -0.508 -7.62) ) (stroke (width 0.1524) @@ -299,33 +270,69 @@ ) ) (arc - (start 0 0.508) - (mid -0.5058 0) - (end 0 -0.508) - (stroke - (width 0.1524) - (type default) - ) - (fill - (type none) - ) - ) - (arc - (start 0 3.048) - (mid -0.5058 2.54) - (end 0 2.032) - (stroke - (width 0.1524) - (type default) - ) - (fill - (type none) - ) - ) - (arc - (start 0 5.588) + (start 0 4.572) (mid -0.5058 5.08) - (end 0 4.572) + (end 0 5.588) + (stroke + (width 0.1524) + (type default) + ) + (fill + (type none) + ) + ) + (arc + (start 0 2.032) + (mid -0.5058 2.54) + (end 0 3.048) + (stroke + (width 0.1524) + (type default) + ) + (fill + (type none) + ) + ) + (arc + (start 0 -0.508) + (mid -0.5058 0) + (end 0 0.508) + (stroke + (width 0.1524) + (type default) + ) + (fill + (type none) + ) + ) + (arc + (start 0 -3.048) + (mid -0.5058 -2.54) + (end 0 -2.032) + (stroke + (width 0.1524) + (type default) + ) + (fill + (type none) + ) + ) + (arc + (start 0 -5.588) + (mid -0.5058 -5.08) + (end 0 -4.572) + (stroke + (width 0.1524) + (type default) + ) + (fill + (type none) + ) + ) + (arc + (start 0 -8.128) + (mid -0.5058 -7.62) + (end 0 -7.112) (stroke (width 0.1524) (type default) @@ -443,10 +450,13 @@ ) ) ) + (embedded_fonts no) ) (symbol "Connector:Screw_Terminal_01x03" (pin_names - (offset 1.016) hide) + (offset 1.016) + (hide yes) + ) (exclude_from_sim no) (in_bom yes) (on_board yes) @@ -523,20 +533,9 @@ (type background) ) ) - (circle - (center 0 -2.54) - (radius 0.635) - (stroke - (width 0.1524) - (type default) - ) - (fill - (type none) - ) - ) (polyline (pts - (xy -0.5334 -2.2098) (xy 0.3302 -3.048) + (xy -0.5334 2.8702) (xy 0.3302 2.032) ) (stroke (width 0.1524) @@ -560,7 +559,7 @@ ) (polyline (pts - (xy -0.5334 2.8702) (xy 0.3302 2.032) + (xy -0.5334 -2.2098) (xy 0.3302 -3.048) ) (stroke (width 0.1524) @@ -572,7 +571,7 @@ ) (polyline (pts - (xy -0.3556 -2.032) (xy 0.508 -2.8702) + (xy -0.3556 3.048) (xy 0.508 2.2098) ) (stroke (width 0.1524) @@ -596,7 +595,7 @@ ) (polyline (pts - (xy -0.3556 3.048) (xy 0.508 2.2098) + (xy -0.3556 -2.032) (xy 0.508 -2.8702) ) (stroke (width 0.1524) @@ -606,6 +605,17 @@ (type none) ) ) + (circle + (center 0 2.54) + (radius 0.635) + (stroke + (width 0.1524) + (type default) + ) + (fill + (type none) + ) + ) (circle (center 0 0) (radius 0.635) @@ -618,7 +628,7 @@ ) ) (circle - (center 0 2.54) + (center 0 -2.54) (radius 0.635) (stroke (width 0.1524) @@ -683,6 +693,7 @@ ) ) ) + (embedded_fonts no) ) (symbol "Connector:USB_B" (pin_names @@ -718,7 +729,7 @@ (hide yes) ) ) - (property "Datasheet" " ~" + (property "Datasheet" "~" (at 3.81 -1.27 0) (effects (font @@ -766,15 +777,17 @@ (type background) ) ) - (circle - (center -3.81 2.159) - (radius 0.635) + (polyline + (pts + (xy -4.064 4.318) (xy -2.286 4.318) (xy -2.286 5.715) (xy -2.667 6.096) (xy -3.683 6.096) (xy -4.064 5.715) + (xy -4.064 4.318) + ) (stroke - (width 0.254) + (width 0) (type default) ) (fill - (type outline) + (type none) ) ) (rectangle @@ -789,8 +802,8 @@ ) ) (circle - (center -0.635 3.429) - (radius 0.381) + (center -3.81 2.159) + (radius 0.635) (stroke (width 0.254) (type default) @@ -799,29 +812,6 @@ (type outline) ) ) - (rectangle - (start -0.127 -7.62) - (end 0.127 -6.858) - (stroke - (width 0) - (type default) - ) - (fill - (type none) - ) - ) - (polyline - (pts - (xy -1.905 2.159) (xy 0.635 2.159) - ) - (stroke - (width 0.254) - (type default) - ) - (fill - (type none) - ) - ) (polyline (pts (xy -3.175 2.159) (xy -2.54 2.159) (xy -1.27 3.429) (xy -0.635 3.429) @@ -848,21 +838,30 @@ ) (polyline (pts - (xy 0.635 2.794) (xy 0.635 1.524) (xy 1.905 2.159) (xy 0.635 2.794) + (xy -1.905 2.159) (xy 0.635 2.159) ) (stroke (width 0.254) (type default) ) + (fill + (type none) + ) + ) + (circle + (center -0.635 3.429) + (radius 0.381) + (stroke + (width 0.254) + (type default) + ) (fill (type outline) ) ) - (polyline - (pts - (xy -4.064 4.318) (xy -2.286 4.318) (xy -2.286 5.715) (xy -2.667 6.096) (xy -3.683 6.096) (xy -4.064 5.715) - (xy -4.064 4.318) - ) + (rectangle + (start -0.127 -7.62) + (end 0.127 -6.858) (stroke (width 0) (type default) @@ -882,9 +881,21 @@ (type outline) ) ) + (polyline + (pts + (xy 0.635 2.794) (xy 0.635 1.524) (xy 1.905 2.159) (xy 0.635 2.794) + ) + (stroke + (width 0.254) + (type default) + ) + (fill + (type outline) + ) + ) (rectangle - (start 5.08 -2.667) - (end 4.318 -2.413) + (start 5.08 4.953) + (end 4.318 5.207) (stroke (width 0) (type default) @@ -905,8 +916,8 @@ ) ) (rectangle - (start 5.08 4.953) - (end 4.318 5.207) + (start 5.08 -2.667) + (end 4.318 -2.413) (stroke (width 0) (type default) @@ -917,53 +928,17 @@ ) ) (symbol "USB_B_1_1" - (pin power_out line - (at 7.62 5.08 180) + (pin passive line + (at -2.54 -10.16 90) (length 2.54) - (name "VBUS" + (name "Shield" (effects (font (size 1.27 1.27) ) ) ) - (number "1" - (effects - (font - (size 1.27 1.27) - ) - ) - ) - ) - (pin bidirectional line - (at 7.62 -2.54 180) - (length 2.54) - (name "D-" - (effects - (font - (size 1.27 1.27) - ) - ) - ) - (number "2" - (effects - (font - (size 1.27 1.27) - ) - ) - ) - ) - (pin bidirectional line - (at 7.62 0 180) - (length 2.54) - (name "D+" - (effects - (font - (size 1.27 1.27) - ) - ) - ) - (number "3" + (number "5" (effects (font (size 1.27 1.27) @@ -989,17 +964,53 @@ ) ) ) - (pin passive line - (at -2.54 -10.16 90) + (pin power_out line + (at 7.62 5.08 180) (length 2.54) - (name "Shield" + (name "VBUS" (effects (font (size 1.27 1.27) ) ) ) - (number "5" + (number "1" + (effects + (font + (size 1.27 1.27) + ) + ) + ) + ) + (pin bidirectional line + (at 7.62 0 180) + (length 2.54) + (name "D+" + (effects + (font + (size 1.27 1.27) + ) + ) + ) + (number "3" + (effects + (font + (size 1.27 1.27) + ) + ) + ) + ) + (pin bidirectional line + (at 7.62 -2.54 180) + (length 2.54) + (name "D-" + (effects + (font + (size 1.27 1.27) + ) + ) + ) + (number "2" (effects (font (size 1.27 1.27) @@ -1008,6 +1019,7 @@ ) ) ) + (embedded_fonts no) ) (symbol "Interface_CAN_LIN:ISO1050DUB" (exclude_from_sim no) @@ -1089,31 +1101,7 @@ ) (polyline (pts - (xy 0 -5.08) (xy 0 -6.35) - ) - (stroke - (width 0) - (type default) - ) - (fill - (type none) - ) - ) - (polyline - (pts - (xy 0 -2.54) (xy 0 -3.81) - ) - (stroke - (width 0) - (type default) - ) - (fill - (type none) - ) - ) - (polyline - (pts - (xy 0 0) (xy 0 -1.27) + (xy 0 5.08) (xy 0 3.81) ) (stroke (width 0) @@ -1137,7 +1125,31 @@ ) (polyline (pts - (xy 0 5.08) (xy 0 3.81) + (xy 0 0) (xy 0 -1.27) + ) + (stroke + (width 0) + (type default) + ) + (fill + (type none) + ) + ) + (polyline + (pts + (xy 0 -2.54) (xy 0 -3.81) + ) + (stroke + (width 0) + (type default) + ) + (fill + (type none) + ) + ) + (polyline + (pts + (xy 0 -5.08) (xy 0 -6.35) ) (stroke (width 0) @@ -1222,34 +1234,16 @@ ) ) (pin power_in line - (at 10.16 -5.08 180) + (at 10.16 2.54 180) (length 2.54) - (name "GND2" + (name "VCC2" (effects (font (size 1.27 1.27) ) ) ) - (number "5" - (effects - (font - (size 1.27 1.27) - ) - ) - ) - ) - (pin bidirectional line - (at 10.16 -2.54 180) - (length 2.54) - (name "CANL" - (effects - (font - (size 1.27 1.27) - ) - ) - ) - (number "6" + (number "8" (effects (font (size 1.27 1.27) @@ -1275,17 +1269,35 @@ ) ) ) - (pin power_in line - (at 10.16 2.54 180) + (pin bidirectional line + (at 10.16 -2.54 180) (length 2.54) - (name "VCC2" + (name "CANL" (effects (font (size 1.27 1.27) ) ) ) - (number "8" + (number "6" + (effects + (font + (size 1.27 1.27) + ) + ) + ) + ) + (pin power_in line + (at 10.16 -5.08 180) + (length 2.54) + (name "GND2" + (effects + (font + (size 1.27 1.27) + ) + ) + ) + (number "5" (effects (font (size 1.27 1.27) @@ -1294,6 +1306,7 @@ ) ) ) + (embedded_fonts no) ) (symbol "MCU_ST_STM32F0:STM32F072C8Tx" (exclude_from_sim no) @@ -1377,6 +1390,420 @@ ) ) (symbol "STM32F072C8Tx_1_1" + (pin input line + (at -17.78 33.02 0) + (length 2.54) + (name "NRST" + (effects + (font + (size 1.27 1.27) + ) + ) + ) + (number "7" + (effects + (font + (size 1.27 1.27) + ) + ) + ) + ) + (pin input line + (at -17.78 27.94 0) + (length 2.54) + (name "BOOT0" + (effects + (font + (size 1.27 1.27) + ) + ) + ) + (number "44" + (effects + (font + (size 1.27 1.27) + ) + ) + ) + ) + (pin input line + (at -17.78 22.86 0) + (length 2.54) + (name "PF0" + (effects + (font + (size 1.27 1.27) + ) + ) + ) + (number "5" + (effects + (font + (size 1.27 1.27) + ) + ) + ) + ) + (pin input line + (at -17.78 20.32 0) + (length 2.54) + (name "PF1" + (effects + (font + (size 1.27 1.27) + ) + ) + ) + (number "6" + (effects + (font + (size 1.27 1.27) + ) + ) + ) + ) + (pin bidirectional line + (at -17.78 15.24 0) + (length 2.54) + (name "PC13" + (effects + (font + (size 1.27 1.27) + ) + ) + ) + (number "2" + (effects + (font + (size 1.27 1.27) + ) + ) + ) + ) + (pin bidirectional line + (at -17.78 12.7 0) + (length 2.54) + (name "PC14" + (effects + (font + (size 1.27 1.27) + ) + ) + ) + (number "3" + (effects + (font + (size 1.27 1.27) + ) + ) + ) + ) + (pin bidirectional line + (at -17.78 10.16 0) + (length 2.54) + (name "PC15" + (effects + (font + (size 1.27 1.27) + ) + ) + ) + (number "4" + (effects + (font + (size 1.27 1.27) + ) + ) + ) + ) + (pin bidirectional line + (at -17.78 5.08 0) + (length 2.54) + (name "PB0" + (effects + (font + (size 1.27 1.27) + ) + ) + ) + (number "18" + (effects + (font + (size 1.27 1.27) + ) + ) + ) + ) + (pin bidirectional line + (at -17.78 2.54 0) + (length 2.54) + (name "PB1" + (effects + (font + (size 1.27 1.27) + ) + ) + ) + (number "19" + (effects + (font + (size 1.27 1.27) + ) + ) + ) + ) + (pin bidirectional line + (at -17.78 0 0) + (length 2.54) + (name "PB2" + (effects + (font + (size 1.27 1.27) + ) + ) + ) + (number "20" + (effects + (font + (size 1.27 1.27) + ) + ) + ) + ) + (pin bidirectional line + (at -17.78 -2.54 0) + (length 2.54) + (name "PB3" + (effects + (font + (size 1.27 1.27) + ) + ) + ) + (number "39" + (effects + (font + (size 1.27 1.27) + ) + ) + ) + ) + (pin bidirectional line + (at -17.78 -5.08 0) + (length 2.54) + (name "PB4" + (effects + (font + (size 1.27 1.27) + ) + ) + ) + (number "40" + (effects + (font + (size 1.27 1.27) + ) + ) + ) + ) + (pin bidirectional line + (at -17.78 -7.62 0) + (length 2.54) + (name "PB5" + (effects + (font + (size 1.27 1.27) + ) + ) + ) + (number "41" + (effects + (font + (size 1.27 1.27) + ) + ) + ) + ) + (pin bidirectional line + (at -17.78 -10.16 0) + (length 2.54) + (name "PB6" + (effects + (font + (size 1.27 1.27) + ) + ) + ) + (number "42" + (effects + (font + (size 1.27 1.27) + ) + ) + ) + ) + (pin bidirectional line + (at -17.78 -12.7 0) + (length 2.54) + (name "PB7" + (effects + (font + (size 1.27 1.27) + ) + ) + ) + (number "43" + (effects + (font + (size 1.27 1.27) + ) + ) + ) + ) + (pin bidirectional line + (at -17.78 -15.24 0) + (length 2.54) + (name "PB8" + (effects + (font + (size 1.27 1.27) + ) + ) + ) + (number "45" + (effects + (font + (size 1.27 1.27) + ) + ) + ) + ) + (pin bidirectional line + (at -17.78 -17.78 0) + (length 2.54) + (name "PB9" + (effects + (font + (size 1.27 1.27) + ) + ) + ) + (number "46" + (effects + (font + (size 1.27 1.27) + ) + ) + ) + ) + (pin bidirectional line + (at -17.78 -20.32 0) + (length 2.54) + (name "PB10" + (effects + (font + (size 1.27 1.27) + ) + ) + ) + (number "21" + (effects + (font + (size 1.27 1.27) + ) + ) + ) + ) + (pin bidirectional line + (at -17.78 -22.86 0) + (length 2.54) + (name "PB11" + (effects + (font + (size 1.27 1.27) + ) + ) + ) + (number "22" + (effects + (font + (size 1.27 1.27) + ) + ) + ) + ) + (pin bidirectional line + (at -17.78 -25.4 0) + (length 2.54) + (name "PB12" + (effects + (font + (size 1.27 1.27) + ) + ) + ) + (number "25" + (effects + (font + (size 1.27 1.27) + ) + ) + ) + ) + (pin bidirectional line + (at -17.78 -27.94 0) + (length 2.54) + (name "PB13" + (effects + (font + (size 1.27 1.27) + ) + ) + ) + (number "26" + (effects + (font + (size 1.27 1.27) + ) + ) + ) + ) + (pin bidirectional line + (at -17.78 -30.48 0) + (length 2.54) + (name "PB14" + (effects + (font + (size 1.27 1.27) + ) + ) + ) + (number "27" + (effects + (font + (size 1.27 1.27) + ) + ) + ) + ) + (pin bidirectional line + (at -17.78 -33.02 0) + (length 2.54) + (name "PB15" + (effects + (font + (size 1.27 1.27) + ) + ) + ) + (number "28" + (effects + (font + (size 1.27 1.27) + ) + ) + ) + ) (pin power_in line (at -5.08 38.1 270) (length 2.54) @@ -1395,6 +1822,150 @@ ) ) ) + (pin power_in line + (at -5.08 -38.1 90) + (length 2.54) + (name "VSS" + (effects + (font + (size 1.27 1.27) + ) + ) + ) + (number "23" + (effects + (font + (size 1.27 1.27) + ) + ) + ) + ) + (pin power_in line + (at -2.54 38.1 270) + (length 2.54) + (name "VDD" + (effects + (font + (size 1.27 1.27) + ) + ) + ) + (number "24" + (effects + (font + (size 1.27 1.27) + ) + ) + ) + ) + (pin power_in line + (at -2.54 -38.1 90) + (length 2.54) + (name "VSS" + (effects + (font + (size 1.27 1.27) + ) + ) + ) + (number "35" + (effects + (font + (size 1.27 1.27) + ) + ) + ) + ) + (pin power_in line + (at 0 38.1 270) + (length 2.54) + (name "VDD" + (effects + (font + (size 1.27 1.27) + ) + ) + ) + (number "48" + (effects + (font + (size 1.27 1.27) + ) + ) + ) + ) + (pin power_in line + (at 0 -38.1 90) + (length 2.54) + (name "VSS" + (effects + (font + (size 1.27 1.27) + ) + ) + ) + (number "47" + (effects + (font + (size 1.27 1.27) + ) + ) + ) + ) + (pin power_in line + (at 2.54 38.1 270) + (length 2.54) + (name "VDDA" + (effects + (font + (size 1.27 1.27) + ) + ) + ) + (number "9" + (effects + (font + (size 1.27 1.27) + ) + ) + ) + ) + (pin power_in line + (at 2.54 -38.1 90) + (length 2.54) + (name "VSSA" + (effects + (font + (size 1.27 1.27) + ) + ) + ) + (number "8" + (effects + (font + (size 1.27 1.27) + ) + ) + ) + ) + (pin power_in line + (at 5.08 38.1 270) + (length 2.54) + (name "VDDIO2" + (effects + (font + (size 1.27 1.27) + ) + ) + ) + (number "36" + (effects + (font + (size 1.27 1.27) + ) + ) + ) + ) (pin bidirectional line (at 15.24 5.08 180) (length 2.54) @@ -1539,222 +2110,6 @@ ) ) ) - (pin bidirectional line - (at -17.78 5.08 0) - (length 2.54) - (name "PB0" - (effects - (font - (size 1.27 1.27) - ) - ) - ) - (number "18" - (effects - (font - (size 1.27 1.27) - ) - ) - ) - ) - (pin bidirectional line - (at -17.78 2.54 0) - (length 2.54) - (name "PB1" - (effects - (font - (size 1.27 1.27) - ) - ) - ) - (number "19" - (effects - (font - (size 1.27 1.27) - ) - ) - ) - ) - (pin bidirectional line - (at -17.78 15.24 0) - (length 2.54) - (name "PC13" - (effects - (font - (size 1.27 1.27) - ) - ) - ) - (number "2" - (effects - (font - (size 1.27 1.27) - ) - ) - ) - ) - (pin bidirectional line - (at -17.78 0 0) - (length 2.54) - (name "PB2" - (effects - (font - (size 1.27 1.27) - ) - ) - ) - (number "20" - (effects - (font - (size 1.27 1.27) - ) - ) - ) - ) - (pin bidirectional line - (at -17.78 -20.32 0) - (length 2.54) - (name "PB10" - (effects - (font - (size 1.27 1.27) - ) - ) - ) - (number "21" - (effects - (font - (size 1.27 1.27) - ) - ) - ) - ) - (pin bidirectional line - (at -17.78 -22.86 0) - (length 2.54) - (name "PB11" - (effects - (font - (size 1.27 1.27) - ) - ) - ) - (number "22" - (effects - (font - (size 1.27 1.27) - ) - ) - ) - ) - (pin power_in line - (at -5.08 -38.1 90) - (length 2.54) - (name "VSS" - (effects - (font - (size 1.27 1.27) - ) - ) - ) - (number "23" - (effects - (font - (size 1.27 1.27) - ) - ) - ) - ) - (pin power_in line - (at -2.54 38.1 270) - (length 2.54) - (name "VDD" - (effects - (font - (size 1.27 1.27) - ) - ) - ) - (number "24" - (effects - (font - (size 1.27 1.27) - ) - ) - ) - ) - (pin bidirectional line - (at -17.78 -25.4 0) - (length 2.54) - (name "PB12" - (effects - (font - (size 1.27 1.27) - ) - ) - ) - (number "25" - (effects - (font - (size 1.27 1.27) - ) - ) - ) - ) - (pin bidirectional line - (at -17.78 -27.94 0) - (length 2.54) - (name "PB13" - (effects - (font - (size 1.27 1.27) - ) - ) - ) - (number "26" - (effects - (font - (size 1.27 1.27) - ) - ) - ) - ) - (pin bidirectional line - (at -17.78 -30.48 0) - (length 2.54) - (name "PB14" - (effects - (font - (size 1.27 1.27) - ) - ) - ) - (number "27" - (effects - (font - (size 1.27 1.27) - ) - ) - ) - ) - (pin bidirectional line - (at -17.78 -33.02 0) - (length 2.54) - (name "PB15" - (effects - (font - (size 1.27 1.27) - ) - ) - ) - (number "28" - (effects - (font - (size 1.27 1.27) - ) - ) - ) - ) (pin bidirectional line (at 15.24 -15.24 180) (length 2.54) @@ -1773,24 +2128,6 @@ ) ) ) - (pin bidirectional line - (at -17.78 12.7 0) - (length 2.54) - (name "PC14" - (effects - (font - (size 1.27 1.27) - ) - ) - ) - (number "3" - (effects - (font - (size 1.27 1.27) - ) - ) - ) - ) (pin bidirectional line (at 15.24 -17.78 180) (length 2.54) @@ -1881,42 +2218,6 @@ ) ) ) - (pin power_in line - (at -2.54 -38.1 90) - (length 2.54) - (name "VSS" - (effects - (font - (size 1.27 1.27) - ) - ) - ) - (number "35" - (effects - (font - (size 1.27 1.27) - ) - ) - ) - ) - (pin power_in line - (at 5.08 38.1 270) - (length 2.54) - (name "VDDIO2" - (effects - (font - (size 1.27 1.27) - ) - ) - ) - (number "36" - (effects - (font - (size 1.27 1.27) - ) - ) - ) - ) (pin bidirectional line (at 15.24 -30.48 180) (length 2.54) @@ -1953,298 +2254,13 @@ ) ) ) - (pin bidirectional line - (at -17.78 -2.54 0) - (length 2.54) - (name "PB3" - (effects - (font - (size 1.27 1.27) - ) - ) - ) - (number "39" - (effects - (font - (size 1.27 1.27) - ) - ) - ) - ) - (pin bidirectional line - (at -17.78 10.16 0) - (length 2.54) - (name "PC15" - (effects - (font - (size 1.27 1.27) - ) - ) - ) - (number "4" - (effects - (font - (size 1.27 1.27) - ) - ) - ) - ) - (pin bidirectional line - (at -17.78 -5.08 0) - (length 2.54) - (name "PB4" - (effects - (font - (size 1.27 1.27) - ) - ) - ) - (number "40" - (effects - (font - (size 1.27 1.27) - ) - ) - ) - ) - (pin bidirectional line - (at -17.78 -7.62 0) - (length 2.54) - (name "PB5" - (effects - (font - (size 1.27 1.27) - ) - ) - ) - (number "41" - (effects - (font - (size 1.27 1.27) - ) - ) - ) - ) - (pin bidirectional line - (at -17.78 -10.16 0) - (length 2.54) - (name "PB6" - (effects - (font - (size 1.27 1.27) - ) - ) - ) - (number "42" - (effects - (font - (size 1.27 1.27) - ) - ) - ) - ) - (pin bidirectional line - (at -17.78 -12.7 0) - (length 2.54) - (name "PB7" - (effects - (font - (size 1.27 1.27) - ) - ) - ) - (number "43" - (effects - (font - (size 1.27 1.27) - ) - ) - ) - ) - (pin input line - (at -17.78 27.94 0) - (length 2.54) - (name "BOOT0" - (effects - (font - (size 1.27 1.27) - ) - ) - ) - (number "44" - (effects - (font - (size 1.27 1.27) - ) - ) - ) - ) - (pin bidirectional line - (at -17.78 -15.24 0) - (length 2.54) - (name "PB8" - (effects - (font - (size 1.27 1.27) - ) - ) - ) - (number "45" - (effects - (font - (size 1.27 1.27) - ) - ) - ) - ) - (pin bidirectional line - (at -17.78 -17.78 0) - (length 2.54) - (name "PB9" - (effects - (font - (size 1.27 1.27) - ) - ) - ) - (number "46" - (effects - (font - (size 1.27 1.27) - ) - ) - ) - ) - (pin power_in line - (at 0 -38.1 90) - (length 2.54) - (name "VSS" - (effects - (font - (size 1.27 1.27) - ) - ) - ) - (number "47" - (effects - (font - (size 1.27 1.27) - ) - ) - ) - ) - (pin power_in line - (at 0 38.1 270) - (length 2.54) - (name "VDD" - (effects - (font - (size 1.27 1.27) - ) - ) - ) - (number "48" - (effects - (font - (size 1.27 1.27) - ) - ) - ) - ) - (pin input line - (at -17.78 22.86 0) - (length 2.54) - (name "PF0" - (effects - (font - (size 1.27 1.27) - ) - ) - ) - (number "5" - (effects - (font - (size 1.27 1.27) - ) - ) - ) - ) - (pin input line - (at -17.78 20.32 0) - (length 2.54) - (name "PF1" - (effects - (font - (size 1.27 1.27) - ) - ) - ) - (number "6" - (effects - (font - (size 1.27 1.27) - ) - ) - ) - ) - (pin input line - (at -17.78 33.02 0) - (length 2.54) - (name "NRST" - (effects - (font - (size 1.27 1.27) - ) - ) - ) - (number "7" - (effects - (font - (size 1.27 1.27) - ) - ) - ) - ) - (pin power_in line - (at 2.54 -38.1 90) - (length 2.54) - (name "VSSA" - (effects - (font - (size 1.27 1.27) - ) - ) - ) - (number "8" - (effects - (font - (size 1.27 1.27) - ) - ) - ) - ) - (pin power_in line - (at 2.54 38.1 270) - (length 2.54) - (name "VDDA" - (effects - (font - (size 1.27 1.27) - ) - ) - ) - (number "9" - (effects - (font - (size 1.27 1.27) - ) - ) - ) - ) ) + (embedded_fonts no) ) (symbol "Power_Protection:USBLC6-2SC6" - (pin_names hide) + (pin_names + (hide yes) + ) (exclude_from_sim no) (in_bom yes) (on_board yes) @@ -2323,6 +2339,18 @@ (type background) ) ) + (polyline + (pts + (xy -5.08 2.54) (xy -7.62 2.54) + ) + (stroke + (width 0) + (type default) + ) + (fill + (type none) + ) + ) (circle (center -5.08 0) (radius 0.254) @@ -2334,51 +2362,6 @@ (type outline) ) ) - (circle - (center -2.54 0) - (radius 0.254) - (stroke - (width 0) - (type default) - ) - (fill - (type outline) - ) - ) - (rectangle - (start -2.54 6.35) - (end 2.54 -6.35) - (stroke - (width 0) - (type default) - ) - (fill - (type none) - ) - ) - (circle - (center 0 -6.35) - (radius 0.254) - (stroke - (width 0) - (type default) - ) - (fill - (type outline) - ) - ) - (polyline - (pts - (xy -5.08 -2.54) (xy -7.62 -2.54) - ) - (stroke - (width 0) - (type default) - ) - (fill - (type none) - ) - ) (polyline (pts (xy -5.08 0) (xy -5.08 -2.54) @@ -2393,175 +2376,7 @@ ) (polyline (pts - (xy -5.08 2.54) (xy -7.62 2.54) - ) - (stroke - (width 0) - (type default) - ) - (fill - (type none) - ) - ) - (polyline - (pts - (xy -1.524 -2.794) (xy -3.556 -2.794) - ) - (stroke - (width 0) - (type default) - ) - (fill - (type none) - ) - ) - (polyline - (pts - (xy -1.524 4.826) (xy -3.556 4.826) - ) - (stroke - (width 0) - (type default) - ) - (fill - (type none) - ) - ) - (polyline - (pts - (xy 0 -7.62) (xy 0 -6.35) - ) - (stroke - (width 0) - (type default) - ) - (fill - (type none) - ) - ) - (polyline - (pts - (xy 0 -6.35) (xy 0 1.27) - ) - (stroke - (width 0) - (type default) - ) - (fill - (type none) - ) - ) - (polyline - (pts - (xy 0 1.27) (xy 0 6.35) - ) - (stroke - (width 0) - (type default) - ) - (fill - (type none) - ) - ) - (polyline - (pts - (xy 0 6.35) (xy 0 7.62) - ) - (stroke - (width 0) - (type default) - ) - (fill - (type none) - ) - ) - (polyline - (pts - (xy 1.524 -2.794) (xy 3.556 -2.794) - ) - (stroke - (width 0) - (type default) - ) - (fill - (type none) - ) - ) - (polyline - (pts - (xy 1.524 4.826) (xy 3.556 4.826) - ) - (stroke - (width 0) - (type default) - ) - (fill - (type none) - ) - ) - (polyline - (pts - (xy 5.08 -2.54) (xy 7.62 -2.54) - ) - (stroke - (width 0) - (type default) - ) - (fill - (type none) - ) - ) - (polyline - (pts - (xy 5.08 0) (xy 5.08 -2.54) - ) - (stroke - (width 0) - (type default) - ) - (fill - (type none) - ) - ) - (polyline - (pts - (xy 5.08 2.54) (xy 7.62 2.54) - ) - (stroke - (width 0) - (type default) - ) - (fill - (type none) - ) - ) - (polyline - (pts - (xy -2.54 0) (xy -5.08 0) (xy -5.08 2.54) - ) - (stroke - (width 0) - (type default) - ) - (fill - (type none) - ) - ) - (polyline - (pts - (xy 2.54 0) (xy 5.08 0) (xy 5.08 2.54) - ) - (stroke - (width 0) - (type default) - ) - (fill - (type none) - ) - ) - (polyline - (pts - (xy -3.556 -4.826) (xy -1.524 -4.826) (xy -2.54 -2.794) (xy -3.556 -4.826) + (xy -5.08 -2.54) (xy -7.62 -2.54) ) (stroke (width 0) @@ -2583,6 +2398,76 @@ (type none) ) ) + (polyline + (pts + (xy -3.556 -4.826) (xy -1.524 -4.826) (xy -2.54 -2.794) (xy -3.556 -4.826) + ) + (stroke + (width 0) + (type default) + ) + (fill + (type none) + ) + ) + (rectangle + (start -2.54 6.35) + (end 2.54 -6.35) + (stroke + (width 0) + (type default) + ) + (fill + (type none) + ) + ) + (circle + (center -2.54 0) + (radius 0.254) + (stroke + (width 0) + (type default) + ) + (fill + (type outline) + ) + ) + (polyline + (pts + (xy -2.54 0) (xy -5.08 0) (xy -5.08 2.54) + ) + (stroke + (width 0) + (type default) + ) + (fill + (type none) + ) + ) + (polyline + (pts + (xy -1.524 4.826) (xy -3.556 4.826) + ) + (stroke + (width 0) + (type default) + ) + (fill + (type none) + ) + ) + (polyline + (pts + (xy -1.524 -2.794) (xy -3.556 -2.794) + ) + (stroke + (width 0) + (type default) + ) + (fill + (type none) + ) + ) (polyline (pts (xy -1.016 -1.016) (xy 1.016 -1.016) (xy 0 1.016) (xy -1.016 -1.016) @@ -2595,6 +2480,76 @@ (type none) ) ) + (circle + (center 0 6.35) + (radius 0.254) + (stroke + (width 0) + (type default) + ) + (fill + (type outline) + ) + ) + (polyline + (pts + (xy 0 6.35) (xy 0 7.62) + ) + (stroke + (width 0) + (type default) + ) + (fill + (type none) + ) + ) + (polyline + (pts + (xy 0 1.27) (xy 0 6.35) + ) + (stroke + (width 0) + (type default) + ) + (fill + (type none) + ) + ) + (polyline + (pts + (xy 0 -6.35) (xy 0 1.27) + ) + (stroke + (width 0) + (type default) + ) + (fill + (type none) + ) + ) + (circle + (center 0 -6.35) + (radius 0.254) + (stroke + (width 0) + (type default) + ) + (fill + (type outline) + ) + ) + (polyline + (pts + (xy 0 -7.62) (xy 0 -6.35) + ) + (stroke + (width 0) + (type default) + ) + (fill + (type none) + ) + ) (polyline (pts (xy 1.016 1.016) (xy 0.762 1.016) (xy -1.016 1.016) (xy -1.016 0.508) @@ -2609,7 +2564,7 @@ ) (polyline (pts - (xy 3.556 -4.826) (xy 1.524 -4.826) (xy 2.54 -2.794) (xy 3.556 -4.826) + (xy 1.524 4.826) (xy 3.556 4.826) ) (stroke (width 0) @@ -2619,6 +2574,41 @@ (type none) ) ) + (polyline + (pts + (xy 1.524 -2.794) (xy 3.556 -2.794) + ) + (stroke + (width 0) + (type default) + ) + (fill + (type none) + ) + ) + (polyline + (pts + (xy 2.54 0) (xy 5.08 0) (xy 5.08 2.54) + ) + (stroke + (width 0) + (type default) + ) + (fill + (type none) + ) + ) + (circle + (center 2.54 0) + (radius 0.254) + (stroke + (width 0) + (type default) + ) + (fill + (type outline) + ) + ) (polyline (pts (xy 3.556 2.794) (xy 1.524 2.794) (xy 2.54 4.826) (xy 3.556 2.794) @@ -2631,26 +2621,40 @@ (type none) ) ) - (circle - (center 0 6.35) - (radius 0.254) + (polyline + (pts + (xy 3.556 -4.826) (xy 1.524 -4.826) (xy 2.54 -2.794) (xy 3.556 -4.826) + ) (stroke (width 0) (type default) ) (fill - (type outline) + (type none) ) ) - (circle - (center 2.54 0) - (radius 0.254) + (polyline + (pts + (xy 5.08 2.54) (xy 7.62 2.54) + ) (stroke (width 0) (type default) ) (fill - (type outline) + (type none) + ) + ) + (polyline + (pts + (xy 5.08 0) (xy 5.08 -2.54) + ) + (stroke + (width 0) + (type default) + ) + (fill + (type none) ) ) (circle @@ -2664,8 +2668,38 @@ (type outline) ) ) + (polyline + (pts + (xy 5.08 -2.54) (xy 7.62 -2.54) + ) + (stroke + (width 0) + (type default) + ) + (fill + (type none) + ) + ) ) (symbol "USBLC6-2SC6_1_1" + (pin passive line + (at -10.16 2.54 0) + (length 2.54) + (name "I/O1" + (effects + (font + (size 1.27 1.27) + ) + ) + ) + (number "6" + (effects + (font + (size 1.27 1.27) + ) + ) + ) + ) (pin passive line (at -10.16 -2.54 0) (length 2.54) @@ -2684,60 +2718,6 @@ ) ) ) - (pin passive line - (at 0 -10.16 90) - (length 2.54) - (name "GND" - (effects - (font - (size 1.27 1.27) - ) - ) - ) - (number "2" - (effects - (font - (size 1.27 1.27) - ) - ) - ) - ) - (pin passive line - (at 10.16 -2.54 180) - (length 2.54) - (name "I/O2" - (effects - (font - (size 1.27 1.27) - ) - ) - ) - (number "3" - (effects - (font - (size 1.27 1.27) - ) - ) - ) - ) - (pin passive line - (at 10.16 2.54 180) - (length 2.54) - (name "I/O2" - (effects - (font - (size 1.27 1.27) - ) - ) - ) - (number "4" - (effects - (font - (size 1.27 1.27) - ) - ) - ) - ) (pin passive line (at 0 10.16 270) (length 2.54) @@ -2757,16 +2737,52 @@ ) ) (pin passive line - (at -10.16 2.54 0) + (at 0 -10.16 90) (length 2.54) - (name "I/O1" + (name "GND" (effects (font (size 1.27 1.27) ) ) ) - (number "6" + (number "2" + (effects + (font + (size 1.27 1.27) + ) + ) + ) + ) + (pin passive line + (at 10.16 2.54 180) + (length 2.54) + (name "I/O2" + (effects + (font + (size 1.27 1.27) + ) + ) + ) + (number "4" + (effects + (font + (size 1.27 1.27) + ) + ) + ) + ) + (pin passive line + (at 10.16 -2.54 180) + (length 2.54) + (name "I/O2" + (effects + (font + (size 1.27 1.27) + ) + ) + ) + (number "3" (effects (font (size 1.27 1.27) @@ -2775,6 +2791,7 @@ ) ) ) + (embedded_fonts no) ) (symbol "Regulator_Linear:LM1117-3.3" (pin_names @@ -2859,6 +2876,24 @@ ) ) (symbol "LM1117-3.3_1_1" + (pin power_in line + (at -7.62 0 0) + (length 2.54) + (name "VI" + (effects + (font + (size 1.27 1.27) + ) + ) + ) + (number "3" + (effects + (font + (size 1.27 1.27) + ) + ) + ) + ) (pin power_in line (at 0 -7.62 90) (length 2.54) @@ -2895,29 +2930,14 @@ ) ) ) - (pin power_in line - (at -7.62 0 0) - (length 2.54) - (name "VI" - (effects - (font - (size 1.27 1.27) - ) - ) - ) - (number "3" - (effects - (font - (size 1.27 1.27) - ) - ) - ) - ) ) + (embedded_fonts no) ) (symbol "Switch:SW_DIP_x01" (pin_names - (offset 0) hide) + (offset 0) + (hide yes) + ) (exclude_from_sim no) (in_bom yes) (on_board yes) @@ -3069,6 +3089,7 @@ ) ) ) + (embedded_fonts no) ) (symbol "elements:B0505S" (pin_names @@ -3143,24 +3164,6 @@ ) ) (symbol "B0505S_1_1" - (pin power_in line - (at -10.16 -2.54 0) - (length 5.08) - (name "GND" - (effects - (font - (size 1.27 1.27) - ) - ) - ) - (number "1" - (effects - (font - (size 1.27 1.27) - ) - ) - ) - ) (pin power_in line (at -10.16 2.54 0) (length 5.08) @@ -3179,17 +3182,17 @@ ) ) ) - (pin power_out line - (at 10.16 -2.54 180) + (pin power_in line + (at -10.16 -2.54 0) (length 5.08) - (name "0V" + (name "GND" (effects (font (size 1.27 1.27) ) ) ) - (number "3" + (number "1" (effects (font (size 1.27 1.27) @@ -3215,11 +3218,32 @@ ) ) ) + (pin power_out line + (at 10.16 -2.54 180) + (length 5.08) + (name "0V" + (effects + (font + (size 1.27 1.27) + ) + ) + ) + (number "3" + (effects + (font + (size 1.27 1.27) + ) + ) + ) + ) ) + (embedded_fonts no) ) (symbol "elements:PESD1CAN" (pin_names - (offset 0.762) hide) + (offset 0.762) + (hide yes) + ) (exclude_from_sim no) (in_bom yes) (on_board yes) @@ -3285,42 +3309,6 @@ (type none) ) ) - (polyline - (pts - (xy -3.556 -5.08) (xy 3.81 -5.08) - ) - (stroke - (width 0) - (type default) - ) - (fill - (type none) - ) - ) - (polyline - (pts - (xy -3.556 0) (xy 3.81 0) - ) - (stroke - (width 0) - (type default) - ) - (fill - (type none) - ) - ) - (polyline - (pts - (xy -3.81 -3.81) (xy -3.81 -6.35) (xy -3.81 -6.35) - ) - (stroke - (width 0.2032) - (type default) - ) - (fill - (type none) - ) - ) (polyline (pts (xy -3.81 1.27) (xy -3.81 -1.27) (xy -3.81 -1.27) @@ -3333,42 +3321,6 @@ (type none) ) ) - (polyline - (pts - (xy 3.81 -3.81) (xy 3.81 -6.35) (xy 3.81 -6.35) - ) - (stroke - (width 0.2032) - (type default) - ) - (fill - (type none) - ) - ) - (polyline - (pts - (xy 3.81 1.27) (xy 3.81 -1.27) (xy 3.81 -1.27) - ) - (stroke - (width 0.2032) - (type default) - ) - (fill - (type none) - ) - ) - (polyline - (pts - (xy -3.81 -3.81) (xy -4.318 -3.81) (xy -4.318 -4.064) (xy -4.318 -4.064) - ) - (stroke - (width 0.2032) - (type default) - ) - (fill - (type none) - ) - ) (polyline (pts (xy -3.81 1.27) (xy -4.318 1.27) (xy -4.318 1.016) (xy -4.318 1.016) @@ -3383,7 +3335,7 @@ ) (polyline (pts - (xy 3.81 -6.35) (xy 4.318 -6.35) (xy 4.318 -6.096) (xy 4.318 -6.096) + (xy -3.81 -3.81) (xy -3.81 -6.35) (xy -3.81 -6.35) ) (stroke (width 0.2032) @@ -3395,7 +3347,7 @@ ) (polyline (pts - (xy 3.81 -3.81) (xy 3.302 -3.81) (xy 3.302 -4.064) (xy 3.302 -4.064) + (xy -3.81 -3.81) (xy -4.318 -3.81) (xy -4.318 -4.064) (xy -4.318 -4.064) ) (stroke (width 0.2032) @@ -3407,19 +3359,7 @@ ) (polyline (pts - (xy 3.81 -1.27) (xy 4.318 -1.27) (xy 4.318 -1.016) (xy 4.318 -1.016) - ) - (stroke - (width 0.2032) - (type default) - ) - (fill - (type none) - ) - ) - (polyline - (pts - (xy 3.81 0) (xy 6.35 0) (xy 6.35 -5.08) (xy 3.81 -5.08) + (xy -3.556 0) (xy 3.81 0) ) (stroke (width 0) @@ -3431,7 +3371,19 @@ ) (polyline (pts - (xy 3.81 1.27) (xy 3.302 1.27) (xy 3.302 1.016) (xy 3.302 1.016) + (xy -3.556 -5.08) (xy 3.81 -5.08) + ) + (stroke + (width 0) + (type default) + ) + (fill + (type none) + ) + ) + (polyline + (pts + (xy -3.302 -1.016) (xy -3.302 -1.27) (xy -3.81 -1.27) (xy -3.81 -1.27) (xy -3.81 -1.27) ) (stroke (width 0.2032) @@ -3455,7 +3407,7 @@ ) (polyline (pts - (xy -3.302 -1.016) (xy -3.302 -1.27) (xy -3.81 -1.27) (xy -3.81 -1.27) (xy -3.81 -1.27) + (xy -1.27 -1.27) (xy -3.81 0) (xy -1.27 1.27) (xy -1.27 -1.27) (xy -1.27 -1.27) (xy -1.27 -1.27) ) (stroke (width 0.2032) @@ -3479,7 +3431,7 @@ ) (polyline (pts - (xy -1.27 -1.27) (xy -3.81 0) (xy -1.27 1.27) (xy -1.27 -1.27) (xy -1.27 -1.27) (xy -1.27 -1.27) + (xy 1.27 1.27) (xy 3.81 0) (xy 1.27 -1.27) (xy 1.27 1.27) (xy 1.27 1.27) (xy 1.27 1.27) ) (stroke (width 0.2032) @@ -3503,7 +3455,79 @@ ) (polyline (pts - (xy 1.27 1.27) (xy 3.81 0) (xy 1.27 -1.27) (xy 1.27 1.27) (xy 1.27 1.27) (xy 1.27 1.27) + (xy 3.81 1.27) (xy 3.81 -1.27) (xy 3.81 -1.27) + ) + (stroke + (width 0.2032) + (type default) + ) + (fill + (type none) + ) + ) + (polyline + (pts + (xy 3.81 1.27) (xy 3.302 1.27) (xy 3.302 1.016) (xy 3.302 1.016) + ) + (stroke + (width 0.2032) + (type default) + ) + (fill + (type none) + ) + ) + (polyline + (pts + (xy 3.81 0) (xy 6.35 0) (xy 6.35 -5.08) (xy 3.81 -5.08) + ) + (stroke + (width 0) + (type default) + ) + (fill + (type none) + ) + ) + (polyline + (pts + (xy 3.81 -1.27) (xy 4.318 -1.27) (xy 4.318 -1.016) (xy 4.318 -1.016) + ) + (stroke + (width 0.2032) + (type default) + ) + (fill + (type none) + ) + ) + (polyline + (pts + (xy 3.81 -3.81) (xy 3.81 -6.35) (xy 3.81 -6.35) + ) + (stroke + (width 0.2032) + (type default) + ) + (fill + (type none) + ) + ) + (polyline + (pts + (xy 3.81 -3.81) (xy 3.302 -3.81) (xy 3.302 -4.064) (xy 3.302 -4.064) + ) + (stroke + (width 0.2032) + (type default) + ) + (fill + (type none) + ) + ) + (polyline + (pts + (xy 3.81 -6.35) (xy 4.318 -6.35) (xy 4.318 -6.096) (xy 4.318 -6.096) ) (stroke (width 0.2032) @@ -3568,6 +3592,7 @@ ) ) ) + (embedded_fonts no) ) (symbol "power:Earth" (power) @@ -3684,7 +3709,8 @@ (symbol "Earth_1_1" (pin power_in line (at 0 0 270) - (length 0) hide + (length 0) + (hide yes) (name "Earth" (effects (font @@ -3701,6 +3727,7 @@ ) ) ) + (embedded_fonts no) ) (symbol "stm32-rescue:+3.3V" (power) @@ -3769,7 +3796,7 @@ ) (polyline (pts - (xy 0 0) (xy 0 2.54) + (xy 0 2.54) (xy 0.762 1.27) ) (stroke (width 0) @@ -3781,7 +3808,7 @@ ) (polyline (pts - (xy 0 2.54) (xy 0.762 1.27) + (xy 0 0) (xy 0 2.54) ) (stroke (width 0) @@ -3795,7 +3822,8 @@ (symbol "+3.3V_1_1" (pin power_in line (at 0 0 90) - (length 0) hide + (length 0) + (hide yes) (name "+3V3" (effects (font @@ -3812,6 +3840,7 @@ ) ) ) + (embedded_fonts no) ) (symbol "stm32-rescue:+5V" (power) @@ -3880,7 +3909,7 @@ ) (polyline (pts - (xy 0 0) (xy 0 2.54) + (xy 0 2.54) (xy 0.762 1.27) ) (stroke (width 0) @@ -3892,7 +3921,7 @@ ) (polyline (pts - (xy 0 2.54) (xy 0.762 1.27) + (xy 0 0) (xy 0 2.54) ) (stroke (width 0) @@ -3906,7 +3935,8 @@ (symbol "+5V_1_1" (pin power_in line (at 0 0 90) - (length 0) hide + (length 0) + (hide yes) (name "+5V" (effects (font @@ -3923,9 +3953,12 @@ ) ) ) + (embedded_fonts no) ) (symbol "stm32-rescue:C" - (pin_numbers hide) + (pin_numbers + (hide yes) + ) (pin_names (offset 0.254) ) @@ -3989,7 +4022,7 @@ (symbol "C_0_1" (polyline (pts - (xy -2.032 -0.762) (xy 2.032 -0.762) + (xy -2.032 0.762) (xy 2.032 0.762) ) (stroke (width 0.508) @@ -4001,7 +4034,7 @@ ) (polyline (pts - (xy -2.032 0.762) (xy 2.032 0.762) + (xy -2.032 -0.762) (xy 2.032 -0.762) ) (stroke (width 0.508) @@ -4050,10 +4083,13 @@ ) ) ) + (embedded_fonts no) ) (symbol "stm32-rescue:CONN_01X01" (pin_names - (offset 1.016) hide) + (offset 1.016) + (hide yes) + ) (exclude_from_sim no) (in_bom yes) (on_board yes) @@ -4111,8 +4147,8 @@ ) (symbol "CONN_01X01_0_1" (rectangle - (start -1.27 0.127) - (end 0.254 -0.127) + (start -1.27 1.27) + (end 1.27 -1.27) (stroke (width 0) (type default) @@ -4122,8 +4158,8 @@ ) ) (rectangle - (start -1.27 1.27) - (end 1.27 -1.27) + (start -1.27 0.127) + (end 0.254 -0.127) (stroke (width 0) (type default) @@ -4153,9 +4189,12 @@ ) ) ) + (embedded_fonts no) ) (symbol "stm32-rescue:CP" - (pin_numbers hide) + (pin_numbers + (hide yes) + ) (pin_names (offset 0.254) ) @@ -4263,17 +4302,6 @@ (type none) ) ) - (rectangle - (start 2.286 -0.508) - (end -2.286 -1.016) - (stroke - (width 0) - (type default) - ) - (fill - (type outline) - ) - ) (rectangle (start 2.286 1.016) (end -2.286 1.016) @@ -4296,6 +4324,17 @@ (type none) ) ) + (rectangle + (start 2.286 -0.508) + (end -2.286 -1.016) + (stroke + (width 0) + (type default) + ) + (fill + (type outline) + ) + ) ) (symbol "CP_1_1" (pin passive line @@ -4335,6 +4374,7 @@ ) ) ) + (embedded_fonts no) ) (symbol "stm32-rescue:GND" (power) @@ -4405,7 +4445,8 @@ (symbol "GND_1_1" (pin power_in line (at 0 0 270) - (length 0) hide + (length 0) + (hide yes) (name "GND" (effects (font @@ -4422,10 +4463,13 @@ ) ) ) + (embedded_fonts no) ) (symbol "stm32-rescue:LED-RESCUE-stm32" (pin_names - (offset 1.016) hide) + (offset 1.016) + (hide yes) + ) (exclude_from_sim no) (in_bom yes) (on_board yes) @@ -4482,10 +4526,22 @@ (symbol "LED-RESCUE-stm32_0_1" (polyline (pts - (xy -1.27 -1.27) (xy -1.27 1.27) + (xy -3.048 -0.762) (xy -4.572 -2.286) (xy -3.81 -2.286) (xy -4.572 -2.286) (xy -4.572 -1.524) ) (stroke - (width 0.2032) + (width 0) + (type default) + ) + (fill + (type none) + ) + ) + (polyline + (pts + (xy -1.778 -0.762) (xy -3.302 -2.286) (xy -2.54 -2.286) (xy -3.302 -2.286) (xy -3.302 -1.524) + ) + (stroke + (width 0) (type default) ) (fill @@ -4506,7 +4562,7 @@ ) (polyline (pts - (xy 1.27 -1.27) (xy 1.27 1.27) (xy -1.27 0) (xy 1.27 -1.27) + (xy -1.27 -1.27) (xy -1.27 1.27) ) (stroke (width 0.2032) @@ -4518,22 +4574,10 @@ ) (polyline (pts - (xy -3.048 -0.762) (xy -4.572 -2.286) (xy -3.81 -2.286) (xy -4.572 -2.286) (xy -4.572 -1.524) + (xy 1.27 -1.27) (xy 1.27 1.27) (xy -1.27 0) (xy 1.27 -1.27) ) (stroke - (width 0) - (type default) - ) - (fill - (type none) - ) - ) - (polyline - (pts - (xy -1.778 -0.762) (xy -3.302 -2.286) (xy -2.54 -2.286) (xy -3.302 -2.286) (xy -3.302 -1.524) - ) - (stroke - (width 0) + (width 0.2032) (type default) ) (fill @@ -4579,12 +4623,17 @@ ) ) ) + (embedded_fonts no) ) (symbol "stm32-rescue:PWR_FLAG" (power) - (pin_numbers hide) + (pin_numbers + (hide yes) + ) (pin_names - (offset 0) hide) + (offset 0) + (hide yes) + ) (exclude_from_sim no) (in_bom yes) (on_board yes) @@ -4666,9 +4715,12 @@ ) ) ) + (embedded_fonts no) ) (symbol "stm32-rescue:R" - (pin_numbers hide) + (pin_numbers + (hide yes) + ) (pin_names (offset 0) ) @@ -4778,8 +4830,75 @@ ) ) ) + (embedded_fonts no) ) ) + (text "LED indicators" + (exclude_from_sim no) + (at 17.907 51.689 0) + (effects + (font + (size 1.524 1.524) + ) + (justify left bottom) + ) + (uuid "141d5043-d7f0-4369-be21-76190b1dfe8a") + ) + (text "Isolated CAN" + (exclude_from_sim no) + (at 104.013 52.705 0) + (effects + (font + (size 1.524 1.524) + ) + (justify right bottom) + ) + (uuid "993a7d78-4b61-405b-8597-b7b613a17852") + ) + (text "Debugging\nholes" + (exclude_from_sim no) + (at 124.333 20.193 0) + (effects + (font + (size 1.4986 1.4986) + ) + (justify left bottom) + ) + (uuid "a8e22bdb-ed86-4ded-a720-888bfd6a9fe2") + ) + (text "3.3V MCU power source" + (exclude_from_sim no) + (at 15.113 75.692 0) + (effects + (font + (size 1.524 1.524) + ) + (justify left bottom) + ) + (uuid "cc392c5f-4618-4acb-9251-145379cd73d0") + ) + (text "Nrst\nBoot0\nVcc\nGnd\nSWDIO\nSWCLK" + (exclude_from_sim no) + (at 142.621 45.593 0) + (effects + (font + (size 1.4986 1.4986) + ) + (justify left bottom) + ) + (uuid "f0518a68-8164-45cd-a7a7-91d052673746") + ) + (text "CAN\nconnectors" + (exclude_from_sim no) + (at 15.24 19.812 0) + (effects + (font + (size 1.4986 1.4986) + ) + (justify left bottom) + ) + (uuid "f0f97168-43e8-4b2e-be1f-333015581e13") + ) (junction (at 85.979 24.003) (diameter 0) @@ -5812,75 +5931,8 @@ ) (uuid "fdc813e7-60a9-4b91-8fb9-6f63f08fbbd3") ) - (text "LED indicators" - (exclude_from_sim no) - (at 17.907 51.689 0) - (effects - (font - (size 1.524 1.524) - ) - (justify left bottom) - ) - (uuid "141d5043-d7f0-4369-be21-76190b1dfe8a") - ) - (text "Isolated CAN" - (exclude_from_sim no) - (at 104.013 52.705 0) - (effects - (font - (size 1.524 1.524) - ) - (justify right bottom) - ) - (uuid "993a7d78-4b61-405b-8597-b7b613a17852") - ) - (text "Debugging\nholes" - (exclude_from_sim no) - (at 124.333 20.193 0) - (effects - (font - (size 1.4986 1.4986) - ) - (justify left bottom) - ) - (uuid "a8e22bdb-ed86-4ded-a720-888bfd6a9fe2") - ) - (text "3.3V MCU power source" - (exclude_from_sim no) - (at 15.113 75.692 0) - (effects - (font - (size 1.524 1.524) - ) - (justify left bottom) - ) - (uuid "cc392c5f-4618-4acb-9251-145379cd73d0") - ) - (text "Nrst\nBoot0\nVcc\nGnd\nSWDIO\nSWCLK" - (exclude_from_sim no) - (at 142.621 45.593 0) - (effects - (font - (size 1.4986 1.4986) - ) - (justify left bottom) - ) - (uuid "f0518a68-8164-45cd-a7a7-91d052673746") - ) - (text "CAN\nconnectors" - (exclude_from_sim no) - (at 15.24 19.812 0) - (effects - (font - (size 1.4986 1.4986) - ) - (justify left bottom) - ) - (uuid "f0f97168-43e8-4b2e-be1f-333015581e13") - ) (label "CANH" (at 106.299 26.543 0) - (fields_autoplaced yes) (effects (font (size 1.27 1.27) @@ -5891,7 +5943,6 @@ ) (label "CAN_Tx" (at 105.918 128.778 180) - (fields_autoplaced yes) (effects (font (size 1.524 1.524) @@ -5902,7 +5953,6 @@ ) (label "CANL" (at 16.256 39.116 90) - (fields_autoplaced yes) (effects (font (size 1.27 1.27) @@ -5913,7 +5963,6 @@ ) (label "CANH" (at 57.15 22.86 180) - (fields_autoplaced yes) (effects (font (size 1.27 1.27) @@ -5924,7 +5973,6 @@ ) (label "CANL" (at 57.15 27.94 180) - (fields_autoplaced yes) (effects (font (size 1.27 1.27) @@ -5935,7 +5983,6 @@ ) (label "NRST" (at 136.779 32.385 180) - (fields_autoplaced yes) (effects (font (size 1.524 1.524) @@ -5946,7 +5993,6 @@ ) (label "LED0" (at 105.918 144.018 180) - (fields_autoplaced yes) (effects (font (size 1.524 1.524) @@ -5957,7 +6003,6 @@ ) (label "LED1" (at 21.717 65.659 180) - (fields_autoplaced yes) (effects (font (size 1.524 1.524) @@ -5968,7 +6013,6 @@ ) (label "CANL" (at 106.299 29.083 0) - (fields_autoplaced yes) (effects (font (size 1.27 1.27) @@ -5979,7 +6023,6 @@ ) (label "SWDIO" (at 138.938 138.938 0) - (fields_autoplaced yes) (effects (font (size 1.27 1.27) @@ -5990,7 +6033,6 @@ ) (label "CAN_Rx" (at 105.918 126.238 180) - (fields_autoplaced yes) (effects (font (size 1.524 1.524) @@ -6001,7 +6043,6 @@ ) (label "CAN_Tx" (at 85.979 29.083 180) - (fields_autoplaced yes) (effects (font (size 1.524 1.524) @@ -6012,7 +6053,6 @@ ) (label "CANL" (at 44.196 22.098 0) - (fields_autoplaced yes) (effects (font (size 1.27 1.27) @@ -6023,7 +6063,6 @@ ) (label "SWDIO" (at 136.779 42.545 180) - (fields_autoplaced yes) (effects (font (size 1.27 1.27) @@ -6034,7 +6073,6 @@ ) (label "CANH" (at 39.116 22.098 180) - (fields_autoplaced yes) (effects (font (size 1.27 1.27) @@ -6045,7 +6083,6 @@ ) (label "LED1" (at 138.938 126.238 0) - (fields_autoplaced yes) (effects (font (size 1.524 1.524) @@ -6056,7 +6093,6 @@ ) (label "BOOT0" (at 136.779 34.925 180) - (fields_autoplaced yes) (effects (font (size 1.524 1.524) @@ -6067,7 +6103,6 @@ ) (label "SWCLK" (at 136.779 45.085 180) - (fields_autoplaced yes) (effects (font (size 1.27 1.27) @@ -6078,7 +6113,6 @@ ) (label "BOOT0" (at 105.918 83.058 180) - (fields_autoplaced yes) (effects (font (size 1.524 1.524) @@ -6089,7 +6123,6 @@ ) (label "CANH" (at 31.496 31.496 180) - (fields_autoplaced yes) (effects (font (size 1.27 1.27) @@ -6100,7 +6133,6 @@ ) (label "SWCLK" (at 138.938 141.478 0) - (fields_autoplaced yes) (effects (font (size 1.27 1.27) @@ -6111,7 +6143,6 @@ ) (label "CAN_Rx" (at 85.979 26.543 180) - (fields_autoplaced yes) (effects (font (size 1.524 1.524) @@ -6122,7 +6153,6 @@ ) (label "NRST" (at 105.918 77.978 180) - (fields_autoplaced yes) (effects (font (size 1.524 1.524) @@ -6133,7 +6163,6 @@ ) (label "LED0" (at 21.717 58.039 180) - (fields_autoplaced yes) (effects (font (size 1.524 1.524) @@ -11232,4 +11261,5 @@ (page "1") ) ) + (embedded_fonts no) ) diff --git a/F0:F030,F042,F072/usbcan_ringbuffer/openocd.cfg b/F0:F030,F042,F072/usbcan_ringbuffer/openocd.cfg index 4d268f6..ca88787 100644 --- a/F0:F030,F042,F072/usbcan_ringbuffer/openocd.cfg +++ b/F0:F030,F042,F072/usbcan_ringbuffer/openocd.cfg @@ -1,96 +1,4 @@ -# script for stm32f0x family +set FLASH_SIZE 0x8000 -# -# stm32 devices support SWD transports only. -# source [find interface/stlink-v2-1.cfg] -source [find target/swj-dp.tcl] -source [find mem_helper.tcl] - -if { [info exists CHIPNAME] } { - set _CHIPNAME $CHIPNAME -} else { - set _CHIPNAME stm32f0x -} - -set _ENDIAN little - -# Work-area is a space in RAM used for flash programming -# By default use 4kB -if { [info exists WORKAREASIZE] } { - set _WORKAREASIZE $WORKAREASIZE -} else { - set _WORKAREASIZE 0x1000 -} - -# Allow overriding the Flash bank size -if { [info exists FLASH_SIZE] } { - set _FLASH_SIZE $FLASH_SIZE -} else { - # autodetect size - set _FLASH_SIZE 0 -} - -#jtag scan chain -if { [info exists CPUTAPID] } { - set _CPUTAPID $CPUTAPID -} else { - # See STM Document RM0091 - # Section 29.5.3 - set _CPUTAPID 0x0bb11477 -} - -swj_newdap $_CHIPNAME cpu -irlen 4 -ircapture 0x1 -irmask 0xf -expected-id $_CPUTAPID -dap create $_CHIPNAME.dap -chain-position $_CHIPNAME.cpu - -set _TARGETNAME $_CHIPNAME.cpu -target create $_TARGETNAME cortex_m -endian $_ENDIAN -dap $_CHIPNAME.dap - -$_TARGETNAME configure -work-area-phys 0x20000000 -work-area-size $_WORKAREASIZE -work-area-backup 0 - -# flash size will be probed -set _FLASHNAME $_CHIPNAME.flash -flash bank $_FLASHNAME stm32f1x 0x08000000 $_FLASH_SIZE 0 0 $_TARGETNAME - -# adapter speed should be <= F_CPU/6. F_CPU after reset is 8MHz, so use F_JTAG = 1MHz -adapter speed 1000 - -adapter srst delay 100 - -reset_config srst_nogate - -if {![using_hla]} { - # if srst is not fitted use SYSRESETREQ to - # perform a soft reset - cortex_m reset_config sysresetreq -} - -proc stm32f0x_default_reset_start {} { - # Reset clock is HSI (8 MHz) - adapter speed 1000 -} - -proc stm32f0x_default_examine_end {} { - # Enable debug during low power modes (uses more power) - mmw 0x40015804 0x00000006 0 ;# DBGMCU_CR |= DBG_STANDBY | DBG_STOP - - # Stop watchdog counters during halt - mmw 0x40015808 0x00001800 0 ;# DBGMCU_APB1_FZ |= DBG_IWDG_STOP | DBG_WWDG_STOP -} - -proc stm32f0x_default_reset_init {} { - # Configure PLL to boost clock to HSI x 6 (48 MHz) - mww 0x40021004 0x00100000 ;# RCC_CFGR = PLLMUL[2] - mmw 0x40021000 0x01000000 0 ;# RCC_CR[31:16] |= PLLON - mww 0x40022000 0x00000011 ;# FLASH_ACR = PRFTBE | LATENCY[0] - sleep 10 ;# Wait for PLL to lock - mmw 0x40021004 0x00000002 0 ;# RCC_CFGR |= SW[1] - - # Boost JTAG frequency - adapter speed 8000 -} - -# Default hooks -$_TARGETNAME configure -event examine-end { stm32f0x_default_examine_end } -$_TARGETNAME configure -event reset-start { stm32f0x_default_reset_start } -$_TARGETNAME configure -event reset-init { stm32f0x_default_reset_init } +source [find target/stm32f0x.cfg]