auto-sync
This commit is contained in:
parent
af24ccae70
commit
4d6206c1e4
|
@ -205,7 +205,7 @@
|
|||
</toolChain>
|
||||
</folderInfo>
|
||||
<sourceEntries>
|
||||
<entry excluding="chibios/os/hal/platforms/STM32/RTCv1|chibios/os/hal/platforms/STM32/GPIOv1|chibios/os/ports/GCC/ARMCMx/STM32F1xx|chibios/os/hal/platforms/STM32F1xx|chibios/boards/ST_NUCLEO_F103RB|config/stm32f0egt|egt2can.cpp|chibios/boards/simulator|chibios/boards/OLIMEX_STM32_E407|chibios/boards/ST_STM32F0_DISCOVERY|chibios/os/ports/GCC/ARMCMx/STM32F0xx|hw_layer/stm32f0|chibios/os/hal/platforms/STM32/I2Cv2|chibios/os/hal/platforms/STM32/SPIv2|chibios/os/hal/platforms/STM32/USARTv2|chibios/os/ports/IAR|chibios/os/hal/platforms/STM32F0xx|chibios/os/hal/platforms/Win32|chibios/os/ports/GCC/ARMCMx/chcore_v6m.c|chibios/os/ports/GCC/SIMIA32|chibios/os/ports/IAR/ARMCMx/chcore_v6m.c" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
|
||||
<entry excluding="chibios/os/hal/platforms/STM32/USBv1|chibios/os/hal/platforms/STM32/RTCv1|chibios/os/hal/platforms/STM32/GPIOv1|chibios/os/ports/GCC/ARMCMx/STM32F1xx|chibios/os/hal/platforms/STM32F1xx|chibios/boards/ST_NUCLEO_F103RB|config/stm32f0egt|egt2can.cpp|chibios/boards/simulator|chibios/boards/OLIMEX_STM32_E407|chibios/boards/ST_STM32F0_DISCOVERY|chibios/os/ports/GCC/ARMCMx/STM32F0xx|hw_layer/stm32f0|chibios/os/hal/platforms/STM32/I2Cv2|chibios/os/hal/platforms/STM32/SPIv2|chibios/os/hal/platforms/STM32/USARTv2|chibios/os/ports/IAR|chibios/os/hal/platforms/STM32F0xx|chibios/os/hal/platforms/Win32|chibios/os/ports/GCC/ARMCMx/chcore_v6m.c|chibios/os/ports/GCC/SIMIA32|chibios/os/ports/IAR/ARMCMx/chcore_v6m.c" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
|
||||
</sourceEntries>
|
||||
</configuration>
|
||||
</storageModule>
|
||||
|
@ -288,7 +288,7 @@
|
|||
</toolChain>
|
||||
</folderInfo>
|
||||
<sourceEntries>
|
||||
<entry excluding="chibios/os/hal/platforms/STM32/RTCv1|chibios/os/hal/platforms/STM32/GPIOv1|chibios/os/ports/GCC/ARMCMx/STM32F1xx|chibios/os/hal/platforms/STM32F1xx|chibios/boards/ST_NUCLEO_F103RB|config/stm32f0egt|egt2can.cpp|chibios/boards/simulator|chibios/boards/OLIMEX_STM32_E407|chibios/boards/ST_STM32F0_DISCOVERY|chibios/os/ports/GCC/ARMCMx/STM32F0xx|hw_layer/stm32f0|chibios/os/hal/platforms/STM32/I2Cv2|chibios/os/hal/platforms/STM32/SPIv2|chibios/os/hal/platforms/STM32/USARTv2|chibios/os/ports/IAR|chibios/os/hal/platforms/STM32F0xx|chibios/os/hal/platforms/Win32|chibios/os/ports/GCC/ARMCMx/chcore_v6m.c|chibios/os/ports/GCC/SIMIA32|chibios/os/ports/IAR/ARMCMx/chcore_v6m.c" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
|
||||
<entry excluding="chibios/os/hal/platforms/STM32/USBv1|chibios/os/hal/platforms/STM32/RTCv1|chibios/os/hal/platforms/STM32/GPIOv1|chibios/os/ports/GCC/ARMCMx/STM32F1xx|chibios/os/hal/platforms/STM32F1xx|chibios/boards/ST_NUCLEO_F103RB|config/stm32f0egt|egt2can.cpp|chibios/boards/simulator|chibios/boards/OLIMEX_STM32_E407|chibios/boards/ST_STM32F0_DISCOVERY|chibios/os/ports/GCC/ARMCMx/STM32F0xx|hw_layer/stm32f0|chibios/os/hal/platforms/STM32/I2Cv2|chibios/os/hal/platforms/STM32/SPIv2|chibios/os/hal/platforms/STM32/USARTv2|chibios/os/ports/IAR|chibios/os/hal/platforms/STM32F0xx|chibios/os/hal/platforms/Win32|chibios/os/ports/GCC/ARMCMx/chcore_v6m.c|chibios/os/ports/GCC/SIMIA32|chibios/os/ports/IAR/ARMCMx/chcore_v6m.c" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
|
||||
</sourceEntries>
|
||||
</configuration>
|
||||
</storageModule>
|
||||
|
|
|
@ -0,0 +1,243 @@
|
|||
/*
|
||||
ChibiOS/RT - Copyright (C) 2006-2013 Giovanni Di Sirio
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file stm32_usb.h
|
||||
* @brief STM32 USB registers layout header.
|
||||
* @note This file requires definitions from the ST STM32 header files
|
||||
* stm32f10x.h or stm32l1xx.h.
|
||||
*
|
||||
* @addtogroup USB
|
||||
* @{
|
||||
*/
|
||||
|
||||
#ifndef _STM32_USB_H_
|
||||
#define _STM32_USB_H_
|
||||
|
||||
/**
|
||||
* @brief Number of the available endpoints.
|
||||
* @details This value does not include the endpoint 0 which is always present.
|
||||
*/
|
||||
#define USB_ENDOPOINTS_NUMBER 7
|
||||
|
||||
/**
|
||||
* @brief USB registers block.
|
||||
*/
|
||||
typedef struct {
|
||||
/**
|
||||
* @brief Endpoint registers.
|
||||
*/
|
||||
volatile uint32_t EPR[USB_ENDOPOINTS_NUMBER + 1];
|
||||
/*
|
||||
* @brief Reserved space.
|
||||
*/
|
||||
volatile uint32_t _r20[8];
|
||||
/*
|
||||
* @brief Control Register.
|
||||
*/
|
||||
volatile uint32_t CNTR;
|
||||
/*
|
||||
* @brief Interrupt Status Register.
|
||||
*/
|
||||
volatile uint32_t ISTR;
|
||||
/*
|
||||
* @brief Frame Number Register.
|
||||
*/
|
||||
volatile uint32_t FNR;
|
||||
/*
|
||||
* @brief Device Address Register.
|
||||
*/
|
||||
volatile uint32_t DADDR;
|
||||
/*
|
||||
* @brief Buffer Table Address.
|
||||
*/
|
||||
volatile uint32_t BTABLE;
|
||||
} stm32_usb_t;
|
||||
|
||||
/**
|
||||
* @brief USB descriptor registers block.
|
||||
*/
|
||||
typedef struct {
|
||||
/**
|
||||
* @brief TX buffer offset register.
|
||||
*/
|
||||
volatile uint32_t TXADDR0;
|
||||
/**
|
||||
* @brief TX counter register 0.
|
||||
*/
|
||||
volatile uint16_t TXCOUNT0;
|
||||
/**
|
||||
* @brief TX counter register 1.
|
||||
*/
|
||||
volatile uint16_t TXCOUNT1;
|
||||
/**
|
||||
* @brief RX buffer offset register.
|
||||
*/
|
||||
volatile uint32_t RXADDR0;
|
||||
/**
|
||||
* @brief RX counter register 0.
|
||||
*/
|
||||
volatile uint16_t RXCOUNT0;
|
||||
/**
|
||||
* @brief RX counter register 1.
|
||||
*/
|
||||
volatile uint16_t RXCOUNT1;
|
||||
} stm32_usb_descriptor_t;
|
||||
|
||||
/**
|
||||
* @name Register aliases
|
||||
* @{
|
||||
*/
|
||||
#define RXADDR1 TXADDR0
|
||||
#define TXADDR1 RXADDR0
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* @brief USB registers block numeric address.
|
||||
*/
|
||||
#define STM32_USB_BASE (APB1PERIPH_BASE + 0x5C00)
|
||||
|
||||
/**
|
||||
* @brief USB RAM numeric address.
|
||||
*/
|
||||
#define STM32_USBRAM_BASE (APB1PERIPH_BASE + 0x6000)
|
||||
|
||||
/**
|
||||
* @brief Pointer to the USB registers block.
|
||||
*/
|
||||
#define STM32_USB ((stm32_usb_t *)STM32_USB_BASE)
|
||||
|
||||
/**
|
||||
* @brief Pointer to the USB RAM.
|
||||
*/
|
||||
#define STM32_USBRAM ((uint32_t *)STM32_USBRAM_BASE)
|
||||
|
||||
/**
|
||||
* @brief Size of the dedicated packet memory.
|
||||
*/
|
||||
#define USB_PMA_SIZE 512
|
||||
|
||||
/**
|
||||
* @brief Mask of all the toggling bits in the EPR register.
|
||||
*/
|
||||
#define EPR_TOGGLE_MASK (EPR_STAT_TX_MASK | EPR_DTOG_TX | \
|
||||
EPR_STAT_RX_MASK | EPR_DTOG_RX | \
|
||||
EPR_SETUP)
|
||||
|
||||
#define EPR_EA_MASK 0x000F
|
||||
#define EPR_STAT_TX_MASK 0x0030
|
||||
#define EPR_STAT_TX_DIS 0x0000
|
||||
#define EPR_STAT_TX_STALL 0x0010
|
||||
#define EPR_STAT_TX_NAK 0x0020
|
||||
#define EPR_STAT_TX_VALID 0x0030
|
||||
#define EPR_DTOG_TX 0x0040
|
||||
#define EPR_SWBUF_RX EPR_DTOG_TX
|
||||
#define EPR_CTR_TX 0x0080
|
||||
#define EPR_EP_KIND 0x0100
|
||||
#define EPR_EP_DBL_BUF EPR_EP_KIND
|
||||
#define EPR_EP_STATUS_OUT EPR_EP_KIND
|
||||
#define EPR_EP_TYPE_MASK 0x0600
|
||||
#define EPR_EP_TYPE_BULK 0x0000
|
||||
#define EPR_EP_TYPE_CONTROL 0x0200
|
||||
#define EPR_EP_TYPE_ISO 0x0400
|
||||
#define EPR_EP_TYPE_INTERRUPT 0x0600
|
||||
#define EPR_SETUP 0x0800
|
||||
#define EPR_STAT_RX_MASK 0x3000
|
||||
#define EPR_STAT_RX_DIS 0x0000
|
||||
#define EPR_STAT_RX_STALL 0x1000
|
||||
#define EPR_STAT_RX_NAK 0x2000
|
||||
#define EPR_STAT_RX_VALID 0x3000
|
||||
#define EPR_DTOG_RX 0x4000
|
||||
#define EPR_SWBUF_TX EPR_DTOG_RX
|
||||
#define EPR_CTR_RX 0x8000
|
||||
|
||||
#define CNTR_FRES 0x0001
|
||||
#define CNTR_PDWN 0x0002
|
||||
#define CNTR_LP_MODE 0x0004
|
||||
#define CNTR_FSUSP 0x0008
|
||||
#define CNTR_RESUME 0x0010
|
||||
#define CNTR_ESOFM 0x0100
|
||||
#define CNTR_SOFM 0x0200
|
||||
#define CNTR_RESETM 0x0400
|
||||
#define CNTR_SUSPM 0x0800
|
||||
#define CNTR_WKUPM 0x1000
|
||||
#define CNTR_ERRM 0x2000
|
||||
#define CNTR_PMAOVRM 0x4000
|
||||
#define CNTR_CTRM 0x8000
|
||||
|
||||
#define ISTR_EP_ID_MASK 0x000F
|
||||
#define ISTR_DIR 0x0010
|
||||
#define ISTR_ESOF 0x0100
|
||||
#define ISTR_SOF 0x0200
|
||||
#define ISTR_RESET 0x0400
|
||||
#define ISTR_SUSP 0x0800
|
||||
#define ISTR_WKUP 0x1000
|
||||
#define ISTR_ERR 0x2000
|
||||
#define ISTR_PMAOVR 0x4000
|
||||
#define ISTR_CTR 0x8000
|
||||
|
||||
#define FNR_FN_MASK 0x07FF
|
||||
#define FNR_LSOF 0x1800
|
||||
#define FNR_LCK 0x2000
|
||||
#define FNR_RXDM 0x4000
|
||||
#define FNR_RXDP 0x8000
|
||||
|
||||
#define DADDR_ADD_MASK 0x007F
|
||||
#define DADDR_EF 0x0080
|
||||
|
||||
#define RXCOUNT_COUNT_MASK 0x03FF
|
||||
#define TXCOUNT_COUNT_MASK 0x03FF
|
||||
|
||||
#define EPR_SET(ep, epr) \
|
||||
STM32_USB->EPR[ep] = (epr) & ~EPR_TOGGLE_MASK
|
||||
|
||||
#define EPR_TOGGLE(ep, epr) \
|
||||
STM32_USB->EPR[ep] = (STM32_USB->EPR[ep] ^ ((epr) & EPR_TOGGLE_MASK))
|
||||
|
||||
#define EPR_SET_STAT_RX(ep, epr) \
|
||||
STM32_USB->EPR[ep] = (STM32_USB->EPR[ep] & \
|
||||
~(EPR_TOGGLE_MASK & ~EPR_STAT_RX_MASK)) ^ \
|
||||
(epr)
|
||||
|
||||
#define EPR_SET_STAT_TX(ep, epr) \
|
||||
STM32_USB->EPR[ep] = (STM32_USB->EPR[ep] & \
|
||||
~(EPR_TOGGLE_MASK & ~EPR_STAT_TX_MASK)) ^ \
|
||||
(epr)
|
||||
|
||||
#define EPR_CLEAR_CTR_RX(ep) \
|
||||
STM32_USB->EPR[ep] &= ~EPR_CTR_RX & ~EPR_TOGGLE_MASK
|
||||
|
||||
#define EPR_CLEAR_CTR_TX(ep) \
|
||||
STM32_USB->EPR[ep] &= ~EPR_CTR_TX & ~EPR_TOGGLE_MASK
|
||||
|
||||
/**
|
||||
* @brief Returns an endpoint descriptor pointer.
|
||||
*/
|
||||
#define USB_GET_DESCRIPTOR(ep) \
|
||||
((stm32_usb_descriptor_t *)((uint32_t)STM32_USBRAM_BASE + \
|
||||
(uint32_t)STM32_USB->BTABLE * 2 + \
|
||||
(uint32_t)(ep) * \
|
||||
sizeof(stm32_usb_descriptor_t)))
|
||||
|
||||
/**
|
||||
* @brief Converts from a PMA address to a physical address.
|
||||
*/
|
||||
#define USB_ADDR2PTR(addr) \
|
||||
((uint32_t *)((addr) * 2 + STM32_USBRAM_BASE))
|
||||
|
||||
#endif /* _STM32_USB_H_ */
|
||||
|
||||
/** @} */
|
|
@ -0,0 +1,830 @@
|
|||
/*
|
||||
ChibiOS/RT - Copyright (C) 2006-2013 Giovanni Di Sirio
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file STM32/USBv1/usb_lld.c
|
||||
* @brief STM32 USB subsystem low level driver source.
|
||||
*
|
||||
* @addtogroup USB
|
||||
* @{
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "ch.h"
|
||||
#include "hal.h"
|
||||
|
||||
#if HAL_USE_USB || defined(__DOXYGEN__)
|
||||
|
||||
/*===========================================================================*/
|
||||
/* Driver local definitions. */
|
||||
/*===========================================================================*/
|
||||
|
||||
#define BTABLE_ADDR 0x0000
|
||||
|
||||
/*===========================================================================*/
|
||||
/* Driver exported variables. */
|
||||
/*===========================================================================*/
|
||||
|
||||
/** @brief USB1 driver identifier.*/
|
||||
#if STM32_USB_USE_USB1 || defined(__DOXYGEN__)
|
||||
USBDriver USBD1;
|
||||
#endif
|
||||
|
||||
/*===========================================================================*/
|
||||
/* Driver local variables and types. */
|
||||
/*===========================================================================*/
|
||||
|
||||
/**
|
||||
* @brief EP0 state.
|
||||
* @note It is an union because IN and OUT endpoints are never used at the
|
||||
* same time for EP0.
|
||||
*/
|
||||
static union {
|
||||
/**
|
||||
* @brief IN EP0 state.
|
||||
*/
|
||||
USBInEndpointState in;
|
||||
/**
|
||||
* @brief OUT EP0 state.
|
||||
*/
|
||||
USBOutEndpointState out;
|
||||
} ep0_state;
|
||||
|
||||
/**
|
||||
* @brief Buffer for the EP0 setup packets.
|
||||
*/
|
||||
static uint8_t ep0setup_buffer[8];
|
||||
|
||||
/**
|
||||
* @brief EP0 initialization structure.
|
||||
*/
|
||||
static const USBEndpointConfig ep0config = {
|
||||
USB_EP_MODE_TYPE_CTRL,
|
||||
_usb_ep0setup,
|
||||
_usb_ep0in,
|
||||
_usb_ep0out,
|
||||
0x40,
|
||||
0x40,
|
||||
&ep0_state.in,
|
||||
&ep0_state.out,
|
||||
1,
|
||||
ep0setup_buffer
|
||||
};
|
||||
|
||||
/*===========================================================================*/
|
||||
/* Driver local functions. */
|
||||
/*===========================================================================*/
|
||||
|
||||
/**
|
||||
* @brief Resets the packet memory allocator.
|
||||
*
|
||||
* @param[in] usbp pointer to the @p USBDriver object
|
||||
*/
|
||||
static void usb_pm_reset(USBDriver *usbp) {
|
||||
|
||||
/* The first 64 bytes are reserved for the descriptors table. The effective
|
||||
available RAM for endpoint buffers is just 448 bytes.*/
|
||||
usbp->pmnext = 64;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Resets the packet memory allocator.
|
||||
*
|
||||
* @param[in] usbp pointer to the @p USBDriver object
|
||||
* @param[in] size size of the packet buffer to allocate
|
||||
*/
|
||||
static uint32_t usb_pm_alloc(USBDriver *usbp, size_t size) {
|
||||
uint32_t next;
|
||||
|
||||
next = usbp->pmnext;
|
||||
usbp->pmnext += size;
|
||||
chDbgAssert(usbp->pmnext <= USB_PMA_SIZE, "usb_pm_alloc(), #1", "PMA overflow");
|
||||
return next;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Reads from a dedicated packet buffer.
|
||||
*
|
||||
* @param[in] udp pointer to a @p stm32_usb_descriptor_t
|
||||
* @param[out] buf buffer where to copy the packet data
|
||||
* @param[in] n maximum number of bytes to copy. This value must
|
||||
* not exceed the maximum packet size for this endpoint.
|
||||
*
|
||||
* @notapi
|
||||
*/
|
||||
static void usb_packet_read_to_buffer(stm32_usb_descriptor_t *udp,
|
||||
uint8_t *buf, size_t n) {
|
||||
uint32_t *pmap= USB_ADDR2PTR(udp->RXADDR0);
|
||||
|
||||
n = (n + 1) / 2;
|
||||
while (n > 0) {
|
||||
/* Note, this line relies on the Cortex-M3/M4 ability to perform
|
||||
unaligned word accesses.*/
|
||||
*(uint16_t *)buf = (uint16_t)*pmap++;
|
||||
buf += 2;
|
||||
n--;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Reads from a dedicated packet buffer.
|
||||
*
|
||||
* @param[in] udp pointer to a @p stm32_usb_descriptor_t
|
||||
* @param[in] iqp pointer to an @p InputQueue object
|
||||
* @param[in] n maximum number of bytes to copy. This value must
|
||||
* not exceed the maximum packet size for this endpoint.
|
||||
*
|
||||
* @notapi
|
||||
*/
|
||||
static void usb_packet_read_to_queue(stm32_usb_descriptor_t *udp,
|
||||
InputQueue *iqp, size_t n) {
|
||||
size_t nhw;
|
||||
uint32_t *pmap= USB_ADDR2PTR(udp->RXADDR0);
|
||||
|
||||
nhw = n / 2;
|
||||
while (nhw > 0) {
|
||||
uint32_t w;
|
||||
|
||||
w = *pmap++;
|
||||
*iqp->q_wrptr++ = (uint8_t)w;
|
||||
if (iqp->q_wrptr >= iqp->q_top)
|
||||
iqp->q_wrptr = iqp->q_buffer;
|
||||
*iqp->q_wrptr++ = (uint8_t)(w >> 8);
|
||||
if (iqp->q_wrptr >= iqp->q_top)
|
||||
iqp->q_wrptr = iqp->q_buffer;
|
||||
nhw--;
|
||||
}
|
||||
/* Last byte for odd numbers.*/
|
||||
if ((n & 1) != 0) {
|
||||
*iqp->q_wrptr++ = (uint8_t)*pmap;
|
||||
if (iqp->q_wrptr >= iqp->q_top)
|
||||
iqp->q_wrptr = iqp->q_buffer;
|
||||
}
|
||||
|
||||
/* Updating queue.*/
|
||||
chSysLockFromIsr();
|
||||
iqp->q_counter += n;
|
||||
while (notempty(&iqp->q_waiting))
|
||||
chSchReadyI(fifo_remove(&iqp->q_waiting))->p_u.rdymsg = Q_OK;
|
||||
chSysUnlockFromIsr();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Writes to a dedicated packet buffer.
|
||||
*
|
||||
* @param[in] udp pointer to a @p stm32_usb_descriptor_t
|
||||
* @param[in] buf buffer where to fetch the packet data
|
||||
* @param[in] n maximum number of bytes to copy. This value must
|
||||
* not exceed the maximum packet size for this endpoint.
|
||||
*
|
||||
* @notapi
|
||||
*/
|
||||
static void usb_packet_write_from_buffer(stm32_usb_descriptor_t *udp,
|
||||
const uint8_t *buf,
|
||||
size_t n) {
|
||||
uint32_t *pmap = USB_ADDR2PTR(udp->TXADDR0);
|
||||
|
||||
udp->TXCOUNT0 = (uint16_t)n;
|
||||
n = (n + 1) / 2;
|
||||
while (n > 0) {
|
||||
/* Note, this line relies on the Cortex-M3/M4 ability to perform
|
||||
unaligned word accesses.*/
|
||||
*pmap++ = *(uint16_t *)buf;
|
||||
buf += 2;
|
||||
n--;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Writes to a dedicated packet buffer.
|
||||
*
|
||||
* @param[in] udp pointer to a @p stm32_usb_descriptor_t
|
||||
* @param[in] buf buffer where to fetch the packet data
|
||||
* @param[in] n maximum number of bytes to copy. This value must
|
||||
* not exceed the maximum packet size for this endpoint.
|
||||
*
|
||||
* @notapi
|
||||
*/
|
||||
static void usb_packet_write_from_queue(stm32_usb_descriptor_t *udp,
|
||||
OutputQueue *oqp, size_t n) {
|
||||
size_t nhw;
|
||||
uint32_t *pmap = USB_ADDR2PTR(udp->TXADDR0);
|
||||
|
||||
udp->TXCOUNT0 = (uint16_t)n;
|
||||
nhw = n / 2;
|
||||
while (nhw > 0) {
|
||||
uint32_t w;
|
||||
|
||||
w = (uint32_t)*oqp->q_rdptr++;
|
||||
if (oqp->q_rdptr >= oqp->q_top)
|
||||
oqp->q_rdptr = oqp->q_buffer;
|
||||
w |= (uint32_t)*oqp->q_rdptr++ << 8;
|
||||
if (oqp->q_rdptr >= oqp->q_top)
|
||||
oqp->q_rdptr = oqp->q_buffer;
|
||||
*pmap++ = w;
|
||||
nhw--;
|
||||
}
|
||||
|
||||
/* Last byte for odd numbers.*/
|
||||
if ((n & 1) != 0) {
|
||||
*pmap = (uint32_t)*oqp->q_rdptr++;
|
||||
if (oqp->q_rdptr >= oqp->q_top)
|
||||
oqp->q_rdptr = oqp->q_buffer;
|
||||
}
|
||||
|
||||
/* Updating queue. Note, the lock is done in this unusual way because this
|
||||
function can be called from both ISR and thread context so the kind
|
||||
of lock function to be invoked cannot be decided beforehand.*/
|
||||
port_lock();
|
||||
dbg_enter_lock();
|
||||
|
||||
oqp->q_counter += n;
|
||||
while (notempty(&oqp->q_waiting))
|
||||
chSchReadyI(fifo_remove(&oqp->q_waiting))->p_u.rdymsg = Q_OK;
|
||||
|
||||
dbg_leave_lock();
|
||||
port_unlock();
|
||||
}
|
||||
|
||||
/*===========================================================================*/
|
||||
/* Driver interrupt handlers. */
|
||||
/*===========================================================================*/
|
||||
|
||||
#if STM32_USB_USE_USB1 || defined(__DOXYGEN__)
|
||||
#if !defined(STM32_USB1_HP_HANDLER)
|
||||
#error "STM32_USB1_HP_HANDLER not defined"
|
||||
#endif
|
||||
/**
|
||||
* @brief USB high priority interrupt handler.
|
||||
*
|
||||
* @isr
|
||||
*/
|
||||
CH_IRQ_HANDLER(STM32_USB1_HP_HANDLER) {
|
||||
|
||||
CH_IRQ_PROLOGUE();
|
||||
|
||||
CH_IRQ_EPILOGUE();
|
||||
}
|
||||
|
||||
#if !defined(STM32_USB1_LP_HANDLER)
|
||||
#error "STM32_USB1_LP_HANDLER not defined"
|
||||
#endif
|
||||
/**
|
||||
* @brief USB low priority interrupt handler.
|
||||
*
|
||||
* @isr
|
||||
*/
|
||||
CH_IRQ_HANDLER(STM32_USB1_LP_HANDLER) {
|
||||
uint32_t istr;
|
||||
USBDriver *usbp = &USBD1;
|
||||
|
||||
CH_IRQ_PROLOGUE();
|
||||
|
||||
istr = STM32_USB->ISTR;
|
||||
|
||||
/* USB bus reset condition handling.*/
|
||||
if (istr & ISTR_RESET) {
|
||||
_usb_reset(usbp);
|
||||
_usb_isr_invoke_event_cb(usbp, USB_EVENT_RESET);
|
||||
STM32_USB->ISTR = ~ISTR_RESET;
|
||||
}
|
||||
|
||||
/* USB bus SUSPEND condition handling.*/
|
||||
if (istr & ISTR_SUSP) {
|
||||
STM32_USB->CNTR |= CNTR_FSUSP;
|
||||
_usb_isr_invoke_event_cb(usbp, USB_EVENT_SUSPEND);
|
||||
#if STM32_USB_LOW_POWER_ON_SUSPEND
|
||||
STM32_USB->CNTR |= CNTR_LP_MODE;
|
||||
#endif
|
||||
STM32_USB->ISTR = ~ISTR_SUSP;
|
||||
}
|
||||
|
||||
/* USB bus WAKEUP condition handling.*/
|
||||
if (istr & ISTR_WKUP) {
|
||||
uint32_t fnr = STM32_USB->FNR;
|
||||
if (!(fnr & FNR_RXDP)) {
|
||||
STM32_USB->CNTR &= ~CNTR_FSUSP;
|
||||
_usb_isr_invoke_event_cb(usbp, USB_EVENT_WAKEUP);
|
||||
}
|
||||
#if STM32_USB_LOW_POWER_ON_SUSPEND
|
||||
else {
|
||||
/* Just noise, going back in SUSPEND mode, reference manual 22.4.5,
|
||||
table 169.*/
|
||||
STM32_USB->CNTR |= CNTR_LP_MODE;
|
||||
}
|
||||
#endif
|
||||
STM32_USB->ISTR = ~ISTR_WKUP;
|
||||
}
|
||||
|
||||
/* SOF handling.*/
|
||||
if (istr & ISTR_SOF) {
|
||||
_usb_isr_invoke_sof_cb(usbp);
|
||||
STM32_USB->ISTR = ~ISTR_SOF;
|
||||
}
|
||||
|
||||
/* Endpoint events handling.*/
|
||||
while (istr & ISTR_CTR) {
|
||||
size_t n;
|
||||
uint32_t ep;
|
||||
uint32_t epr = STM32_USB->EPR[ep = istr & ISTR_EP_ID_MASK];
|
||||
const USBEndpointConfig *epcp = usbp->epc[ep];
|
||||
|
||||
if (epr & EPR_CTR_TX) {
|
||||
size_t transmitted;
|
||||
/* IN endpoint, transmission.*/
|
||||
EPR_CLEAR_CTR_TX(ep);
|
||||
|
||||
transmitted = (size_t)USB_GET_DESCRIPTOR(ep)->TXCOUNT0;
|
||||
epcp->in_state->txcnt += transmitted;
|
||||
n = epcp->in_state->txsize - epcp->in_state->txcnt;
|
||||
if (n > 0) {
|
||||
/* Transfer not completed, there are more packets to send.*/
|
||||
if (n > epcp->in_maxsize)
|
||||
n = epcp->in_maxsize;
|
||||
|
||||
if (epcp->in_state->txqueued)
|
||||
usb_packet_write_from_queue(USB_GET_DESCRIPTOR(ep),
|
||||
epcp->in_state->mode.queue.txqueue,
|
||||
n);
|
||||
else {
|
||||
epcp->in_state->mode.linear.txbuf += transmitted;
|
||||
usb_packet_write_from_buffer(USB_GET_DESCRIPTOR(ep),
|
||||
epcp->in_state->mode.linear.txbuf,
|
||||
n);
|
||||
}
|
||||
chSysLockFromIsr();
|
||||
usb_lld_start_in(usbp, ep);
|
||||
chSysUnlockFromIsr();
|
||||
}
|
||||
else {
|
||||
/* Transfer completed, invokes the callback.*/
|
||||
_usb_isr_invoke_in_cb(usbp, ep);
|
||||
}
|
||||
}
|
||||
if (epr & EPR_CTR_RX) {
|
||||
EPR_CLEAR_CTR_RX(ep);
|
||||
/* OUT endpoint, receive.*/
|
||||
if (epr & EPR_SETUP) {
|
||||
/* Setup packets handling, setup packets are handled using a
|
||||
specific callback.*/
|
||||
_usb_isr_invoke_setup_cb(usbp, ep);
|
||||
}
|
||||
else {
|
||||
stm32_usb_descriptor_t *udp = USB_GET_DESCRIPTOR(ep);
|
||||
n = (size_t)udp->RXCOUNT0 & RXCOUNT_COUNT_MASK;
|
||||
|
||||
/* Reads the packet into the defined buffer.*/
|
||||
if (epcp->out_state->rxqueued)
|
||||
usb_packet_read_to_queue(udp,
|
||||
epcp->out_state->mode.queue.rxqueue,
|
||||
n);
|
||||
else {
|
||||
usb_packet_read_to_buffer(udp,
|
||||
epcp->out_state->mode.linear.rxbuf,
|
||||
n);
|
||||
epcp->out_state->mode.linear.rxbuf += n;
|
||||
}
|
||||
/* Transaction data updated.*/
|
||||
epcp->out_state->rxcnt += n;
|
||||
epcp->out_state->rxsize -= n;
|
||||
epcp->out_state->rxpkts -= 1;
|
||||
|
||||
/* The transaction is completed if the specified number of packets
|
||||
has been received or the current packet is a short packet.*/
|
||||
if ((n < epcp->out_maxsize) || (epcp->out_state->rxpkts == 0)) {
|
||||
/* Transfer complete, invokes the callback.*/
|
||||
_usb_isr_invoke_out_cb(usbp, ep);
|
||||
}
|
||||
else {
|
||||
/* Transfer not complete, there are more packets to receive.*/
|
||||
EPR_SET_STAT_RX(ep, EPR_STAT_RX_VALID);
|
||||
}
|
||||
}
|
||||
}
|
||||
istr = STM32_USB->ISTR;
|
||||
}
|
||||
|
||||
CH_IRQ_EPILOGUE();
|
||||
}
|
||||
#endif
|
||||
|
||||
/*===========================================================================*/
|
||||
/* Driver exported functions. */
|
||||
/*===========================================================================*/
|
||||
|
||||
/**
|
||||
* @brief Low level USB driver initialization.
|
||||
*
|
||||
* @notapi
|
||||
*/
|
||||
void usb_lld_init(void) {
|
||||
|
||||
/* Driver initialization.*/
|
||||
usbObjectInit(&USBD1);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Configures and activates the USB peripheral.
|
||||
*
|
||||
* @param[in] usbp pointer to the @p USBDriver object
|
||||
*
|
||||
* @notapi
|
||||
*/
|
||||
void usb_lld_start(USBDriver *usbp) {
|
||||
|
||||
if (usbp->state == USB_STOP) {
|
||||
/* Clock activation.*/
|
||||
#if STM32_USB_USE_USB1
|
||||
if (&USBD1 == usbp) {
|
||||
/* USB clock enabled.*/
|
||||
rccEnableUSB(FALSE);
|
||||
/* Powers up the transceiver while holding the USB in reset state.*/
|
||||
STM32_USB->CNTR = CNTR_FRES;
|
||||
/* Enabling the USB IRQ vectors, this also gives enough time to allow
|
||||
the transceiver power up (1uS).*/
|
||||
nvicEnableVector(STM32_USB1_HP_NUMBER,
|
||||
CORTEX_PRIORITY_MASK(STM32_USB_USB1_HP_IRQ_PRIORITY));
|
||||
nvicEnableVector(STM32_USB1_LP_NUMBER,
|
||||
CORTEX_PRIORITY_MASK(STM32_USB_USB1_LP_IRQ_PRIORITY));
|
||||
/* Releases the USB reset.*/
|
||||
STM32_USB->CNTR = 0;
|
||||
}
|
||||
#endif
|
||||
/* Reset procedure enforced on driver start.*/
|
||||
_usb_reset(usbp);
|
||||
}
|
||||
/* Configuration.*/
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Deactivates the USB peripheral.
|
||||
*
|
||||
* @param[in] usbp pointer to the @p USBDriver object
|
||||
*
|
||||
* @notapi
|
||||
*/
|
||||
void usb_lld_stop(USBDriver *usbp) {
|
||||
|
||||
/* If in ready state then disables the USB clock.*/
|
||||
if (usbp->state == USB_STOP) {
|
||||
#if STM32_USB_USE_USB1
|
||||
if (&USBD1 == usbp) {
|
||||
nvicDisableVector(STM32_USB1_HP_NUMBER);
|
||||
nvicDisableVector(STM32_USB1_LP_NUMBER);
|
||||
STM32_USB->CNTR = CNTR_PDWN | CNTR_FRES;
|
||||
rccDisableUSB(FALSE);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief USB low level reset routine.
|
||||
*
|
||||
* @param[in] usbp pointer to the @p USBDriver object
|
||||
*
|
||||
* @notapi
|
||||
*/
|
||||
void usb_lld_reset(USBDriver *usbp) {
|
||||
uint32_t cntr;
|
||||
|
||||
/* Post reset initialization.*/
|
||||
STM32_USB->BTABLE = 0;
|
||||
STM32_USB->ISTR = 0;
|
||||
STM32_USB->DADDR = DADDR_EF;
|
||||
cntr = /*CNTR_ESOFM | */ CNTR_RESETM | CNTR_SUSPM |
|
||||
CNTR_WKUPM | /*CNTR_ERRM | CNTR_PMAOVRM |*/ CNTR_CTRM;
|
||||
/* The SOF interrupt is only enabled if a callback is defined for
|
||||
this service because it is an high rate source.*/
|
||||
if (usbp->config->sof_cb != NULL)
|
||||
cntr |= CNTR_SOFM;
|
||||
STM32_USB->CNTR = cntr;
|
||||
|
||||
/* Resets the packet memory allocator.*/
|
||||
usb_pm_reset(usbp);
|
||||
|
||||
/* EP0 initialization.*/
|
||||
usbp->epc[0] = &ep0config;
|
||||
usb_lld_init_endpoint(usbp, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Sets the USB address.
|
||||
*
|
||||
* @param[in] usbp pointer to the @p USBDriver object
|
||||
*
|
||||
* @notapi
|
||||
*/
|
||||
void usb_lld_set_address(USBDriver *usbp) {
|
||||
|
||||
STM32_USB->DADDR = (uint32_t)(usbp->address) | DADDR_EF;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Enables an endpoint.
|
||||
*
|
||||
* @param[in] usbp pointer to the @p USBDriver object
|
||||
* @param[in] ep endpoint number
|
||||
*
|
||||
* @notapi
|
||||
*/
|
||||
void usb_lld_init_endpoint(USBDriver *usbp, usbep_t ep) {
|
||||
uint16_t nblocks, epr;
|
||||
stm32_usb_descriptor_t *dp;
|
||||
const USBEndpointConfig *epcp = usbp->epc[ep];
|
||||
|
||||
/* Setting the endpoint type.*/
|
||||
switch (epcp->ep_mode & USB_EP_MODE_TYPE) {
|
||||
case USB_EP_MODE_TYPE_ISOC:
|
||||
epr = EPR_EP_TYPE_ISO;
|
||||
break;
|
||||
case USB_EP_MODE_TYPE_BULK:
|
||||
epr = EPR_EP_TYPE_BULK;
|
||||
break;
|
||||
case USB_EP_MODE_TYPE_INTR:
|
||||
epr = EPR_EP_TYPE_INTERRUPT;
|
||||
break;
|
||||
default:
|
||||
epr = EPR_EP_TYPE_CONTROL;
|
||||
}
|
||||
|
||||
/* IN endpoint initially in NAK mode.*/
|
||||
if (epcp->in_cb != NULL)
|
||||
epr |= EPR_STAT_TX_NAK;
|
||||
|
||||
/* OUT endpoint initially in NAK mode.*/
|
||||
if (epcp->out_cb != NULL)
|
||||
epr |= EPR_STAT_RX_NAK;
|
||||
|
||||
/* EPxR register setup.*/
|
||||
EPR_SET(ep, epr | ep);
|
||||
EPR_TOGGLE(ep, epr);
|
||||
|
||||
/* Endpoint size and address initialization.*/
|
||||
if (epcp->out_maxsize > 62)
|
||||
nblocks = (((((epcp->out_maxsize - 1) | 0x1f) + 1) / 32) << 10) |
|
||||
0x8000;
|
||||
else
|
||||
nblocks = ((((epcp->out_maxsize - 1) | 1) + 1) / 2) << 10;
|
||||
dp = USB_GET_DESCRIPTOR(ep);
|
||||
dp->TXCOUNT0 = 0;
|
||||
dp->RXCOUNT0 = nblocks;
|
||||
dp->TXADDR0 = usb_pm_alloc(usbp, epcp->in_maxsize);
|
||||
dp->RXADDR0 = usb_pm_alloc(usbp, epcp->out_maxsize);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Disables all the active endpoints except the endpoint zero.
|
||||
*
|
||||
* @param[in] usbp pointer to the @p USBDriver object
|
||||
*
|
||||
* @notapi
|
||||
*/
|
||||
void usb_lld_disable_endpoints(USBDriver *usbp) {
|
||||
unsigned i;
|
||||
|
||||
/* Resets the packet memory allocator.*/
|
||||
usb_pm_reset(usbp);
|
||||
|
||||
/* Disabling all endpoints.*/
|
||||
for (i = 1; i <= USB_ENDOPOINTS_NUMBER; i++) {
|
||||
EPR_TOGGLE(i, 0);
|
||||
EPR_SET(i, 0);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Returns the status of an OUT endpoint.
|
||||
*
|
||||
* @param[in] usbp pointer to the @p USBDriver object
|
||||
* @param[in] ep endpoint number
|
||||
* @return The endpoint status.
|
||||
* @retval EP_STATUS_DISABLED The endpoint is not active.
|
||||
* @retval EP_STATUS_STALLED The endpoint is stalled.
|
||||
* @retval EP_STATUS_ACTIVE The endpoint is active.
|
||||
*
|
||||
* @notapi
|
||||
*/
|
||||
usbepstatus_t usb_lld_get_status_out(USBDriver *usbp, usbep_t ep) {
|
||||
|
||||
(void)usbp;
|
||||
switch (STM32_USB->EPR[ep] & EPR_STAT_RX_MASK) {
|
||||
case EPR_STAT_RX_DIS:
|
||||
return EP_STATUS_DISABLED;
|
||||
case EPR_STAT_RX_STALL:
|
||||
return EP_STATUS_STALLED;
|
||||
default:
|
||||
return EP_STATUS_ACTIVE;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Returns the status of an IN endpoint.
|
||||
*
|
||||
* @param[in] usbp pointer to the @p USBDriver object
|
||||
* @param[in] ep endpoint number
|
||||
* @return The endpoint status.
|
||||
* @retval EP_STATUS_DISABLED The endpoint is not active.
|
||||
* @retval EP_STATUS_STALLED The endpoint is stalled.
|
||||
* @retval EP_STATUS_ACTIVE The endpoint is active.
|
||||
*
|
||||
* @notapi
|
||||
*/
|
||||
usbepstatus_t usb_lld_get_status_in(USBDriver *usbp, usbep_t ep) {
|
||||
|
||||
(void)usbp;
|
||||
switch (STM32_USB->EPR[ep] & EPR_STAT_TX_MASK) {
|
||||
case EPR_STAT_TX_DIS:
|
||||
return EP_STATUS_DISABLED;
|
||||
case EPR_STAT_TX_STALL:
|
||||
return EP_STATUS_STALLED;
|
||||
default:
|
||||
return EP_STATUS_ACTIVE;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Reads a setup packet from the dedicated packet buffer.
|
||||
* @details This function must be invoked in the context of the @p setup_cb
|
||||
* callback in order to read the received setup packet.
|
||||
* @pre In order to use this function the endpoint must have been
|
||||
* initialized as a control endpoint.
|
||||
* @post The endpoint is ready to accept another packet.
|
||||
*
|
||||
* @param[in] usbp pointer to the @p USBDriver object
|
||||
* @param[in] ep endpoint number
|
||||
* @param[out] buf buffer where to copy the packet data
|
||||
*
|
||||
* @notapi
|
||||
*/
|
||||
void usb_lld_read_setup(USBDriver *usbp, usbep_t ep, uint8_t *buf) {
|
||||
uint32_t *pmap;
|
||||
stm32_usb_descriptor_t *udp;
|
||||
uint32_t n;
|
||||
|
||||
(void)usbp;
|
||||
udp = USB_GET_DESCRIPTOR(ep);
|
||||
pmap = USB_ADDR2PTR(udp->RXADDR0);
|
||||
for (n = 0; n < 4; n++) {
|
||||
*(uint16_t *)buf = (uint16_t)*pmap++;
|
||||
buf += 2;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Prepares for a receive operation.
|
||||
*
|
||||
* @param[in] usbp pointer to the @p USBDriver object
|
||||
* @param[in] ep endpoint number
|
||||
*
|
||||
* @notapi
|
||||
*/
|
||||
void usb_lld_prepare_receive(USBDriver *usbp, usbep_t ep) {
|
||||
USBOutEndpointState *osp = usbp->epc[ep]->out_state;
|
||||
|
||||
/* Transfer initialization.*/
|
||||
if (osp->rxsize == 0) /* Special case for zero sized packets.*/
|
||||
osp->rxpkts = 1;
|
||||
else
|
||||
osp->rxpkts = (uint16_t)((osp->rxsize + usbp->epc[ep]->out_maxsize - 1) /
|
||||
usbp->epc[ep]->out_maxsize);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Prepares for a transmit operation.
|
||||
*
|
||||
* @param[in] usbp pointer to the @p USBDriver object
|
||||
* @param[in] ep endpoint number
|
||||
*
|
||||
* @notapi
|
||||
*/
|
||||
void usb_lld_prepare_transmit(USBDriver *usbp, usbep_t ep) {
|
||||
size_t n;
|
||||
USBInEndpointState *isp = usbp->epc[ep]->in_state;
|
||||
|
||||
/* Transfer initialization.*/
|
||||
n = isp->txsize;
|
||||
if (n > (size_t)usbp->epc[ep]->in_maxsize)
|
||||
n = (size_t)usbp->epc[ep]->in_maxsize;
|
||||
|
||||
if (isp->txqueued)
|
||||
usb_packet_write_from_queue(USB_GET_DESCRIPTOR(ep),
|
||||
isp->mode.queue.txqueue, n);
|
||||
else
|
||||
usb_packet_write_from_buffer(USB_GET_DESCRIPTOR(ep),
|
||||
isp->mode.linear.txbuf, n);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Starts a receive operation on an OUT endpoint.
|
||||
*
|
||||
* @param[in] usbp pointer to the @p USBDriver object
|
||||
* @param[in] ep endpoint number
|
||||
*
|
||||
* @notapi
|
||||
*/
|
||||
void usb_lld_start_out(USBDriver *usbp, usbep_t ep) {
|
||||
|
||||
(void)usbp;
|
||||
|
||||
EPR_SET_STAT_RX(ep, EPR_STAT_RX_VALID);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Starts a transmit operation on an IN endpoint.
|
||||
*
|
||||
* @param[in] usbp pointer to the @p USBDriver object
|
||||
* @param[in] ep endpoint number
|
||||
*
|
||||
* @notapi
|
||||
*/
|
||||
void usb_lld_start_in(USBDriver *usbp, usbep_t ep) {
|
||||
|
||||
(void)usbp;
|
||||
|
||||
EPR_SET_STAT_TX(ep, EPR_STAT_TX_VALID);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Brings an OUT endpoint in the stalled state.
|
||||
*
|
||||
* @param[in] usbp pointer to the @p USBDriver object
|
||||
* @param[in] ep endpoint number
|
||||
*
|
||||
* @notapi
|
||||
*/
|
||||
void usb_lld_stall_out(USBDriver *usbp, usbep_t ep) {
|
||||
|
||||
(void)usbp;
|
||||
|
||||
EPR_SET_STAT_RX(ep, EPR_STAT_RX_STALL);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Brings an IN endpoint in the stalled state.
|
||||
*
|
||||
* @param[in] usbp pointer to the @p USBDriver object
|
||||
* @param[in] ep endpoint number
|
||||
*
|
||||
* @notapi
|
||||
*/
|
||||
void usb_lld_stall_in(USBDriver *usbp, usbep_t ep) {
|
||||
|
||||
(void)usbp;
|
||||
|
||||
EPR_SET_STAT_TX(ep, EPR_STAT_TX_STALL);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Brings an OUT endpoint in the active state.
|
||||
*
|
||||
* @param[in] usbp pointer to the @p USBDriver object
|
||||
* @param[in] ep endpoint number
|
||||
*
|
||||
* @notapi
|
||||
*/
|
||||
void usb_lld_clear_out(USBDriver *usbp, usbep_t ep) {
|
||||
|
||||
(void)usbp;
|
||||
|
||||
/* Makes sure to not put to NAK an endpoint that is already
|
||||
transferring.*/
|
||||
if ((STM32_USB->EPR[ep] & EPR_STAT_RX_MASK) != EPR_STAT_RX_VALID)
|
||||
EPR_SET_STAT_TX(ep, EPR_STAT_RX_NAK);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Brings an IN endpoint in the active state.
|
||||
*
|
||||
* @param[in] usbp pointer to the @p USBDriver object
|
||||
* @param[in] ep endpoint number
|
||||
*
|
||||
* @notapi
|
||||
*/
|
||||
void usb_lld_clear_in(USBDriver *usbp, usbep_t ep) {
|
||||
|
||||
(void)usbp;
|
||||
|
||||
/* Makes sure to not put to NAK an endpoint that is already
|
||||
transferring.*/
|
||||
if ((STM32_USB->EPR[ep] & EPR_STAT_TX_MASK) != EPR_STAT_TX_VALID)
|
||||
EPR_SET_STAT_TX(ep, EPR_STAT_TX_NAK);
|
||||
}
|
||||
|
||||
#endif /* HAL_USE_USB */
|
||||
|
||||
/** @} */
|
|
@ -0,0 +1,442 @@
|
|||
/*
|
||||
ChibiOS/RT - Copyright (C) 2006-2013 Giovanni Di Sirio
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file STM32/USBv1/usb_lld.h
|
||||
* @brief STM32 USB subsystem low level driver header.
|
||||
*
|
||||
* @addtogroup USB
|
||||
* @{
|
||||
*/
|
||||
|
||||
#ifndef _USB_LLD_H_
|
||||
#define _USB_LLD_H_
|
||||
|
||||
#if HAL_USE_USB || defined(__DOXYGEN__)
|
||||
|
||||
#include "stm32_usb.h"
|
||||
|
||||
/*===========================================================================*/
|
||||
/* Driver constants. */
|
||||
/*===========================================================================*/
|
||||
|
||||
/**
|
||||
* @brief Maximum endpoint address.
|
||||
*/
|
||||
#define USB_MAX_ENDPOINTS USB_ENDOPOINTS_NUMBER
|
||||
|
||||
/**
|
||||
* @brief Status stage handling method.
|
||||
*/
|
||||
#define USB_EP0_STATUS_STAGE USB_EP0_STATUS_STAGE_SW
|
||||
|
||||
/**
|
||||
* @brief This device requires the address change after the status packet.
|
||||
*/
|
||||
#define USB_SET_ADDRESS_MODE USB_LATE_SET_ADDRESS
|
||||
|
||||
/*===========================================================================*/
|
||||
/* Driver pre-compile time settings. */
|
||||
/*===========================================================================*/
|
||||
|
||||
/**
|
||||
* @brief USB1 driver enable switch.
|
||||
* @details If set to @p TRUE the support for USB1 is included.
|
||||
* @note The default is @p TRUE.
|
||||
*/
|
||||
#if !defined(STM32_USB_USE_USB1) || defined(__DOXYGEN__)
|
||||
#define STM32_USB_USE_USB1 FALSE
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Enables the USB device low power mode on suspend.
|
||||
*/
|
||||
#if !defined(STM32_USB_LOW_POWER_ON_SUSPEND) || defined(__DOXYGEN__)
|
||||
#define STM32_USB_LOW_POWER_ON_SUSPEND FALSE
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief USB1 interrupt priority level setting.
|
||||
*/
|
||||
#if !defined(STM32_USB_USB1_HP_IRQ_PRIORITY) || defined(__DOXYGEN__)
|
||||
#define STM32_USB_USB1_HP_IRQ_PRIORITY 13
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief USB1 interrupt priority level setting.
|
||||
*/
|
||||
#if !defined(STM32_USB_USB1_LP_IRQ_PRIORITY) || defined(__DOXYGEN__)
|
||||
#define STM32_USB_USB1_LP_IRQ_PRIORITY 14
|
||||
#endif
|
||||
|
||||
/*===========================================================================*/
|
||||
/* Derived constants and error checks. */
|
||||
/*===========================================================================*/
|
||||
|
||||
#if STM32_USB_USE_USB1 && !STM32_HAS_USB
|
||||
#error "USB not present in the selected device"
|
||||
#endif
|
||||
|
||||
#if !STM32_USB_USE_USB1
|
||||
#error "USB driver activated but no USB peripheral assigned"
|
||||
#endif
|
||||
|
||||
#if STM32_USB_USE_USB1 && \
|
||||
!CORTEX_IS_VALID_KERNEL_PRIORITY(STM32_USB_USB1_HP_IRQ_PRIORITY)
|
||||
#error "Invalid IRQ priority assigned to USB HP"
|
||||
#endif
|
||||
|
||||
#if STM32_USB_USE_USB1 && \
|
||||
!CORTEX_IS_VALID_KERNEL_PRIORITY(STM32_USB_USB1_LP_IRQ_PRIORITY)
|
||||
#error "Invalid IRQ priority assigned to USB LP"
|
||||
#endif
|
||||
|
||||
#if STM32_USBCLK != 48000000
|
||||
#error "the USB driver requires a 48MHz clock"
|
||||
#endif
|
||||
|
||||
/*===========================================================================*/
|
||||
/* Driver data structures and types. */
|
||||
/*===========================================================================*/
|
||||
|
||||
/**
|
||||
* @brief Type of an IN endpoint state structure.
|
||||
*/
|
||||
typedef struct {
|
||||
/**
|
||||
* @brief Buffer mode, queue or linear.
|
||||
*/
|
||||
bool_t txqueued;
|
||||
/**
|
||||
* @brief Requested transmit transfer size.
|
||||
*/
|
||||
size_t txsize;
|
||||
/**
|
||||
* @brief Transmitted bytes so far.
|
||||
*/
|
||||
size_t txcnt;
|
||||
union {
|
||||
struct {
|
||||
/**
|
||||
* @brief Pointer to the transmission linear buffer.
|
||||
*/
|
||||
const uint8_t *txbuf;
|
||||
} linear;
|
||||
struct {
|
||||
/**
|
||||
* @brief Pointer to the output queue.
|
||||
*/
|
||||
OutputQueue *txqueue;
|
||||
} queue;
|
||||
/* End of the mandatory fields.*/
|
||||
} mode;
|
||||
} USBInEndpointState;
|
||||
|
||||
/**
|
||||
* @brief Type of an OUT endpoint state structure.
|
||||
*/
|
||||
typedef struct {
|
||||
/**
|
||||
* @brief Buffer mode, queue or linear.
|
||||
*/
|
||||
bool_t rxqueued;
|
||||
/**
|
||||
* @brief Requested receive transfer size.
|
||||
*/
|
||||
size_t rxsize;
|
||||
/**
|
||||
* @brief Received bytes so far.
|
||||
*/
|
||||
size_t rxcnt;
|
||||
union {
|
||||
struct {
|
||||
/**
|
||||
* @brief Pointer to the receive linear buffer.
|
||||
*/
|
||||
uint8_t *rxbuf;
|
||||
} linear;
|
||||
struct {
|
||||
/**
|
||||
* @brief Pointer to the input queue.
|
||||
*/
|
||||
InputQueue *rxqueue;
|
||||
} queue;
|
||||
} mode;
|
||||
/* End of the mandatory fields.*/
|
||||
/**
|
||||
* @brief Number of packets to receive.
|
||||
*/
|
||||
uint16_t rxpkts;
|
||||
} USBOutEndpointState;
|
||||
|
||||
/**
|
||||
* @brief Type of an USB endpoint configuration structure.
|
||||
* @note Platform specific restrictions may apply to endpoints.
|
||||
*/
|
||||
typedef struct {
|
||||
/**
|
||||
* @brief Type and mode of the endpoint.
|
||||
*/
|
||||
uint32_t ep_mode;
|
||||
/**
|
||||
* @brief Setup packet notification callback.
|
||||
* @details This callback is invoked when a setup packet has been
|
||||
* received.
|
||||
* @post The application must immediately call @p usbReadPacket() in
|
||||
* order to access the received packet.
|
||||
* @note This field is only valid for @p USB_EP_MODE_TYPE_CTRL
|
||||
* endpoints, it should be set to @p NULL for other endpoint
|
||||
* types.
|
||||
*/
|
||||
usbepcallback_t setup_cb;
|
||||
/**
|
||||
* @brief IN endpoint notification callback.
|
||||
* @details This field must be set to @p NULL if the IN endpoint is not
|
||||
* used.
|
||||
*/
|
||||
usbepcallback_t in_cb;
|
||||
/**
|
||||
* @brief OUT endpoint notification callback.
|
||||
* @details This field must be set to @p NULL if the OUT endpoint is not
|
||||
* used.
|
||||
*/
|
||||
usbepcallback_t out_cb;
|
||||
/**
|
||||
* @brief IN endpoint maximum packet size.
|
||||
* @details This field must be set to zero if the IN endpoint is not
|
||||
* used.
|
||||
*/
|
||||
uint16_t in_maxsize;
|
||||
/**
|
||||
* @brief OUT endpoint maximum packet size.
|
||||
* @details This field must be set to zero if the OUT endpoint is not
|
||||
* used.
|
||||
*/
|
||||
uint16_t out_maxsize;
|
||||
/**
|
||||
* @brief @p USBEndpointState associated to the IN endpoint.
|
||||
* @details This structure maintains the state of the IN endpoint.
|
||||
*/
|
||||
USBInEndpointState *in_state;
|
||||
/**
|
||||
* @brief @p USBEndpointState associated to the OUT endpoint.
|
||||
* @details This structure maintains the state of the OUT endpoint.
|
||||
*/
|
||||
USBOutEndpointState *out_state;
|
||||
/* End of the mandatory fields.*/
|
||||
/**
|
||||
* @brief Reserved field, not currently used.
|
||||
* @note Initialize this field to 1 in order to be forward compatible.
|
||||
*/
|
||||
uint16_t ep_buffers;
|
||||
/**
|
||||
* @brief Pointer to a buffer for setup packets.
|
||||
* @details Setup packets require a dedicated 8-bytes buffer, set this
|
||||
* field to @p NULL for non-control endpoints.
|
||||
*/
|
||||
uint8_t *setup_buf;
|
||||
} USBEndpointConfig;
|
||||
|
||||
/**
|
||||
* @brief Type of an USB driver configuration structure.
|
||||
*/
|
||||
typedef struct {
|
||||
/**
|
||||
* @brief USB events callback.
|
||||
* @details This callback is invoked when an USB driver event is registered.
|
||||
*/
|
||||
usbeventcb_t event_cb;
|
||||
/**
|
||||
* @brief Device GET_DESCRIPTOR request callback.
|
||||
* @note This callback is mandatory and cannot be set to @p NULL.
|
||||
*/
|
||||
usbgetdescriptor_t get_descriptor_cb;
|
||||
/**
|
||||
* @brief Requests hook callback.
|
||||
* @details This hook allows to be notified of standard requests or to
|
||||
* handle non standard requests.
|
||||
*/
|
||||
usbreqhandler_t requests_hook_cb;
|
||||
/**
|
||||
* @brief Start Of Frame callback.
|
||||
*/
|
||||
usbcallback_t sof_cb;
|
||||
/* End of the mandatory fields.*/
|
||||
} USBConfig;
|
||||
|
||||
/**
|
||||
* @brief Structure representing an USB driver.
|
||||
*/
|
||||
struct USBDriver {
|
||||
/**
|
||||
* @brief Driver state.
|
||||
*/
|
||||
usbstate_t state;
|
||||
/**
|
||||
* @brief Current configuration data.
|
||||
*/
|
||||
const USBConfig *config;
|
||||
/**
|
||||
* @brief Bit map of the transmitting IN endpoints.
|
||||
*/
|
||||
uint16_t transmitting;
|
||||
/**
|
||||
* @brief Bit map of the receiving OUT endpoints.
|
||||
*/
|
||||
uint16_t receiving;
|
||||
/**
|
||||
* @brief Active endpoints configurations.
|
||||
*/
|
||||
const USBEndpointConfig *epc[USB_MAX_ENDPOINTS + 1];
|
||||
/**
|
||||
* @brief Fields available to user, it can be used to associate an
|
||||
* application-defined handler to an IN endpoint.
|
||||
* @note The base index is one, the endpoint zero does not have a
|
||||
* reserved element in this array.
|
||||
*/
|
||||
void *in_params[USB_MAX_ENDPOINTS];
|
||||
/**
|
||||
* @brief Fields available to user, it can be used to associate an
|
||||
* application-defined handler to an OUT endpoint.
|
||||
* @note The base index is one, the endpoint zero does not have a
|
||||
* reserved element in this array.
|
||||
*/
|
||||
void *out_params[USB_MAX_ENDPOINTS];
|
||||
/**
|
||||
* @brief Endpoint 0 state.
|
||||
*/
|
||||
usbep0state_t ep0state;
|
||||
/**
|
||||
* @brief Next position in the buffer to be transferred through endpoint 0.
|
||||
*/
|
||||
uint8_t *ep0next;
|
||||
/**
|
||||
* @brief Number of bytes yet to be transferred through endpoint 0.
|
||||
*/
|
||||
size_t ep0n;
|
||||
/**
|
||||
* @brief Endpoint 0 end transaction callback.
|
||||
*/
|
||||
usbcallback_t ep0endcb;
|
||||
/**
|
||||
* @brief Setup packet buffer.
|
||||
*/
|
||||
uint8_t setup[8];
|
||||
/**
|
||||
* @brief Current USB device status.
|
||||
*/
|
||||
uint16_t status;
|
||||
/**
|
||||
* @brief Assigned USB address.
|
||||
*/
|
||||
uint8_t address;
|
||||
/**
|
||||
* @brief Current USB device configuration.
|
||||
*/
|
||||
uint8_t configuration;
|
||||
#if defined(USB_DRIVER_EXT_FIELDS)
|
||||
USB_DRIVER_EXT_FIELDS
|
||||
#endif
|
||||
/* End of the mandatory fields.*/
|
||||
/**
|
||||
* @brief Pointer to the next address in the packet memory.
|
||||
*/
|
||||
uint32_t pmnext;
|
||||
};
|
||||
|
||||
/*===========================================================================*/
|
||||
/* Driver macros. */
|
||||
/*===========================================================================*/
|
||||
|
||||
/**
|
||||
* @brief Returns the current frame number.
|
||||
*
|
||||
* @param[in] usbp pointer to the @p USBDriver object
|
||||
* @return The current frame number.
|
||||
*
|
||||
* @notapi
|
||||
*/
|
||||
#define usb_lld_get_frame_number(usbp) (STM32_USB->FNR & FNR_FN_MASK)
|
||||
|
||||
/**
|
||||
* @brief Returns the exact size of a receive transaction.
|
||||
* @details The received size can be different from the size specified in
|
||||
* @p usbStartReceiveI() because the last packet could have a size
|
||||
* different from the expected one.
|
||||
* @pre The OUT endpoint must have been configured in transaction mode
|
||||
* in order to use this function.
|
||||
*
|
||||
* @param[in] usbp pointer to the @p USBDriver object
|
||||
* @param[in] ep endpoint number
|
||||
* @return Received data size.
|
||||
*
|
||||
* @notapi
|
||||
*/
|
||||
#define usb_lld_get_transaction_size(usbp, ep) \
|
||||
((usbp)->epc[ep]->out_state->rxcnt)
|
||||
|
||||
/**
|
||||
* @brief Returns the exact size of a received packet.
|
||||
* @pre The OUT endpoint must have been configured in packet mode
|
||||
* in order to use this function.
|
||||
*
|
||||
* @param[in] usbp pointer to the @p USBDriver object
|
||||
* @param[in] ep endpoint number
|
||||
* @return Received data size.
|
||||
*
|
||||
* @notapi
|
||||
*/
|
||||
#define usb_lld_get_packet_size(usbp, ep) \
|
||||
((size_t)USB_GET_DESCRIPTOR(ep)->RXCOUNT & RXCOUNT_COUNT_MASK)
|
||||
|
||||
/*===========================================================================*/
|
||||
/* External declarations. */
|
||||
/*===========================================================================*/
|
||||
|
||||
#if STM32_USB_USE_USB1 && !defined(__DOXYGEN__)
|
||||
extern USBDriver USBD1;
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
void usb_lld_init(void);
|
||||
void usb_lld_start(USBDriver *usbp);
|
||||
void usb_lld_stop(USBDriver *usbp);
|
||||
void usb_lld_reset(USBDriver *usbp);
|
||||
void usb_lld_set_address(USBDriver *usbp);
|
||||
void usb_lld_init_endpoint(USBDriver *usbp, usbep_t ep);
|
||||
void usb_lld_disable_endpoints(USBDriver *usbp);
|
||||
usbepstatus_t usb_lld_get_status_in(USBDriver *usbp, usbep_t ep);
|
||||
usbepstatus_t usb_lld_get_status_out(USBDriver *usbp, usbep_t ep);
|
||||
void usb_lld_read_setup(USBDriver *usbp, usbep_t ep, uint8_t *buf);
|
||||
void usb_lld_prepare_receive(USBDriver *usbp, usbep_t ep);
|
||||
void usb_lld_prepare_transmit(USBDriver *usbp, usbep_t ep);
|
||||
void usb_lld_start_out(USBDriver *usbp, usbep_t ep);
|
||||
void usb_lld_start_in(USBDriver *usbp, usbep_t ep);
|
||||
void usb_lld_stall_out(USBDriver *usbp, usbep_t ep);
|
||||
void usb_lld_stall_in(USBDriver *usbp, usbep_t ep);
|
||||
void usb_lld_clear_out(USBDriver *usbp, usbep_t ep);
|
||||
void usb_lld_clear_in(USBDriver *usbp, usbep_t ep);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* HAL_USE_USB */
|
||||
|
||||
#endif /* _USB_LLD_H_ */
|
||||
|
||||
/** @} */
|
File diff suppressed because it is too large
Load Diff
|
@ -1,175 +1,267 @@
|
|||
(export (version D)
|
||||
(design
|
||||
(source /home/rox/Art_Electro/RUSEFI/SVN-rusefi/mini48-stm32/mini48-stm32.sch)
|
||||
(date "Сб. 27 дек. 2014 20:56:42")
|
||||
(tool "eeschema (22-Jun-2014 BZR 4027)-stable"))
|
||||
(source C:/Users/LJ/Desktop/Jared/daecu/Hardware/trunk/rusefi.com/mini48-stm32/mini48-stm32.sch)
|
||||
(date "1/5/2015 8:56:05 PM")
|
||||
(tool "eeschema (2013-07-07 BZR 4022)-stable"))
|
||||
(components
|
||||
(comp (ref X1)
|
||||
(value 8MHz)
|
||||
(footprint HC-49V)
|
||||
(libsource (lib device) (part CRYSTAL))
|
||||
(sheetpath (names /) (tstamps /))
|
||||
(tstamp 549BD296))
|
||||
(comp (ref C2)
|
||||
(value 18pF)
|
||||
(footprint SM0805)
|
||||
(libsource (lib device) (part C))
|
||||
(sheetpath (names /) (tstamps /))
|
||||
(tstamp 549BD297))
|
||||
(comp (ref C7)
|
||||
(value 1uF)
|
||||
(footprint SM0805)
|
||||
(libsource (lib device) (part C))
|
||||
(sheetpath (names /) (tstamps /))
|
||||
(tstamp 549BD299))
|
||||
(comp (ref C3)
|
||||
(value 18pF)
|
||||
(footprint SM0805)
|
||||
(libsource (lib device) (part C))
|
||||
(sheetpath (names /) (tstamps /))
|
||||
(tstamp 549BD29B))
|
||||
(comp (ref R1)
|
||||
(value 1k)
|
||||
(footprint SM0805)
|
||||
(libsource (lib device) (part R))
|
||||
(sheetpath (names /) (tstamps /))
|
||||
(tstamp 549BD29D))
|
||||
(comp (ref C6)
|
||||
(value 100nF)
|
||||
(footprint SM0805)
|
||||
(libsource (lib device) (part C))
|
||||
(sheetpath (names /) (tstamps /))
|
||||
(tstamp 549BD29E))
|
||||
(comp (ref SW1)
|
||||
(value Reset)
|
||||
(footprint TL-1105)
|
||||
(libsource (lib device) (part SW_PUSH))
|
||||
(sheetpath (names /) (tstamps /))
|
||||
(tstamp 549BD29F))
|
||||
(comp (ref C8)
|
||||
(value 47uF)
|
||||
(footprint CP_elec_4x5.3)
|
||||
(libsource (lib device) (part CP1))
|
||||
(sheetpath (names /) (tstamps /))
|
||||
(tstamp 549BD2A5))
|
||||
(comp (ref C9)
|
||||
(value 0.1uF)
|
||||
(footprint SM0805)
|
||||
(libsource (lib device) (part C))
|
||||
(sheetpath (names /) (tstamps /))
|
||||
(tstamp 549BD2A6))
|
||||
(comp (ref C10)
|
||||
(value 1uF)
|
||||
(footprint SM0805)
|
||||
(libsource (lib device) (part C))
|
||||
(sheetpath (names /) (tstamps /))
|
||||
(tstamp 549BD2A7))
|
||||
(comp (ref C11)
|
||||
(value 1uF)
|
||||
(footprint SM0805)
|
||||
(libsource (lib device) (part C))
|
||||
(sheetpath (names /) (tstamps /))
|
||||
(tstamp 549BD2A8))
|
||||
(comp (ref U1)
|
||||
(value STM32F103C8)
|
||||
(footprint LQFP48)
|
||||
(footprint lqfp48)
|
||||
(libsource (lib art-electro-stm32) (part STM32F103C8))
|
||||
(sheetpath (names /) (tstamps /))
|
||||
(tstamp 549BD2AD))
|
||||
(comp (ref X2)
|
||||
(value 32768KHz)
|
||||
(footprint MC-306)
|
||||
(libsource (lib device) (part CRYSTAL))
|
||||
(sheetpath (names /) (tstamps /))
|
||||
(tstamp 549BD2AE))
|
||||
(comp (ref C4)
|
||||
(value 18pF)
|
||||
(footprint SM0805)
|
||||
(libsource (lib device) (part C))
|
||||
(sheetpath (names /) (tstamps /))
|
||||
(tstamp 549BD2AF))
|
||||
(comp (ref C5)
|
||||
(value 18pF)
|
||||
(footprint SM0805)
|
||||
(libsource (lib device) (part C))
|
||||
(sheetpath (names /) (tstamps /))
|
||||
(tstamp 549BD2B1))
|
||||
(comp (ref R4)
|
||||
(value 1k)
|
||||
(footprint SM0805)
|
||||
(libsource (lib device) (part R))
|
||||
(sheetpath (names /) (tstamps /))
|
||||
(tstamp 549BD2B3))
|
||||
(comp (ref SW2)
|
||||
(value But)
|
||||
(footprint TL-1105)
|
||||
(libsource (lib device) (part SW_PUSH))
|
||||
(sheetpath (names /) (tstamps /))
|
||||
(tstamp 549BD2B4))
|
||||
(comp (ref R5)
|
||||
(value 1k)
|
||||
(footprint SM0805)
|
||||
(libsource (lib device) (part R))
|
||||
(sheetpath (names /) (tstamps /))
|
||||
(tstamp 549BD2B5))
|
||||
(comp (ref R6)
|
||||
(value 10k)
|
||||
(footprint SM0805)
|
||||
(libsource (lib device) (part R))
|
||||
(sheetpath (names /) (tstamps /))
|
||||
(tstamp 549BD2B6))
|
||||
(comp (ref R3)
|
||||
(value 1k)
|
||||
(footprint SM0805)
|
||||
(libsource (lib device) (part R))
|
||||
(sheetpath (names /) (tstamps /))
|
||||
(tstamp 549BD2B9))
|
||||
(comp (ref C1)
|
||||
(value 4700pF)
|
||||
(footprint SM0805)
|
||||
(libsource (lib device) (part C))
|
||||
(sheetpath (names /) (tstamps /))
|
||||
(tstamp 549BD2BA))
|
||||
(comp (ref R2)
|
||||
(value 1M)
|
||||
(footprint SM0805)
|
||||
(libsource (lib device) (part R))
|
||||
(sheetpath (names /) (tstamps /))
|
||||
(tstamp 549BD2BB))
|
||||
(comp (ref D1)
|
||||
(value GREEN)
|
||||
(footprint LED-0805_A)
|
||||
(libsource (lib art-electro-conn) (part LED_0805))
|
||||
(sheetpath (names /) (tstamps /))
|
||||
(tstamp 549BD2C2))
|
||||
(comp (ref J1)
|
||||
(value MINI-USB)
|
||||
(footprint MINI-USB-5P-3400020P1)
|
||||
(libsource (lib art-electro-conn) (part MINI-USB))
|
||||
(sheetpath (names /) (tstamps /))
|
||||
(tstamp 549BD2C3))
|
||||
(comp (ref R7)
|
||||
(value 1k)
|
||||
(footprint SM0805)
|
||||
(libsource (lib device) (part R))
|
||||
(sheetpath (names /) (tstamps /))
|
||||
(tstamp 549BD2C7))
|
||||
(comp (ref D4)
|
||||
(value BLUE)
|
||||
(footprint LED-0805_A)
|
||||
(libsource (lib art-electro-conn) (part LED_0805))
|
||||
(sheetpath (names /) (tstamps /))
|
||||
(tstamp 549BD2C8))
|
||||
(comp (ref U3)
|
||||
(value LM2937)
|
||||
(footprint SOT223)
|
||||
(libsource (lib art-electro-power) (part LM2937))
|
||||
(sheetpath (names /) (tstamps /))
|
||||
(tstamp 549BD324))
|
||||
(comp (ref D2)
|
||||
(value DIODESCH)
|
||||
(footprint SM0805-diode)
|
||||
(libsource (lib device) (part DIODESCH))
|
||||
(sheetpath (names /) (tstamps /))
|
||||
(tstamp 549BD32B))
|
||||
(comp (ref D3)
|
||||
(value DIODESCH)
|
||||
(footprint SM0805-diode)
|
||||
(libsource (lib device) (part DIODESCH))
|
||||
(sheetpath (names /) (tstamps /))
|
||||
(tstamp 549BD32D))
|
||||
(comp (ref C12)
|
||||
(value 10uF)
|
||||
(footprint SM0805)
|
||||
(libsource (lib device) (part C))
|
||||
(sheetpath (names /) (tstamps /))
|
||||
(tstamp 549BDC77))
|
||||
(comp (ref P1)
|
||||
(value CONN_20)
|
||||
(footprint PIN_ARRAY_20X1)
|
||||
(libsource (lib conn) (part CONN_20))
|
||||
(sheetpath (names /) (tstamps /))
|
||||
(tstamp 549BE7CD))
|
||||
(comp (ref P2)
|
||||
(value CONN_20)
|
||||
(footprint PIN_ARRAY_20X1)
|
||||
(libsource (lib conn) (part CONN_20))
|
||||
(sheetpath (names /) (tstamps /))
|
||||
(tstamp 549BE7DA))
|
||||
(comp (ref U2)
|
||||
(value NUF2101MT1G)
|
||||
(footprint SOT-457)
|
||||
(libsource (lib art-electro-ic) (part NUF2101MT1G))
|
||||
(sheetpath (names /) (tstamps /))
|
||||
(tstamp 549EE660)))
|
||||
(tstamp 549EE660))
|
||||
(comp (ref C202)
|
||||
(value 4.7uF)
|
||||
(footprint SM0805)
|
||||
(fields
|
||||
(field (name mfg,mfg#) TDK,CGA4J3X5R1H475K125AB)
|
||||
(field (name vend1,vend1#) DIGI,445-7882-6-ND))
|
||||
(libsource (lib device) (part CP1))
|
||||
(sheetpath (names "/CAN BUS/") (tstamps /54AA767A/))
|
||||
(tstamp 52CAD8F6))
|
||||
(comp (ref C201)
|
||||
(value 0.1uF)
|
||||
(footprint SM0805)
|
||||
(fields
|
||||
(field (name mfg,mfg#) AVX,08055C104KAT2A)
|
||||
(field (name vend1,vend1#) DIGI,478-1395-1-ND))
|
||||
(libsource (lib device) (part C))
|
||||
(sheetpath (names "/CAN BUS/") (tstamps /54AA767A/))
|
||||
(tstamp 52CAD8F7))
|
||||
(comp (ref R201)
|
||||
(value 10k)
|
||||
(footprint SM0805)
|
||||
(fields
|
||||
(field (name mfg,mfg#) BOURNS,CR0805-FX-1002ELF)
|
||||
(field (name vend1,vend1#) DIGI,CR0805-FX-1002ELFCT-ND))
|
||||
(libsource (lib device) (part R))
|
||||
(sheetpath (names "/CAN BUS/") (tstamps /54AA767A/))
|
||||
(tstamp 52CADB46))
|
||||
(comp (ref U201)
|
||||
(value SN65HVD230)
|
||||
(footprint SO8E)
|
||||
(fields
|
||||
(field (name mfg,mfg#) TI,SN65HVD230QD)
|
||||
(field (name vend1,vend1#) digi,296-13123-5-ND))
|
||||
(libsource (lib art-electro-ic) (part SN65HVD230))
|
||||
(sheetpath (names "/CAN BUS/") (tstamps /54AA767A/))
|
||||
(tstamp 52CD2CA4))
|
||||
(comp (ref R202)
|
||||
(value 120)
|
||||
(footprint SM0805)
|
||||
(fields
|
||||
(field (name mfg,mfg#) ECG,ERA6AEB121V)
|
||||
(field (name vend1,vend1#) DIGI,P120DACT-ND))
|
||||
(libsource (lib device) (part R))
|
||||
(sheetpath (names "/CAN BUS/") (tstamps /54AA767A/))
|
||||
(tstamp 52CD2DE2))
|
||||
(comp (ref P202)
|
||||
(value JUMPER)
|
||||
(footprint JUMPER-2)
|
||||
(fields
|
||||
(field (name mfg,mfg#) JUMPER-WIRE,0R)
|
||||
(field (name vend1,vend1#) JUMPER-WIRE,0R))
|
||||
(libsource (lib device) (part JUMPER))
|
||||
(sheetpath (names "/CAN BUS/") (tstamps /54AA767A/))
|
||||
(tstamp 52CD2DEF))
|
||||
(comp (ref P201)
|
||||
(value CONN_4)
|
||||
(footprint SIL-4)
|
||||
(libsource (lib conn) (part CONN_4))
|
||||
(sheetpath (names "/CAN BUS/") (tstamps /54AA767A/))
|
||||
(tstamp 54959C46)))
|
||||
(libparts
|
||||
(libpart (lib device) (part C)
|
||||
(description "Condensateur non polarise")
|
||||
|
@ -220,6 +312,15 @@
|
|||
(pins
|
||||
(pin (num 1) (name A) (type passive))
|
||||
(pin (num 2) (name K) (type passive))))
|
||||
(libpart (lib device) (part JUMPER)
|
||||
(fields
|
||||
(field (name Reference) JP)
|
||||
(field (name Value) JUMPER)
|
||||
(field (name Footprint) ~)
|
||||
(field (name Datasheet) ~))
|
||||
(pins
|
||||
(pin (num 1) (name 1) (type passive))
|
||||
(pin (num 2) (name 2) (type passive))))
|
||||
(libpart (lib device) (part R)
|
||||
(description Resistance)
|
||||
(footprints
|
||||
|
@ -272,8 +373,17 @@
|
|||
(pin (num 18) (name P18) (type passive))
|
||||
(pin (num 19) (name P19) (type passive))
|
||||
(pin (num 20) (name P20) (type passive))))
|
||||
(libpart (lib conn) (part CONN_4)
|
||||
(description "Symbole general de connecteur")
|
||||
(fields
|
||||
(field (name Reference) P)
|
||||
(field (name Value) CONN_4))
|
||||
(pins
|
||||
(pin (num 1) (name P1) (type passive))
|
||||
(pin (num 2) (name P2) (type passive))
|
||||
(pin (num 3) (name P3) (type passive))
|
||||
(pin (num 4) (name P4) (type passive))))
|
||||
(libpart (lib art-electro-stm32) (part STM32F103C8)
|
||||
(description "STM8S105C4(C6), 8-bit microcontroller, 16MHz, 16(32)KB Flash, 2KB RAM, VQFP48")
|
||||
(footprints
|
||||
(fp lqfp48*))
|
||||
(fields
|
||||
|
@ -330,6 +440,24 @@
|
|||
(pin (num 46) (name PB9) (type BiDi))
|
||||
(pin (num 47) (name VSS_3) (type power_in))
|
||||
(pin (num 48) (name VDD_3) (type power_in))))
|
||||
(libpart (lib art-electro-ic) (part SN65HVD230)
|
||||
(description "Can transceiver")
|
||||
(footprints
|
||||
(fp SO8E))
|
||||
(fields
|
||||
(field (name Reference) U)
|
||||
(field (name Value) SN65HVD230)
|
||||
(field (name Footprint) ~)
|
||||
(field (name Datasheet) ~))
|
||||
(pins
|
||||
(pin (num 1) (name D/TXD) (type passive))
|
||||
(pin (num 2) (name GND) (type passive))
|
||||
(pin (num 3) (name VCC) (type power_in))
|
||||
(pin (num 4) (name R/RXD) (type passive))
|
||||
(pin (num 5) (name Vref) (type passive))
|
||||
(pin (num 6) (name CANL) (type passive))
|
||||
(pin (num 7) (name CANH) (type passive))
|
||||
(pin (num 8) (name RS) (type passive))))
|
||||
(libpart (lib art-electro-ic) (part NUF2101MT1G)
|
||||
(description "EMI Filter and line termination for USB upstream")
|
||||
(footprints
|
||||
|
@ -388,227 +516,254 @@
|
|||
(pin (num 5) (name GND) (type input))
|
||||
(pin (num 6) (name SHIELD) (type input)))))
|
||||
(libraries
|
||||
(library (logical device)
|
||||
(uri /usr/share/kicad/library/device.lib))
|
||||
(library (logical conn)
|
||||
(uri /usr/share/kicad/library/conn.lib))
|
||||
(uri "C:\\Program Files\\KiCad\\share\\library\\conn.lib"))
|
||||
(library (logical device)
|
||||
(uri "C:\\Program Files\\KiCad\\share\\library\\device.lib"))
|
||||
(library (logical art-electro-stm32)
|
||||
(uri ../rusefi_lib/art-electro-stm32.lib))
|
||||
(uri ..\rusefi_lib\art-electro-stm32.lib))
|
||||
(library (logical art-electro-power)
|
||||
(uri ../rusefi_lib/art-electro-power.lib))
|
||||
(uri ..\rusefi_lib\art-electro-power.lib))
|
||||
(library (logical art-electro-ic)
|
||||
(uri ../rusefi_lib/art-electro-ic.lib))
|
||||
(uri ..\rusefi_lib\art-electro-ic.lib))
|
||||
(library (logical art-electro-conn)
|
||||
(uri ../rusefi_lib/art-electro-conn.lib)))
|
||||
(uri ..\rusefi_lib\art-electro-conn.lib)))
|
||||
(nets
|
||||
(net (code 1) (name GND)
|
||||
(node (ref C11) (pin 2))
|
||||
(node (ref C10) (pin 2))
|
||||
(node (ref C9) (pin 2))
|
||||
(node (ref C6) (pin 1))
|
||||
(node (ref U2) (pin 2))
|
||||
(node (ref D4) (pin 2))
|
||||
(node (ref J1) (pin 5))
|
||||
(node (ref D1) (pin 2))
|
||||
(node (ref C3) (pin 1))
|
||||
(node (ref P2) (pin 2))
|
||||
(node (ref R6) (pin 1))
|
||||
(node (ref SW1) (pin 1))
|
||||
(node (ref U1) (pin 47))
|
||||
(node (ref U1) (pin 35))
|
||||
(node (ref U1) (pin 23))
|
||||
(node (ref C5) (pin 1))
|
||||
(node (ref C4) (pin 1))
|
||||
(node (ref U1) (pin 8))
|
||||
(node (ref C7) (pin 2))
|
||||
(node (ref C2) (pin 1))
|
||||
(node (ref C8) (pin 2))
|
||||
(node (ref C1) (pin 1))
|
||||
(node (ref U3) (pin 2))
|
||||
(node (ref C6) (pin 1))
|
||||
(node (ref R6) (pin 1))
|
||||
(node (ref C11) (pin 2))
|
||||
(node (ref SW1) (pin 1))
|
||||
(node (ref U2) (pin 2))
|
||||
(node (ref U1) (pin 35))
|
||||
(node (ref U3) (pin 4))
|
||||
(node (ref U3) (pin 2))
|
||||
(node (ref U1) (pin 47))
|
||||
(node (ref D4) (pin 2))
|
||||
(node (ref U201) (pin 2))
|
||||
(node (ref U1) (pin 8))
|
||||
(node (ref U1) (pin 23))
|
||||
(node (ref C3) (pin 1))
|
||||
(node (ref C8) (pin 2))
|
||||
(node (ref C9) (pin 2))
|
||||
(node (ref C10) (pin 2))
|
||||
(node (ref C2) (pin 1))
|
||||
(node (ref C4) (pin 1))
|
||||
(node (ref C5) (pin 1))
|
||||
(node (ref P2) (pin 2))
|
||||
(node (ref C202) (pin 2))
|
||||
(node (ref C201) (pin 1))
|
||||
(node (ref J1) (pin 5))
|
||||
(node (ref R201) (pin 2))
|
||||
(node (ref D1) (pin 2))
|
||||
(node (ref C1) (pin 1))
|
||||
(node (ref P1) (pin 2))
|
||||
(node (ref P201) (pin 4))
|
||||
(node (ref R2) (pin 2))
|
||||
(node (ref C12) (pin 2)))
|
||||
(net (code 2) (name "")
|
||||
(net (code 2) (name /14)
|
||||
(node (ref P1) (pin 4))
|
||||
(node (ref U1) (pin 2)))
|
||||
(net (code 3) (name /VBAT)
|
||||
(node (ref P1) (pin 3))
|
||||
(node (ref U1) (pin 1)))
|
||||
(net (code 4) (name "")
|
||||
(node (ref U3) (pin 1))
|
||||
(node (ref C12) (pin 1))
|
||||
(node (ref D2) (pin 2))
|
||||
(node (ref D3) (pin 2))
|
||||
(node (ref C12) (pin 1)))
|
||||
(net (code 3) (name /D+)
|
||||
(node (ref J1) (pin 3))
|
||||
(node (ref U2) (pin 6)))
|
||||
(net (code 4) (name /D-)
|
||||
(node (ref U2) (pin 4))
|
||||
(node (ref J1) (pin 2)))
|
||||
(net (code 5) (name /+5v)
|
||||
(node (ref R3) (pin 1))
|
||||
(node (ref D3) (pin 2)))
|
||||
(net (code 5) (name "/CAN BUS/5V")
|
||||
(node (ref P201) (pin 1))
|
||||
(node (ref D3) (pin 1))
|
||||
(node (ref U2) (pin 5))
|
||||
(node (ref R3) (pin 1))
|
||||
(node (ref J1) (pin 1)))
|
||||
(net (code 6) (name /23_USBDP)
|
||||
(net (code 6) (name /VIN)
|
||||
(node (ref P1) (pin 20))
|
||||
(node (ref D2) (pin 1)))
|
||||
(net (code 7) (name "")
|
||||
(node (ref P1) (pin 5)))
|
||||
(net (code 8) (name /D+)
|
||||
(node (ref U2) (pin 6))
|
||||
(node (ref J1) (pin 3)))
|
||||
(net (code 9) (name /D-)
|
||||
(node (ref U2) (pin 4))
|
||||
(node (ref J1) (pin 2)))
|
||||
(net (code 10) (name /23_USBDP)
|
||||
(node (ref P2) (pin 12))
|
||||
(node (ref U2) (pin 1))
|
||||
(node (ref U1) (pin 33))
|
||||
(node (ref P2) (pin 12)))
|
||||
(net (code 7) (name /VCC)
|
||||
(node (ref P2) (pin 1))
|
||||
(node (ref U1) (pin 24))
|
||||
(node (ref U1) (pin 48))
|
||||
(node (ref U1) (pin 33)))
|
||||
(net (code 11) (name "/CAN BUS/3.3V")
|
||||
(node (ref U1) (pin 9))
|
||||
(node (ref U3) (pin 3))
|
||||
(node (ref U1) (pin 24))
|
||||
(node (ref R5) (pin 2))
|
||||
(node (ref C8) (pin 1))
|
||||
(node (ref C9) (pin 1))
|
||||
(node (ref C7) (pin 1))
|
||||
(node (ref R1) (pin 2))
|
||||
(node (ref U3) (pin 3))
|
||||
(node (ref U1) (pin 36))
|
||||
(node (ref C10) (pin 1))
|
||||
(node (ref C7) (pin 1))
|
||||
(node (ref P1) (pin 1))
|
||||
(node (ref R1) (pin 2))
|
||||
(node (ref C202) (pin 1))
|
||||
(node (ref U1) (pin 48))
|
||||
(node (ref C201) (pin 2))
|
||||
(node (ref U201) (pin 3))
|
||||
(node (ref P2) (pin 1))
|
||||
(node (ref U1) (pin 36))
|
||||
(node (ref C11) (pin 1)))
|
||||
(net (code 8) (name /VIN)
|
||||
(node (ref D2) (pin 1))
|
||||
(node (ref P1) (pin 20)))
|
||||
(net (code 9) (name /14)
|
||||
(node (ref P1) (pin 4))
|
||||
(node (ref U1) (pin 2)))
|
||||
(net (code 10) (name /35)
|
||||
(node (ref U1) (pin 46))
|
||||
(node (ref P1) (pin 6)))
|
||||
(net (code 11) (name "")
|
||||
(node (ref P1) (pin 5)))
|
||||
(net (code 12) (name /VBAT)
|
||||
(node (ref P1) (pin 3))
|
||||
(node (ref U1) (pin 1)))
|
||||
(net (code 13) (name "")
|
||||
(node (ref D1) (pin 1))
|
||||
(node (ref R3) (pin 2)))
|
||||
(net (code 14) (name "")
|
||||
(node (ref J1) (pin 4)))
|
||||
(net (code 15) (name "")
|
||||
(node (ref SW2) (pin 1))
|
||||
(node (ref R5) (pin 1)))
|
||||
(net (code 16) (name /BOOT0)
|
||||
(node (ref U1) (pin 44))
|
||||
(node (ref P2) (pin 3))
|
||||
(node (ref SW2) (pin 2))
|
||||
(node (ref R4) (pin 2))
|
||||
(node (ref R6) (pin 2)))
|
||||
(net (code 17) (name /24_USBDM)
|
||||
(node (ref P2) (pin 13))
|
||||
(node (ref U2) (pin 3))
|
||||
(node (ref U1) (pin 32)))
|
||||
(net (code 18) (name /33)
|
||||
(node (ref U1) (pin 19))
|
||||
(node (ref R7) (pin 1)))
|
||||
(net (code 19) (name "")
|
||||
(node (ref R7) (pin 2))
|
||||
(node (ref D4) (pin 1)))
|
||||
(net (code 20) (name "")
|
||||
(node (ref R2) (pin 1))
|
||||
(node (ref C1) (pin 2))
|
||||
(node (ref J1) (pin 6)))
|
||||
(net (code 21) (name /29)
|
||||
(node (ref P2) (pin 18))
|
||||
(node (ref U1) (pin 27)))
|
||||
(net (code 22) (name /2)
|
||||
(node (ref P1) (pin 17))
|
||||
(node (ref U1) (pin 20)))
|
||||
(net (code 23) (name /3)
|
||||
(node (ref P1) (pin 16))
|
||||
(node (ref U1) (pin 18)))
|
||||
(net (code 24) (name /4)
|
||||
(node (ref U1) (pin 17))
|
||||
(node (ref P1) (pin 15)))
|
||||
(net (code 25) (name /5)
|
||||
(node (ref P1) (pin 14))
|
||||
(node (ref U1) (pin 16)))
|
||||
(net (code 26) (name /6)
|
||||
(node (ref U1) (pin 15))
|
||||
(node (ref P1) (pin 13)))
|
||||
(net (code 27) (name /7)
|
||||
(node (ref U1) (pin 14))
|
||||
(node (ref P1) (pin 12)))
|
||||
(net (code 28) (name /8)
|
||||
(node (ref U1) (pin 13))
|
||||
(node (ref P1) (pin 11)))
|
||||
(net (code 29) (name /9)
|
||||
(node (ref U1) (pin 12))
|
||||
(node (ref P1) (pin 10)))
|
||||
(net (code 30) (name /10)
|
||||
(node (ref U1) (pin 11))
|
||||
(node (ref P1) (pin 9)))
|
||||
(net (code 31) (name /11)
|
||||
(node (ref U1) (pin 10))
|
||||
(node (ref P1) (pin 8)))
|
||||
(net (code 32) (name /Reset)
|
||||
(node (ref U1) (pin 7))
|
||||
(node (ref R1) (pin 1))
|
||||
(node (ref P1) (pin 7))
|
||||
(node (ref SW1) (pin 2))
|
||||
(node (ref C6) (pin 2)))
|
||||
(net (code 33) (name /31)
|
||||
(node (ref P2) (pin 20))
|
||||
(node (ref U1) (pin 25)))
|
||||
(net (code 34) (name /30)
|
||||
(node (ref U1) (pin 26))
|
||||
(node (ref P2) (pin 19)))
|
||||
(net (code 35) (name /1)
|
||||
(node (ref U1) (pin 21))
|
||||
(node (ref P1) (pin 18)))
|
||||
(net (code 36) (name /28)
|
||||
(node (ref P2) (pin 17))
|
||||
(node (ref U1) (pin 28)))
|
||||
(net (code 37) (name /27)
|
||||
(node (ref U1) (pin 29))
|
||||
(node (ref P2) (pin 16)))
|
||||
(net (code 38) (name /26)
|
||||
(node (ref P2) (pin 15))
|
||||
(node (ref U1) (pin 30)))
|
||||
(net (code 39) (name /25)
|
||||
(node (ref P2) (pin 14))
|
||||
(node (ref U1) (pin 31)))
|
||||
(net (code 40) (name /22)
|
||||
(node (ref P2) (pin 11))
|
||||
(node (ref U1) (pin 34)))
|
||||
(net (code 41) (name /21)
|
||||
(node (ref P2) (pin 10))
|
||||
(node (ref U1) (pin 37)))
|
||||
(net (code 42) (name /20)
|
||||
(node (ref U1) (pin 38))
|
||||
(node (ref P2) (pin 9)))
|
||||
(net (code 43) (name /19)
|
||||
(node (ref P2) (pin 8))
|
||||
(node (ref U1) (pin 39)))
|
||||
(net (code 44) (name /18)
|
||||
(node (ref P2) (pin 7))
|
||||
(node (ref U1) (pin 40)))
|
||||
(net (code 45) (name /17)
|
||||
(node (ref U1) (pin 41))
|
||||
(node (ref P2) (pin 6)))
|
||||
(net (code 46) (name /16)
|
||||
(node (ref U1) (pin 42))
|
||||
(node (ref P2) (pin 5)))
|
||||
(net (code 47) (name /0)
|
||||
(net (code 12) (name /0)
|
||||
(node (ref U1) (pin 22))
|
||||
(node (ref P1) (pin 19)))
|
||||
(net (code 48) (name /15)
|
||||
(net (code 13) (name /22)
|
||||
(node (ref P2) (pin 11))
|
||||
(node (ref U1) (pin 34)))
|
||||
(net (code 14) (name /31)
|
||||
(node (ref P2) (pin 20))
|
||||
(node (ref U1) (pin 25)))
|
||||
(net (code 15) (name /BOOT0)
|
||||
(node (ref P2) (pin 3))
|
||||
(node (ref U1) (pin 44))
|
||||
(node (ref R4) (pin 2))
|
||||
(node (ref SW2) (pin 2))
|
||||
(node (ref R6) (pin 2)))
|
||||
(net (code 16) (name /1)
|
||||
(node (ref U1) (pin 21))
|
||||
(node (ref P1) (pin 18)))
|
||||
(net (code 17) (name /2)
|
||||
(node (ref U1) (pin 20))
|
||||
(node (ref P1) (pin 17)))
|
||||
(net (code 18) (name /3)
|
||||
(node (ref P1) (pin 16))
|
||||
(node (ref U1) (pin 18)))
|
||||
(net (code 19) (name /4)
|
||||
(node (ref P1) (pin 15))
|
||||
(node (ref U1) (pin 17)))
|
||||
(net (code 20) (name /5)
|
||||
(node (ref U1) (pin 16))
|
||||
(node (ref P1) (pin 14)))
|
||||
(net (code 21) (name /6)
|
||||
(node (ref P1) (pin 13))
|
||||
(node (ref U1) (pin 15)))
|
||||
(net (code 22) (name /7)
|
||||
(node (ref U1) (pin 14))
|
||||
(node (ref P1) (pin 12)))
|
||||
(net (code 23) (name /8)
|
||||
(node (ref P1) (pin 11))
|
||||
(node (ref U1) (pin 13)))
|
||||
(net (code 24) (name /9)
|
||||
(node (ref U1) (pin 12))
|
||||
(node (ref P1) (pin 10)))
|
||||
(net (code 25) (name /10)
|
||||
(node (ref U1) (pin 11))
|
||||
(node (ref P1) (pin 9)))
|
||||
(net (code 26) (name /11)
|
||||
(node (ref P1) (pin 8))
|
||||
(node (ref U1) (pin 10)))
|
||||
(net (code 27) (name /Reset)
|
||||
(node (ref C6) (pin 2))
|
||||
(node (ref U1) (pin 7))
|
||||
(node (ref SW1) (pin 2))
|
||||
(node (ref P1) (pin 7))
|
||||
(node (ref R1) (pin 1)))
|
||||
(net (code 28) (name "/CAN BUS/CAN_TX")
|
||||
(node (ref U201) (pin 1))
|
||||
(node (ref P1) (pin 6))
|
||||
(node (ref U1) (pin 46)))
|
||||
(net (code 29) (name "")
|
||||
(node (ref J1) (pin 6))
|
||||
(node (ref C1) (pin 2))
|
||||
(node (ref R2) (pin 1)))
|
||||
(net (code 30) (name "")
|
||||
(node (ref J1) (pin 4)))
|
||||
(net (code 31) (name "")
|
||||
(node (ref D1) (pin 1))
|
||||
(node (ref R3) (pin 2)))
|
||||
(net (code 32) (name /25)
|
||||
(node (ref P2) (pin 14))
|
||||
(node (ref U1) (pin 31)))
|
||||
(net (code 33) (name /33)
|
||||
(node (ref U1) (pin 19))
|
||||
(node (ref R7) (pin 1)))
|
||||
(net (code 34) (name "")
|
||||
(node (ref D4) (pin 1))
|
||||
(node (ref R7) (pin 2)))
|
||||
(net (code 35) (name /24_USBDM)
|
||||
(node (ref U1) (pin 32))
|
||||
(node (ref U2) (pin 3))
|
||||
(node (ref P2) (pin 13)))
|
||||
(net (code 36) (name "/CAN BUS/CANL")
|
||||
(node (ref P201) (pin 3))
|
||||
(node (ref U201) (pin 6))
|
||||
(node (ref P202) (pin 2)))
|
||||
(net (code 37) (name "/CAN BUS/CANH")
|
||||
(node (ref R202) (pin 2))
|
||||
(node (ref U201) (pin 7))
|
||||
(node (ref P201) (pin 2)))
|
||||
(net (code 38) (name /20)
|
||||
(node (ref P2) (pin 9))
|
||||
(node (ref U1) (pin 38)))
|
||||
(net (code 39) (name /19)
|
||||
(node (ref U1) (pin 39))
|
||||
(node (ref P2) (pin 8)))
|
||||
(net (code 40) (name /18)
|
||||
(node (ref U1) (pin 40))
|
||||
(node (ref P2) (pin 7)))
|
||||
(net (code 41) (name /17)
|
||||
(node (ref P2) (pin 6))
|
||||
(node (ref U1) (pin 41)))
|
||||
(net (code 42) (name /16)
|
||||
(node (ref U1) (pin 42))
|
||||
(node (ref P2) (pin 5)))
|
||||
(net (code 43) (name /15)
|
||||
(node (ref U1) (pin 43))
|
||||
(node (ref P2) (pin 4)))
|
||||
(net (code 49) (name /OSC32_OUT)
|
||||
(node (ref U1) (pin 4))
|
||||
(net (code 44) (name /21)
|
||||
(node (ref U1) (pin 37))
|
||||
(node (ref P2) (pin 10)))
|
||||
(net (code 45) (name /30)
|
||||
(node (ref P2) (pin 19))
|
||||
(node (ref U1) (pin 26)))
|
||||
(net (code 46) (name /29)
|
||||
(node (ref U1) (pin 27))
|
||||
(node (ref P2) (pin 18)))
|
||||
(net (code 47) (name /28)
|
||||
(node (ref U1) (pin 28))
|
||||
(node (ref P2) (pin 17)))
|
||||
(net (code 48) (name /27)
|
||||
(node (ref U1) (pin 29))
|
||||
(node (ref P2) (pin 16)))
|
||||
(net (code 49) (name /26)
|
||||
(node (ref P2) (pin 15))
|
||||
(node (ref U1) (pin 30)))
|
||||
(net (code 50) (name /OSC32_OUT)
|
||||
(node (ref X2) (pin 1))
|
||||
(node (ref C4) (pin 2)))
|
||||
(net (code 50) (name /OSC32_IN)
|
||||
(node (ref C4) (pin 2))
|
||||
(node (ref U1) (pin 4)))
|
||||
(net (code 51) (name /OSC32_IN)
|
||||
(node (ref U1) (pin 3))
|
||||
(node (ref C5) (pin 2))
|
||||
(node (ref X2) (pin 2))
|
||||
(node (ref U1) (pin 3)))
|
||||
(net (code 51) (name "")
|
||||
(node (ref X1) (pin 2))
|
||||
(node (ref C3) (pin 2))
|
||||
(node (ref U1) (pin 6)))
|
||||
(node (ref X2) (pin 2)))
|
||||
(net (code 52) (name "")
|
||||
(node (ref U1) (pin 5))
|
||||
(node (ref C2) (pin 2))
|
||||
(node (ref X1) (pin 1)))
|
||||
(node (ref C3) (pin 2))
|
||||
(node (ref U1) (pin 6))
|
||||
(node (ref X1) (pin 2)))
|
||||
(net (code 53) (name "")
|
||||
(node (ref X1) (pin 1))
|
||||
(node (ref C2) (pin 2))
|
||||
(node (ref U1) (pin 5)))
|
||||
(net (code 54) (name "/CAN BUS/CAN_RX")
|
||||
(node (ref U1) (pin 45))
|
||||
(node (ref R4) (pin 1)))))
|
||||
(node (ref R4) (pin 1))
|
||||
(node (ref U201) (pin 4)))
|
||||
(net (code 55) (name "")
|
||||
(node (ref SW2) (pin 1))
|
||||
(node (ref R5) (pin 1)))
|
||||
(net (code 56) (name "")
|
||||
(node (ref P202) (pin 1))
|
||||
(node (ref R202) (pin 1)))
|
||||
(net (code 57) (name "")
|
||||
(node (ref R201) (pin 1))
|
||||
(node (ref U201) (pin 8)))
|
||||
(net (code 58) (name "")
|
||||
(node (ref U201) (pin 5)))))
|
Binary file not shown.
|
@ -1,18 +1,23 @@
|
|||
update=Сб. 27 дек. 2014 12:35:03
|
||||
update=1/6/2015 5:56:03 AM
|
||||
version=1
|
||||
last_client=eeschema
|
||||
[general]
|
||||
version=1
|
||||
[cvpcb]
|
||||
version=1
|
||||
NetIExt=net
|
||||
[cvpcb/libraries]
|
||||
EquName1=devcms
|
||||
[pcbnew]
|
||||
version=1
|
||||
LastNetListRead=
|
||||
UseCmpFile=1
|
||||
PadDrill=0.600000000000
|
||||
PadDrillOvalY=0.600000000000
|
||||
PadSizeH=1.500000000000
|
||||
PadSizeV=1.500000000000
|
||||
PcbTextSizeV=1.500000000000
|
||||
PcbTextSizeH=1.500000000000
|
||||
LastNetListRead=mini48-stm32.net
|
||||
UseCmpFile=0
|
||||
PadDrill=0.000000000000
|
||||
PadDrillOvalY=0.000000000000
|
||||
PadSizeH=1.016000000000
|
||||
PadSizeV=0.254000000000
|
||||
PcbTextSizeV=1.000000000000
|
||||
PcbTextSizeH=1.000000000000
|
||||
PcbTextThickness=0.300000000000
|
||||
ModuleTextSizeV=1.000000000000
|
||||
ModuleTextSizeH=1.000000000000
|
||||
|
@ -20,9 +25,10 @@ ModuleTextSizeThickness=0.150000000000
|
|||
SolderMaskClearance=0.000000000000
|
||||
SolderMaskMinWidth=0.000000000000
|
||||
DrawSegmentWidth=0.200000000000
|
||||
BoardOutlineThickness=0.100000000000
|
||||
BoardOutlineThickness=0.150000000000
|
||||
ModuleOutlineThickness=0.150000000000
|
||||
[pcbnew/libraries]
|
||||
LibDir=../rusefi_lib
|
||||
LibName1=sockets
|
||||
LibName2=connect
|
||||
LibName3=discret
|
||||
|
@ -41,12 +47,6 @@ LibName15=art-electro-ic-pack
|
|||
LibName16=art-electro-conn
|
||||
LibName17=art-electro-smd
|
||||
LibName18=smd_lqfp
|
||||
LibDir=../rusefi_lib
|
||||
[cvpcb]
|
||||
version=1
|
||||
NetIExt=net
|
||||
[cvpcb/libraries]
|
||||
EquName1=devcms
|
||||
[eeschema]
|
||||
version=1
|
||||
LibDir=../rusefi_lib
|
||||
|
@ -61,9 +61,8 @@ LibName2=device
|
|||
LibName3=conn
|
||||
LibName4=linear
|
||||
LibName5=regul
|
||||
LibName6=stm32
|
||||
LibName7=art-electro-stm32
|
||||
LibName8=art-electro-ic
|
||||
LibName9=art-electro-power
|
||||
LibName10=transistors
|
||||
LibName11=art-electro-conn
|
||||
LibName6=art-electro-stm32
|
||||
LibName7=art-electro-ic
|
||||
LibName8=art-electro-power
|
||||
LibName9=transistors
|
||||
LibName10=art-electro-conn
|
||||
|
|
|
@ -4,7 +4,6 @@ LIBS:device
|
|||
LIBS:conn
|
||||
LIBS:linear
|
||||
LIBS:regul
|
||||
LIBS:stm32
|
||||
LIBS:art-electro-stm32
|
||||
LIBS:art-electro-ic
|
||||
LIBS:art-electro-power
|
||||
|
@ -15,9 +14,9 @@ EELAYER 27 0
|
|||
EELAYER END
|
||||
$Descr A4 11693 8268
|
||||
encoding utf-8
|
||||
Sheet 1 1
|
||||
Sheet 1 2
|
||||
Title "Maplemini fork"
|
||||
Date "27 dec 2014"
|
||||
Date "6 jan 2015"
|
||||
Rev ""
|
||||
Comp "Art_Electro"
|
||||
Comment1 "v1.2"
|
||||
|
@ -42,7 +41,7 @@ U 1 1 549BD296
|
|||
P 1525 2250
|
||||
F 0 "X1" H 1525 2400 60 0000 C CNN
|
||||
F 1 "8MHz" H 1525 2100 60 0000 C CNN
|
||||
F 2 "~" H 1525 2250 60 0000 C CNN
|
||||
F 2 "HC-49V" H 1525 2250 60 0001 C CNN
|
||||
F 3 "~" H 1525 2250 60 0000 C CNN
|
||||
1 1525 2250
|
||||
0 1 1 0
|
||||
|
@ -53,7 +52,7 @@ U 1 1 549BD297
|
|||
P 1125 1950
|
||||
F 0 "C2" V 1275 1925 40 0000 L CNN
|
||||
F 1 "18pF" V 975 1875 40 0000 L CNN
|
||||
F 2 "~" H 1163 1800 30 0000 C CNN
|
||||
F 2 "SM0805" H 1163 1800 30 0001 C CNN
|
||||
F 3 "~" H 1125 1950 60 0000 C CNN
|
||||
1 1125 1950
|
||||
0 -1 -1 0
|
||||
|
@ -81,7 +80,7 @@ U 1 1 549BD299
|
|||
P 2475 1000
|
||||
F 0 "C7" H 2475 1100 40 0000 L CNN
|
||||
F 1 "1uF" H 2481 915 40 0000 L CNN
|
||||
F 2 "~" H 2513 850 30 0000 C CNN
|
||||
F 2 "SM0805" H 2513 850 30 0001 C CNN
|
||||
F 3 "~" H 2475 1000 60 0000 C CNN
|
||||
1 2475 1000
|
||||
0 1 1 0
|
||||
|
@ -105,7 +104,7 @@ U 1 1 549BD29B
|
|||
P 1125 2550
|
||||
F 0 "C3" V 1275 2525 40 0000 L CNN
|
||||
F 1 "18pF" V 975 2475 40 0000 L CNN
|
||||
F 2 "~" H 1163 2400 30 0000 C CNN
|
||||
F 2 "SM0805" H 1163 2400 30 0001 C CNN
|
||||
F 3 "~" H 1125 2550 60 0000 C CNN
|
||||
1 1125 2550
|
||||
0 -1 -1 0
|
||||
|
@ -137,7 +136,7 @@ U 1 1 549BD29D
|
|||
P 1075 1500
|
||||
F 0 "R1" V 1155 1500 40 0000 C CNN
|
||||
F 1 "1k" V 1082 1501 40 0000 C CNN
|
||||
F 2 "~" V 1005 1500 30 0000 C CNN
|
||||
F 2 "SM0805" V 1005 1500 30 0001 C CNN
|
||||
F 3 "~" H 1075 1500 30 0000 C CNN
|
||||
1 1075 1500
|
||||
-1 0 0 1
|
||||
|
@ -148,7 +147,7 @@ U 1 1 549BD29E
|
|||
P 1675 1550
|
||||
F 0 "C6" H 1675 1650 40 0000 L CNN
|
||||
F 1 "100nF" H 1681 1465 40 0000 L CNN
|
||||
F 2 "~" H 1713 1400 30 0000 C CNN
|
||||
F 2 "SM0805" H 1713 1400 30 0001 C CNN
|
||||
F 3 "~" H 1675 1550 60 0000 C CNN
|
||||
1 1675 1550
|
||||
1 0 0 -1
|
||||
|
@ -159,7 +158,7 @@ U 1 1 549BD29F
|
|||
P 1375 1450
|
||||
F 0 "SW1" H 1525 1560 50 0000 C CNN
|
||||
F 1 "Reset" H 1375 1370 50 0000 C CNN
|
||||
F 2 "~" H 1375 1450 60 0000 C CNN
|
||||
F 2 "TL-1105" H 1375 1450 60 0001 C CNN
|
||||
F 3 "~" H 1375 1450 60 0000 C CNN
|
||||
1 1375 1450
|
||||
0 1 1 0
|
||||
|
@ -249,7 +248,7 @@ U 1 1 549BD2A5
|
|||
P 3550 5000
|
||||
F 0 "C8" H 3600 5100 50 0000 L CNN
|
||||
F 1 "47uF" H 3600 4900 50 0000 L CNN
|
||||
F 2 "~" H 3550 5000 60 0000 C CNN
|
||||
F 2 "CP_elec_4x5.3" H 3550 5000 60 0001 C CNN
|
||||
F 3 "~" H 3550 5000 60 0000 C CNN
|
||||
1 3550 5000
|
||||
1 0 0 -1
|
||||
|
@ -260,7 +259,7 @@ U 1 1 549BD2A6
|
|||
P 3900 5000
|
||||
F 0 "C9" H 3900 5100 40 0000 L CNN
|
||||
F 1 "0.1uF" H 3906 4915 40 0000 L CNN
|
||||
F 2 "~" H 3938 4850 30 0000 C CNN
|
||||
F 2 "SM0805" H 3938 4850 30 0001 C CNN
|
||||
F 3 "~" H 3900 5000 60 0000 C CNN
|
||||
1 3900 5000
|
||||
1 0 0 -1
|
||||
|
@ -271,7 +270,7 @@ U 1 1 549BD2A7
|
|||
P 4200 5000
|
||||
F 0 "C10" H 4200 5100 40 0000 L CNN
|
||||
F 1 "1uF" H 4206 4915 40 0000 L CNN
|
||||
F 2 "~" H 4238 4850 30 0000 C CNN
|
||||
F 2 "SM0805" H 4238 4850 30 0001 C CNN
|
||||
F 3 "~" H 4200 5000 60 0000 C CNN
|
||||
1 4200 5000
|
||||
1 0 0 -1
|
||||
|
@ -282,7 +281,7 @@ U 1 1 549BD2A8
|
|||
P 4500 5000
|
||||
F 0 "C11" H 4500 5100 40 0000 L CNN
|
||||
F 1 "1uF" H 4506 4915 40 0000 L CNN
|
||||
F 2 "~" H 4538 4850 30 0000 C CNN
|
||||
F 2 "SM0805" H 4538 4850 30 0001 C CNN
|
||||
F 3 "~" H 4500 5000 60 0000 C CNN
|
||||
1 4500 5000
|
||||
1 0 0 -1
|
||||
|
@ -452,7 +451,7 @@ Wire Wire Line
|
|||
Wire Wire Line
|
||||
4175 1950 4425 1950
|
||||
Wire Wire Line
|
||||
4175 2050 4425 2050
|
||||
4925 2050 4175 2050
|
||||
Wire Wire Line
|
||||
4175 2150 4425 2150
|
||||
Wire Wire Line
|
||||
|
@ -461,8 +460,6 @@ Wire Wire Line
|
|||
4175 2350 4425 2350
|
||||
Wire Wire Line
|
||||
4175 2450 4425 2450
|
||||
Wire Wire Line
|
||||
4175 2650 4425 2650
|
||||
Wire Wire Line
|
||||
4175 2850 4425 2850
|
||||
Wire Wire Line
|
||||
|
@ -495,7 +492,7 @@ U 1 1 549BD2AD
|
|||
P 2975 2900
|
||||
F 0 "U1" H 2975 3150 60 0000 C CNN
|
||||
F 1 "STM32F103C8" H 2975 2900 60 0000 C CNN
|
||||
F 2 "LQFP48" H 2975 2750 40 0000 C CIN
|
||||
F 2 "lqfp48" H 2975 2750 40 0001 C CIN
|
||||
F 3 "~" H 2975 2350 60 0000 C CNN
|
||||
1 2975 2900
|
||||
1 0 0 -1
|
||||
|
@ -509,7 +506,7 @@ U 1 1 549BD2AE
|
|||
P 1525 5100
|
||||
F 0 "X2" H 1525 5250 60 0000 C CNN
|
||||
F 1 "32768KHz" H 1525 4950 60 0000 C CNN
|
||||
F 2 "~" H 1525 5100 60 0000 C CNN
|
||||
F 2 "MC-306" H 1525 5100 60 0001 C CNN
|
||||
F 3 "~" H 1525 5100 60 0000 C CNN
|
||||
1 1525 5100
|
||||
0 1 1 0
|
||||
|
@ -520,7 +517,7 @@ U 1 1 549BD2AF
|
|||
P 1125 4800
|
||||
F 0 "C4" V 1275 4775 40 0000 L CNN
|
||||
F 1 "18pF" V 975 4725 40 0000 L CNN
|
||||
F 2 "~" H 1163 4650 30 0000 C CNN
|
||||
F 2 "SM0805" H 1163 4650 30 0001 C CNN
|
||||
F 3 "~" H 1125 4800 60 0000 C CNN
|
||||
1 1125 4800
|
||||
0 -1 -1 0
|
||||
|
@ -542,7 +539,7 @@ U 1 1 549BD2B1
|
|||
P 1125 5400
|
||||
F 0 "C5" V 1275 5375 40 0000 L CNN
|
||||
F 1 "18pF" V 975 5325 40 0000 L CNN
|
||||
F 2 "~" H 1163 5250 30 0000 C CNN
|
||||
F 2 "SM0805" H 1163 5250 30 0001 C CNN
|
||||
F 3 "~" H 1125 5400 60 0000 C CNN
|
||||
1 1125 5400
|
||||
0 -1 -1 0
|
||||
|
@ -581,23 +578,23 @@ Wire Wire Line
|
|||
$Comp
|
||||
L R R4
|
||||
U 1 1 549BD2B3
|
||||
P 4925 2550
|
||||
F 0 "R4" V 5005 2550 40 0000 C CNN
|
||||
F 1 "1k" V 4932 2551 40 0000 C CNN
|
||||
F 2 "~" V 4855 2550 30 0000 C CNN
|
||||
F 3 "~" H 4925 2550 30 0000 C CNN
|
||||
1 4925 2550
|
||||
P 5025 2550
|
||||
F 0 "R4" V 5105 2550 40 0000 C CNN
|
||||
F 1 "1k" V 5032 2551 40 0000 C CNN
|
||||
F 2 "SM0805" V 4955 2550 30 0001 C CNN
|
||||
F 3 "~" H 5025 2550 30 0000 C CNN
|
||||
1 5025 2550
|
||||
0 -1 -1 0
|
||||
$EndComp
|
||||
Wire Wire Line
|
||||
4675 2550 4175 2550
|
||||
4775 2550 4175 2550
|
||||
$Comp
|
||||
L SW_PUSH SW2
|
||||
U 1 1 549BD2B4
|
||||
P 5275 2100
|
||||
F 0 "SW2" H 5425 2210 50 0000 C CNN
|
||||
F 1 "But" H 5275 2020 50 0000 C CNN
|
||||
F 2 "~" H 5275 2100 60 0000 C CNN
|
||||
F 2 "TL-1105" H 5275 2100 60 0001 C CNN
|
||||
F 3 "~" H 5275 2100 60 0000 C CNN
|
||||
1 5275 2100
|
||||
0 1 1 0
|
||||
|
@ -608,7 +605,7 @@ U 1 1 549BD2B5
|
|||
P 5275 1400
|
||||
F 0 "R5" V 5355 1400 40 0000 C CNN
|
||||
F 1 "1k" V 5282 1401 40 0000 C CNN
|
||||
F 2 "~" V 5205 1400 30 0000 C CNN
|
||||
F 2 "SM0805" V 5205 1400 30 0001 C CNN
|
||||
F 3 "~" H 5275 1400 30 0000 C CNN
|
||||
1 5275 1400
|
||||
-1 0 0 1
|
||||
|
@ -619,7 +616,7 @@ U 1 1 549BD2B6
|
|||
P 5275 2950
|
||||
F 0 "R6" V 5355 2950 40 0000 C CNN
|
||||
F 1 "10k" V 5282 2951 40 0000 C CNN
|
||||
F 2 "~" V 5205 2950 30 0000 C CNN
|
||||
F 2 "SM0805" V 5205 2950 30 0001 C CNN
|
||||
F 3 "~" H 5275 2950 30 0000 C CNN
|
||||
1 5275 2950
|
||||
-1 0 0 1
|
||||
|
@ -647,7 +644,7 @@ $EndComp
|
|||
Text Label 5275 1000 1 60 ~ 0
|
||||
VCC
|
||||
Wire Wire Line
|
||||
5175 2550 5400 2550
|
||||
5275 2550 5400 2550
|
||||
Text Label 5400 2550 0 60 ~ 0
|
||||
BOOT0
|
||||
$Comp
|
||||
|
@ -667,7 +664,7 @@ U 1 1 549BD2B9
|
|||
P 1625 6700
|
||||
F 0 "R3" V 1705 6700 50 0000 C CNN
|
||||
F 1 "1k" V 1625 6700 50 0000 C CNN
|
||||
F 2 "" H 1625 6700 60 0001 C CNN
|
||||
F 2 "SM0805" H 1625 6700 60 0001 C CNN
|
||||
F 3 "" H 1625 6700 60 0001 C CNN
|
||||
1 1625 6700
|
||||
-1 0 0 -1
|
||||
|
@ -678,7 +675,7 @@ U 1 1 549BD2BA
|
|||
P 1100 7000
|
||||
F 0 "C1" H 1150 6850 50 0000 L CNN
|
||||
F 1 "4700pF" H 1050 6725 50 0000 L CNN
|
||||
F 2 "" H 1100 7000 60 0001 C CNN
|
||||
F 2 "SM0805" H 1100 7000 60 0001 C CNN
|
||||
F 3 "" H 1100 7000 60 0001 C CNN
|
||||
1 1100 7000
|
||||
-1 0 0 1
|
||||
|
@ -689,7 +686,7 @@ U 1 1 549BD2BB
|
|||
P 1300 7050
|
||||
F 0 "R2" V 1400 7025 50 0000 C CNN
|
||||
F 1 "1M" V 1300 7050 50 0000 C CNN
|
||||
F 2 "" H 1300 7050 60 0001 C CNN
|
||||
F 2 "SM0805" H 1300 7050 60 0001 C CNN
|
||||
F 3 "" H 1300 7050 60 0001 C CNN
|
||||
1 1300 7050
|
||||
1 0 0 -1
|
||||
|
@ -739,7 +736,7 @@ U 1 1 549BD2C2
|
|||
P 1625 7200
|
||||
F 0 "D1" H 1625 7300 50 0000 C CNN
|
||||
F 1 "GREEN" H 1625 7100 50 0000 C CNN
|
||||
F 2 "" H 1625 7200 60 0000 C CNN
|
||||
F 2 "LED-0805_A" H 1625 7200 60 0001 C CNN
|
||||
F 3 "" H 1625 7200 60 0000 C CNN
|
||||
1 1625 7200
|
||||
0 1 1 0
|
||||
|
@ -752,7 +749,7 @@ U 1 1 549BD2C3
|
|||
P 1100 6250
|
||||
F 0 "J1" H 825 6600 60 0000 C CNN
|
||||
F 1 "MINI-USB" H 1100 6700 60 0001 C CNN
|
||||
F 2 "~" H 1100 6250 60 0000 C CNN
|
||||
F 2 "MINI-USB-5P-3400020P1" H 1100 6250 60 0001 C CNN
|
||||
F 3 "~" H 1100 6250 60 0000 C CNN
|
||||
1 1100 6250
|
||||
1 0 0 -1
|
||||
|
@ -764,41 +761,41 @@ Text Label 4925 7300 0 60 ~ 0
|
|||
$Comp
|
||||
L GND #PWR020
|
||||
U 1 1 549BD2C6
|
||||
P 6000 1975
|
||||
F 0 "#PWR020" H 6000 1975 30 0001 C CNN
|
||||
F 1 "GND" H 6000 1905 30 0001 C CNN
|
||||
F 2 "" H 6000 1975 60 0001 C CNN
|
||||
F 3 "" H 6000 1975 60 0001 C CNN
|
||||
1 6000 1975
|
||||
1 0 0 -1
|
||||
P 4925 700
|
||||
F 0 "#PWR020" H 4925 700 30 0001 C CNN
|
||||
F 1 "GND" H 4925 630 30 0001 C CNN
|
||||
F 2 "" H 4925 700 60 0001 C CNN
|
||||
F 3 "" H 4925 700 60 0001 C CNN
|
||||
1 4925 700
|
||||
1 0 0 1
|
||||
$EndComp
|
||||
$Comp
|
||||
L R R7
|
||||
U 1 1 549BD2C7
|
||||
P 6000 1275
|
||||
F 0 "R7" V 6080 1275 50 0000 C CNN
|
||||
F 1 "1k" V 6000 1275 50 0000 C CNN
|
||||
F 2 "" H 6000 1275 60 0001 C CNN
|
||||
F 3 "" H 6000 1275 60 0001 C CNN
|
||||
1 6000 1275
|
||||
-1 0 0 -1
|
||||
P 4925 1400
|
||||
F 0 "R7" V 5005 1400 50 0000 C CNN
|
||||
F 1 "1k" V 4925 1400 50 0000 C CNN
|
||||
F 2 "SM0805" H 4925 1400 60 0001 C CNN
|
||||
F 3 "" H 4925 1400 60 0001 C CNN
|
||||
1 4925 1400
|
||||
-1 0 0 1
|
||||
$EndComp
|
||||
Wire Wire Line
|
||||
6000 1575 6000 1525
|
||||
4925 1100 4925 1150
|
||||
$Comp
|
||||
L LED_0805 D4
|
||||
U 1 1 549BD2C8
|
||||
P 6000 1775
|
||||
F 0 "D4" H 6000 1875 50 0000 C CNN
|
||||
F 1 "BLUE" H 6000 1675 50 0000 C CNN
|
||||
F 2 "" H 6000 1775 60 0000 C CNN
|
||||
F 3 "" H 6000 1775 60 0000 C CNN
|
||||
1 6000 1775
|
||||
0 1 1 0
|
||||
P 4925 900
|
||||
F 0 "D4" H 4925 1000 50 0000 C CNN
|
||||
F 1 "BLUE" H 4925 800 50 0000 C CNN
|
||||
F 2 "LED-0805_A" H 4925 900 60 0001 C CNN
|
||||
F 3 "" H 4925 900 60 0000 C CNN
|
||||
1 4925 900
|
||||
0 1 -1 0
|
||||
$EndComp
|
||||
Wire Wire Line
|
||||
6000 1025 6000 875
|
||||
Text Label 6000 875 0 60 ~ 0
|
||||
4925 1650 4925 2050
|
||||
Text Label 4925 1800 0 60 ~ 0
|
||||
33
|
||||
$Comp
|
||||
L PWR_FLAG #FLG021
|
||||
|
@ -839,7 +836,7 @@ U 1 1 549BD324
|
|||
P 6325 4850
|
||||
F 0 "U3" H 6125 5050 40 0000 C CNN
|
||||
F 1 "LM2937" H 6325 5050 40 0000 L CNN
|
||||
F 2 "" H 6325 4950 30 0001 C CIN
|
||||
F 2 "SOT223" H 6325 4950 30 0001 C CIN
|
||||
F 3 "" H 6325 4850 60 0000 C CNN
|
||||
1 6325 4850
|
||||
1 0 0 -1
|
||||
|
@ -874,7 +871,7 @@ U 1 1 549BD32B
|
|||
P 5450 4500
|
||||
F 0 "D2" H 5450 4600 40 0000 C CNN
|
||||
F 1 "DIODESCH" H 5450 4400 40 0000 C CNN
|
||||
F 2 "" H 5450 4500 60 0000 C CNN
|
||||
F 2 "SM0805-diode" H 5450 4500 60 0001 C CNN
|
||||
F 3 "" H 5450 4500 60 0000 C CNN
|
||||
1 5450 4500
|
||||
1 0 0 -1
|
||||
|
@ -904,7 +901,7 @@ U 1 1 549BD32D
|
|||
P 5450 4800
|
||||
F 0 "D3" H 5450 4900 40 0000 C CNN
|
||||
F 1 "DIODESCH" H 5450 4700 40 0000 C CNN
|
||||
F 2 "" H 5450 4800 60 0000 C CNN
|
||||
F 2 "SM0805-diode" H 5450 4800 60 0001 C CNN
|
||||
F 3 "" H 5450 4800 60 0000 C CNN
|
||||
1 5450 4800
|
||||
1 0 0 -1
|
||||
|
@ -931,7 +928,7 @@ U 1 1 549BDC77
|
|||
P 5750 5000
|
||||
F 0 "C12" H 5750 5100 40 0000 L CNN
|
||||
F 1 "10uF" H 5756 4915 40 0000 L CNN
|
||||
F 2 "~" H 5788 4850 30 0000 C CNN
|
||||
F 2 "SM0805" H 5788 4850 30 0001 C CNN
|
||||
F 3 "~" H 5750 5000 60 0000 C CNN
|
||||
1 5750 5000
|
||||
1 0 0 -1
|
||||
|
@ -972,7 +969,7 @@ U 1 1 549BE7CD
|
|||
P 6775 2225
|
||||
F 0 "P1" V 6725 2225 60 0000 C CNN
|
||||
F 1 "CONN_20" V 6825 2225 60 0000 C CNN
|
||||
F 2 "" H 6775 2225 60 0000 C CNN
|
||||
F 2 "PIN_ARRAY_20X1" H 6775 2225 60 0001 C CNN
|
||||
F 3 "" H 6775 2225 60 0000 C CNN
|
||||
1 6775 2225
|
||||
-1 0 0 -1
|
||||
|
@ -983,7 +980,7 @@ U 1 1 549BE7DA
|
|||
P 8725 2225
|
||||
F 0 "P2" V 8675 2225 60 0000 C CNN
|
||||
F 1 "CONN_20" V 8775 2225 60 0000 C CNN
|
||||
F 2 "" H 8725 2225 60 0000 C CNN
|
||||
F 2 "PIN_ARRAY_20X1" H 8725 2225 60 0001 C CNN
|
||||
F 3 "" H 8725 2225 60 0000 C CNN
|
||||
1 8725 2225
|
||||
1 0 0 -1
|
||||
|
@ -1175,7 +1172,7 @@ U 1 1 549EE660
|
|||
P 4075 7050
|
||||
F 0 "U2" H 4175 7450 70 0000 C CNN
|
||||
F 1 "NUF2101MT1G" H 4075 6650 70 0000 C CNN
|
||||
F 2 "~" H 4075 7050 60 0000 C CNN
|
||||
F 2 "SOT-457" H 4075 7050 60 0001 C CNN
|
||||
F 3 "~" H 4075 7050 60 0000 C CNN
|
||||
1 4075 7050
|
||||
-1 0 0 1
|
||||
|
@ -1186,4 +1183,81 @@ Wire Wire Line
|
|||
3375 7300 3225 7300
|
||||
Wire Wire Line
|
||||
4775 6800 4925 6800
|
||||
$Sheet
|
||||
S 8850 5000 850 500
|
||||
U 54AA767A
|
||||
F0 "CAN BUS" 50
|
||||
F1 "can_brd_1.sch" 50
|
||||
F2 "CANH" I R 9700 5100 60
|
||||
F3 "CANL" I R 9700 5200 60
|
||||
F4 "3.3V" I L 8850 5200 60
|
||||
F5 "GND" I L 8850 5400 60
|
||||
F6 "CAN_RX" I R 9700 5300 60
|
||||
F7 "CAN_TX" I R 9700 5400 60
|
||||
F8 "5V" I L 8850 5100 60
|
||||
$EndSheet
|
||||
Text Label 8850 5100 2 60 ~ 0
|
||||
+5v
|
||||
Text Label 8850 5200 2 60 ~ 0
|
||||
VCC
|
||||
$Comp
|
||||
L GND #PWR030
|
||||
U 1 1 54AA7D1B
|
||||
P 8850 5400
|
||||
F 0 "#PWR030" H 8850 5400 30 0001 C CNN
|
||||
F 1 "GND" H 8850 5330 30 0001 C CNN
|
||||
F 2 "" H 8850 5400 60 0001 C CNN
|
||||
F 3 "" H 8850 5400 60 0001 C CNN
|
||||
1 8850 5400
|
||||
0 1 1 0
|
||||
$EndComp
|
||||
Text Label 9700 5200 0 60 ~ 0
|
||||
CANL
|
||||
Text Label 9700 5100 0 60 ~ 0
|
||||
CANH
|
||||
Text Label 9700 5300 0 60 ~ 0
|
||||
CANRX
|
||||
Text Label 9700 5400 0 60 ~ 0
|
||||
CANTX
|
||||
Text Label 4575 2550 0 60 ~ 0
|
||||
CANRX
|
||||
Text Label 4575 2650 0 60 ~ 0
|
||||
CANTX
|
||||
Wire Wire Line
|
||||
4575 2650 4175 2650
|
||||
Text Notes 5350 2675 0 60 ~ 0
|
||||
If CAN is installed\nremove R4
|
||||
$Comp
|
||||
L PWR_FLAG #FLG031
|
||||
U 1 1 54AB3F14
|
||||
P 2575 1450
|
||||
F 0 "#FLG031" H 2575 1545 30 0001 C CNN
|
||||
F 1 "PWR_FLAG" H 2575 1630 30 0000 C CNN
|
||||
F 2 "" H 2575 1450 60 0000 C CNN
|
||||
F 3 "" H 2575 1450 60 0000 C CNN
|
||||
1 2575 1450
|
||||
0 -1 -1 0
|
||||
$EndComp
|
||||
$Comp
|
||||
L PWR_FLAG #FLG032
|
||||
U 1 1 54AB40B5
|
||||
P 3375 6800
|
||||
F 0 "#FLG032" H 3375 6895 30 0001 C CNN
|
||||
F 1 "PWR_FLAG" H 3375 6980 30 0000 C CNN
|
||||
F 2 "" H 3375 6800 60 0000 C CNN
|
||||
F 3 "" H 3375 6800 60 0000 C CNN
|
||||
1 3375 6800
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
$Comp
|
||||
L PWR_FLAG #FLG033
|
||||
U 1 1 54AB40D9
|
||||
P 3375 7300
|
||||
F 0 "#FLG033" H 3375 7395 30 0001 C CNN
|
||||
F 1 "PWR_FLAG" H 3375 7480 30 0000 C CNN
|
||||
F 2 "" H 3375 7300 60 0000 C CNN
|
||||
F 3 "" H 3375 7300 60 0000 C CNN
|
||||
1 3375 7300
|
||||
1 0 0 -1
|
||||
$EndComp
|
||||
$EndSCHEMATC
|
||||
|
|
Loading…
Reference in New Issue