Update SaMoCon authored by Pavel Pisa's avatar Pavel Pisa
# SaMocon - SAMV71 Based Motion Control Board
## Basic Parameters
Project has been moved to its own specific GitLab section
- [ATSAMV71Q21B-ANB](https://www.microchip.com/en-us/product/ATSAMV71Q21) ([Datasheet](https://ww1.microchip.com/downloads/aemDocuments/documents/MCU32/ProductDocuments/DataSheets/SAM-E70-S70-V70-V71-Family-Data-Sheet-DS60001527.pdf))
- Power stages [IFX007](https://www.infineon.com/cms/en/product/power/motor-control-ics/brushed-dc-motor-control-ics/single-half-bridge-ics/ifx007t/?redirId=240461) , ideally 8×, or two levels with 4× + 4×
- https://gitlab.fel.cvut.cz/otrees/motion/samocon
## Connectors
and documentation to
- PWR In 3 pin
- 2× 4-pin motor out
- 2× 10-pin HP/Avago HEDL
- 2× 5-pin HAL inputs from motor
- 2× CAN FD
- 1× RS-485
- 1× RS-232 or TLL level for applications (if does not fit, then combined with RS-485)
- 4-pin serial TTL console
- Ethernet RJ45
- USB device
- I2C (optional)
- 8-pin SPI (optional)
- analog in (optional)
- SWD debugging
### TTL Console
Connector Connector [NS25-W4P](https://www.tme.eu/cz/details/ns25-w4p/signalove-konektory-raster-2-54mm/ninigi/)
| Pin | Signal |
| ----- | ------ |
| 1 | GND |
| 2 | TxD |
| 3 | VCC |
| 4 | RxD |
Chosen peripheral UART3, pins:
- URXD3 (PD28)
- UTXD3 (PD31)
### SD card
[SD slot](https://www.tme.eu/cz/details/mcc-sdmicro_3/konektory-ke-kartam/attend/112j-tdar-r01/)
### Serial line
It's not the same as TTL console because of control signals. To use all the features of the serial line, USART peripheral must be used (not UART). Chosen peripheral is USART2.
Pins:
- RXD2 (PD15)
- TXD2 (PD16)
- RTS2 (PD18)
- CTS2 (PD19)
#### RS-232
Connector [NS25-W5P](https://www.tme.eu/cz/details/ns25-w5p/signalove-konektory-raster-2-54mm/ninigi/)
|Pin on PCB | Signal | DB9 | PC Signal | DB25 | DB9 |
|------------ | ----- | ----- | ----- | ----- | ----- |
| 1 | TxD | 2 | RxD | 3 | 2 |
| 2 | RxD | 3 | TxD | 2 | 3 |
| 3 | RTS | 8 | CTS | 5 | 8 |
| 4 | CTS | 7 | RTS | 4 | 7 |
| 5 | GND | 5 | GND | 7 | 5 |
#### RS-485
Connector [NS25-W2P](https://www.tme.eu/cz/details/ns25-w2p/signalove-konektory-raster-2-54mm/ninigi/)
|Pin| Signal |
|---| ----- |
| 1 | D/R- |
| 2 | D/R+ |
### 10-pin HP/Avago HEDL
Connector [ZL231-10PG](https://www.tme.eu/cz/details/zl231-10pg/konektory-idc/connfly/ds1013-10ssib1-b-0/)
| Signal | 10-pin flat | Delta15-pin | IRC HPHEDL | IRC HPHEDS |
| --- | --- | --- | --- | --- |
| Mark Inv | 1 | 1 | - | |
| +5V | 2 | 9 | 2 | 4 |
| GND | 3 | 2 | 3 | 1 |
| Mark | 4 | 10 | - | |
| Phase A Inv | 5 | 3 | 5 | |
| Phase A | 6 | 11 | 6 | 3 |
| Phase B Inv | 7 | 4 | 7 | |
| Phase B | 8 | 12 | 8 | 5 |
| Index Inv | 9 | 5 | 9 | |
| Index | 10 | 13 | 10 | 2 |
| | | 6 | | |
| Motor + | | 14,7 | | |
| Motor - | | 15,8 | | |
Suitable pin (PHA, PHB, IDX) groups for QDEC function
- TC0,1,2: TIOA0 (PA0), TIOB0 (PA1), TIOB1 (PA16) (usable, collisions with I2CS peripheral, PWM (l) and ext. mem)
- TC3,4,5: TIOA3 (PC23), TIOB3 (PC24), TIOB4 (PC27) (usable, collisions with SPI1 and ext. mem)
- TC6,7,8: TIOA6 (PC5), TIOB6 (PC6), TIOB7 (PC9) (usable, collisions with ext. mem)
- TC9,10,11: TIOA9 (PE0), TIOB9 (PE1), TIOB10 (PE4) (usable, collisions ADC channels)
Selected timer pins for quadruple decoder:
- TC6,7,8: collisions only with data for external memory (we wont use such addressable memories): pins PC5, PC6, PC9
- TC0,1,2: substitute for A9, B9, B10 (no ADC collisions)
Other pins can be chosen too because of no collisions on these pins.
### SPI 8-pin
Connector Connector [NS25-W8P](https://www.tme.eu/cz/details/ns25-w8p/signalove-konektory-raster-2-54mm/ninigi/)
| Pin | Signal |
| --- | ---- |
| 1 | VCC |
| 2 | GND |
| 3 | MISO |
| 4 | MOSI |
| 5 | SCLK |
| 6 | CS1 |
| 7 | CS2 |
| 8 | CS3 |
Selected peripheral for SPI: SPI0 (SPI1 could be used but it has collision with a lot of ADCs).
Pins:
- MISO: (PD20)
- MOSI: (PD21)
- CLK: (PD22)
- CS0: (PB2)
- CS1: (PD25)
- CS2: (PD12)
- CS3: (PD27)
### I2C
Two-Wire interface (TWIHS) with pins TWCK and TWD (equivalent to SCL, SDA respectively) will be used. The microcontroller incorporates three TWIHS peripherals. Chosen peripheral is TWIHS0.
Pinouts:
- TWCK0 (PA4)
- TWD0 (PA3)
Connector Connector [NS25-W4P](https://www.tme.eu/cz/details/ns25-w4p/signalove-konektory-raster-2-54mm/ninigi/)
| Pin | Signal |
| ----- | ------ |
| 1 | GND |
| 2 | SCL |
| 3 | VCC |
| 4 | SDA |
### CAN FD
Connector Connector [15EDGVC-3.5-03P](https://www.tme.eu/cz/details/15edgvc-3.5-03p/rozpojitelne-svorkovnice/degson-electronics/15edgvc-3-5-03p-14-00a-h/)
| Pin | Signal |
| ----- | ------ |
| 1 | CANH |
| 2 | CANL |
| 3 | GND |
Chosen peripheral is MCAN1, pins:
- CANRX1 (PC12)
- CANTX1 (PC14)
### USB
Will be handled by USBHS peripheral, pins HSDM/DM (data-) and HSDP/DP (data+) should be used.
DM is pin 136, DP is pin 137.
Connector [USB4105-GF-A](https://www.tme.eu/cz/details/usb4105-gf-a/konektory-usb-a-ieee1394/global-connector-technology-gct/)
### Ethernet RJ45
PHY options
- [KSZ8081](https://www.microchip.com/en-us/product/ksz8081)
- [KSZ8061](https://www.microchip.com/en-us/product/ksz8061),
[Crystal](https://www.tme.eu/cz/details/3225-25m-sr/krystalove-rezonatory-smd/sr-passives/) for PHY (25 MHz, +-50 ppm)
Magnetics [HX1188NL](https://www.tme.eu/cz/details/hx1188nl/tlumivky-smd-ostatni/pulse/)
Connector [RJHSE-5384](https://www.tme.eu/cz/details/rjhse-5384/konektory-rj/amphenol-communications-solutions/)
The peripheral handling ethernet is GMAC. RMII mode was used in our case.
### SWD debugging
Full JTAG Connector options (PiKRON JT_USB6)
- [ZL231-10PG](https://www.tme.eu/cz/details/zl231-10pg/konektory-idc/connfly/ds1013-10ssib1-b-0/)
| Pin | Signal |
| ----- | ------ |
| 1 | TCK (SWDCLK) |
| 2 | VCC |
| 3 | TDI |
| 4 | SRST |
| 5 | TDO (TRACESWO) |
| 6 | RST |
| 7 | TRST |
| 8 | GND |
| 9 | TMS (SWDIO) |
| 10 | GND |
ST-Link SWD Connector options
- [ZL231-10PG](https://www.tme.eu/cz/details/zl231-10pg/konektory-idc/connfly/ds1013-10ssib1-b-0/)
| Pin | Signal |
| ----- | ------ |
| 1 | RST |
| 2 | SWDIO |
| 3 | GND |
| 4 | GND |
| 5 | SWIM |
| 6 | SWCLK |
| 7 | 3.3V |
| 8 | 3.3V |
| 9 | 5.0V |
| 10 | 5.0V |
Elekroline
| Pin | Signal |
| ----- | ------ |
| 1 | 3.3V |
| 2 | GND |
| 3 | SWDIO |
| 4 | SWCLK |
| 5 | RST |
### 5-pin HAL inputs from motor
Connector Connector [NS25-W5P](https://www.tme.eu/cz/details/ns25-w5p/signalove-konektory-raster-2-54mm/ninigi/)
| Pin | Signal |
| ----- | ------ |
| 1 | +5 V |
| 2 | HAL1 |
| 3 | HAL2 |
| 4 | HAL3 |
| 5 | GND |
### PWR In 3 pin
Connector [XY2500V-D(5.08)-3PIN](https://www.tme.eu/cz/details/tbg-5-pw-3p-gn/rozpojitelne-svorkovnice/xinya/xy2500v-d-5-08-3pin/)
|Pin | Signal |
| ------ | ------ |
| 1 | +24 V Control |
| 2 | +24 V Motor |
| 3 | Power GND |
### Power outputs
Connector [TBG-5-PB-4P-GN](https://www.tme.eu/cz/details/tbg-5-pb-4p-gn/rozpojitelne-svorkovnice/xinya/xy2500v-c-5-08-4pin/)
Suitable pin groups for PWM function
- channel 0:
- PWMC0_PWMH0 (PA0,PA11,PA23,PB0,PD20): PA0 occupied by QDEC0, PA11 occupied by QSPI, other still free...
- PWMC0_PWMH1(PA2,PA12,PA24,PB1,PD11,PD21), PA2 occupied by QDEC0, PA12 occupied by QSPI, other still free...
- PWMC0_PWMH2(PA13,PA25,PB4,PC19,PD22),
- PWMC0_PWMH3(PA7,PA14,PA17,PC13,PC21,PD23)
- channel 1:
- PWMC1_PWMH0 (PA12,PD1) !! (PA12 occupied by QSPI, PD1 occupied by EMAC),
- PWMC1_PWMH1(PA14,PD3), !! (same as H0)
- PWMC1_PWMH2(PA31,PD5), maybe? (PA31 collisions with SPI0, !! PD5 collison with GRX0-EMAC)
- PWMC1_PWMH3(PA8,PD7), (PA8 collisions with AFEC, )
Due to compatibility with different power drivers, routing both H and L channels is desired. Concerning PWM0 peripheral, all H and L have been routed (all outputs are complementary). Concerning PWM1, it's not possible to route H output for channel 2 together with HSMCI peripheral (SD card), so only 3 channels have complementary outputs. Overall, 7 complementary channels PWM0_CH0-3 and PWM1_CH0-1,3 are available. It should be possible for L output to act the same as H output (and vice versa).
#### Power considerations
The power connector has two positive voltage rails, one for power outputs for motors and the second for control logic (MCU etc..). The power board should include a step-down 5V converter which will power the MCU board. The MCU board should by default be powered by 5V (we want the MCU board to be also powered from USB source). The MCU board should include a step-down 3.3V converter for powering the ATSAMV71.
## Additional peripherals
### QSPI (memories)
Pins: QSCK (only PA14), QCS (only PA11), QIO0 (only PA13), QIO1 (only PA12), QIO2 (only PA17), QIO3 (only PD31)
QSPI cannot be routed together if we want all 8 PWM output pins.
## Components
- DC-DC regulators:
- [AOZ1283PI](https://www.tme.eu/cz/details/aoz1283pi/stabilizator-napeti-obvody-dc-dc/alpha-omega-semiconductor/)
- [TPS62260](https://cz.mouser.com/ProductDetail/Texas-Instruments/TPS62260DDCTG4?qs=EkVHNy6q9HOocY9rqwnlvQ%3D%3D)
- EEPROM
- [24AA64](https://ww1.microchip.com/downloads/aemDocuments/documents/MPD/ProductDocuments/DataSheets/24AA64-24FC64-24LC64-64-Kbit-I2C-Serial-EEPROM-20001189U.pdf)
- [24AA025E48-I/SN](https://www.microchip.com/en-us/product/24aa025e48) with preprogrammed EUI-48
- QSPI Flash
- [W25Q512JVEIM](https://www.winbond.com/resource-files/W25Q512JV%20DTR%20RevD%2006292020%20133.pdf) (64MB)
- Option for larger capacity [W25Q01JV](https://www.winbond.com/resource-files/W25Q01JV%20SPI%20RevC%2005032021%20Plus%20dummy.pdf) (128 MB)
- CAN FD transceiver with galvanic isolation
- [ISO1042BQDWVQ1](https://www.ti.com/product/ISO1042-Q1/part-details/ISO1042BQDWVQ1) or ADM3050EBRIZ
- or some combination of digital insulator and transceiver (i.e. SI8622EC-B-IS + MCP2542FD)
- RS-485
- ADM2483 or some other combination
- Current sensing operational amplifiers
- MCP6291T-I/OT or MCP6021T-E/OT
- https://gitlab.fel.cvut.cz/otrees/motion/samocon/-/wikis