Revert "Video6 uploaded"
This commit is contained in:
230
Pcb-1-lan9252/CubeMX-files/EtherCAT-PCB-v1.ioc
Executable file
230
Pcb-1-lan9252/CubeMX-files/EtherCAT-PCB-v1.ioc
Executable file
@@ -0,0 +1,230 @@
|
||||
#MicroXplorer Configuration settings - do not modify
|
||||
CAD.formats=
|
||||
CAD.pinconfig=
|
||||
CAD.provider=
|
||||
File.Version=6
|
||||
GPIO.groupedBy=
|
||||
KeepUserPlacement=false
|
||||
Mcu.CPN=STM32F407VGT6
|
||||
Mcu.Family=STM32F4
|
||||
Mcu.IP0=DAC
|
||||
Mcu.IP1=I2C2
|
||||
Mcu.IP10=TIM8
|
||||
Mcu.IP11=USART1
|
||||
Mcu.IP2=NVIC
|
||||
Mcu.IP3=RCC
|
||||
Mcu.IP4=SPI1
|
||||
Mcu.IP5=SYS
|
||||
Mcu.IP6=TIM1
|
||||
Mcu.IP7=TIM2
|
||||
Mcu.IP8=TIM3
|
||||
Mcu.IP9=TIM4
|
||||
Mcu.IPNb=12
|
||||
Mcu.Name=STM32F407V(E-G)Tx
|
||||
Mcu.Package=LQFP100
|
||||
Mcu.Pin0=PA0-WKUP
|
||||
Mcu.Pin1=PA1
|
||||
Mcu.Pin10=PB1
|
||||
Mcu.Pin11=PE7
|
||||
Mcu.Pin12=PE8
|
||||
Mcu.Pin13=PE9
|
||||
Mcu.Pin14=PE10
|
||||
Mcu.Pin15=PE11
|
||||
Mcu.Pin16=PE12
|
||||
Mcu.Pin17=PE13
|
||||
Mcu.Pin18=PE14
|
||||
Mcu.Pin19=PE15
|
||||
Mcu.Pin2=PA2
|
||||
Mcu.Pin20=PB10
|
||||
Mcu.Pin21=PB11
|
||||
Mcu.Pin22=PD11
|
||||
Mcu.Pin23=PD12
|
||||
Mcu.Pin24=PD13
|
||||
Mcu.Pin25=PC6
|
||||
Mcu.Pin26=PC7
|
||||
Mcu.Pin27=PC9
|
||||
Mcu.Pin28=PA8
|
||||
Mcu.Pin29=PA9
|
||||
Mcu.Pin3=PA4
|
||||
Mcu.Pin30=PA10
|
||||
Mcu.Pin31=PA11
|
||||
Mcu.Pin32=PA12
|
||||
Mcu.Pin33=PC10
|
||||
Mcu.Pin34=PB4
|
||||
Mcu.Pin35=PB5
|
||||
Mcu.Pin36=PB6
|
||||
Mcu.Pin37=VP_SYS_VS_Systick
|
||||
Mcu.Pin4=PA5
|
||||
Mcu.Pin5=PA6
|
||||
Mcu.Pin6=PA7
|
||||
Mcu.Pin7=PC4
|
||||
Mcu.Pin8=PC5
|
||||
Mcu.Pin9=PB0
|
||||
Mcu.PinsNb=38
|
||||
Mcu.ThirdPartyNb=0
|
||||
Mcu.UserConstants=
|
||||
Mcu.UserName=STM32F407VGTx
|
||||
MxCube.Version=6.9.2
|
||||
MxDb.Version=DB.6.0.92
|
||||
NVIC.BusFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false
|
||||
NVIC.DebugMonitor_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false
|
||||
NVIC.ForceEnableDMAVector=true
|
||||
NVIC.HardFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false
|
||||
NVIC.MemoryManagement_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false
|
||||
NVIC.NonMaskableInt_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false
|
||||
NVIC.PendSV_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false
|
||||
NVIC.PriorityGroup=NVIC_PRIORITYGROUP_4
|
||||
NVIC.SVCall_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false
|
||||
NVIC.SysTick_IRQn=true\:15\:0\:false\:false\:true\:false\:true\:false
|
||||
NVIC.UsageFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false
|
||||
PA0-WKUP.Signal=S_TIM2_CH1_ETR
|
||||
PA1.Signal=S_TIM2_CH2
|
||||
PA10.Mode=Asynchronous
|
||||
PA10.Signal=USART1_RX
|
||||
PA11.Signal=S_TIM1_CH4
|
||||
PA12.Locked=true
|
||||
PA12.Signal=GPIO_Output
|
||||
PA2.Locked=true
|
||||
PA2.Signal=GPIO_Input
|
||||
PA4.Signal=COMP_DAC1_group
|
||||
PA5.Mode=Full_Duplex_Master
|
||||
PA5.Signal=SPI1_SCK
|
||||
PA6.Mode=Full_Duplex_Master
|
||||
PA6.Signal=SPI1_MISO
|
||||
PA7.Mode=Full_Duplex_Master
|
||||
PA7.Signal=SPI1_MOSI
|
||||
PA8.Locked=true
|
||||
PA8.Signal=GPIO_Input
|
||||
PA9.Mode=Asynchronous
|
||||
PA9.Signal=USART1_TX
|
||||
PB0.Locked=true
|
||||
PB0.Signal=GPIO_Input
|
||||
PB1.Locked=true
|
||||
PB1.Signal=GPIO_Input
|
||||
PB10.Mode=I2C
|
||||
PB10.Signal=I2C2_SCL
|
||||
PB11.Mode=I2C
|
||||
PB11.Signal=I2C2_SDA
|
||||
PB4.Signal=S_TIM3_CH1
|
||||
PB5.Signal=S_TIM3_CH2
|
||||
PB6.Locked=true
|
||||
PB6.Signal=GPIO_Input
|
||||
PC10.Locked=true
|
||||
PC10.Signal=GPIO_Output
|
||||
PC4.Locked=true
|
||||
PC4.Signal=GPIO_Output
|
||||
PC5.Locked=true
|
||||
PC5.Signal=GPIO_Input
|
||||
PC6.Signal=S_TIM8_CH1
|
||||
PC7.Signal=S_TIM8_CH2
|
||||
PC9.Signal=S_TIM8_CH4
|
||||
PD11.Locked=true
|
||||
PD11.Signal=GPIO_Input
|
||||
PD12.Signal=S_TIM4_CH1
|
||||
PD13.Signal=S_TIM4_CH2
|
||||
PE10.Locked=true
|
||||
PE10.Signal=GPIO_Output
|
||||
PE11.Locked=true
|
||||
PE11.Signal=GPIO_Output
|
||||
PE12.Locked=true
|
||||
PE12.Signal=GPIO_Input
|
||||
PE13.Locked=true
|
||||
PE13.Signal=GPIO_Input
|
||||
PE14.Locked=true
|
||||
PE14.Signal=GPIO_Input
|
||||
PE15.Locked=true
|
||||
PE15.Signal=GPIO_Input
|
||||
PE7.Locked=true
|
||||
PE7.Signal=GPIO_Output
|
||||
PE8.Locked=true
|
||||
PE8.Signal=GPIO_Output
|
||||
PE9.Locked=true
|
||||
PE9.Signal=GPIO_Output
|
||||
PinOutPanel.RotationAngle=0
|
||||
ProjectManager.AskForMigrate=true
|
||||
ProjectManager.BackupPrevious=false
|
||||
ProjectManager.CompilerOptimize=6
|
||||
ProjectManager.ComputerToolchain=false
|
||||
ProjectManager.CoupleFile=false
|
||||
ProjectManager.CustomerFirmwarePackage=
|
||||
ProjectManager.DefaultFWLocation=true
|
||||
ProjectManager.DeletePrevious=true
|
||||
ProjectManager.DeviceId=STM32F407VGTx
|
||||
ProjectManager.FirmwarePackage=STM32Cube FW_F4 V1.27.1
|
||||
ProjectManager.FreePins=false
|
||||
ProjectManager.HalAssertFull=false
|
||||
ProjectManager.HeapSize=0x200
|
||||
ProjectManager.KeepUserCode=true
|
||||
ProjectManager.LastFirmware=true
|
||||
ProjectManager.LibraryCopy=0
|
||||
ProjectManager.MainLocation=Core/Src
|
||||
ProjectManager.NoMain=false
|
||||
ProjectManager.PreviousToolchain=
|
||||
ProjectManager.ProjectBuild=false
|
||||
ProjectManager.ProjectFileName=EtherCAT-PCB-v1.ioc
|
||||
ProjectManager.ProjectName=EtherCAT-PCB-v1
|
||||
ProjectManager.ProjectStructure=
|
||||
ProjectManager.RegisterCallBack=
|
||||
ProjectManager.StackSize=0x400
|
||||
ProjectManager.TargetToolchain=EWARM V8.50
|
||||
ProjectManager.ToolChainLocation=
|
||||
ProjectManager.UAScriptAfterPath=
|
||||
ProjectManager.UAScriptBeforePath=
|
||||
ProjectManager.UnderRoot=false
|
||||
ProjectManager.functionlistsort=1-SystemClock_Config-RCC-false-HAL-false,2-MX_GPIO_Init-GPIO-false-HAL-true,3-MX_DAC_Init-DAC-false-HAL-true,4-MX_I2C2_Init-I2C2-false-HAL-true,5-MX_SPI1_Init-SPI1-false-HAL-true,6-MX_TIM1_Init-TIM1-false-HAL-true,7-MX_TIM2_Init-TIM2-false-HAL-true,8-MX_TIM3_Init-TIM3-false-HAL-true,9-MX_TIM4_Init-TIM4-false-HAL-true,10-MX_TIM8_Init-TIM8-false-HAL-true,11-MX_USART1_UART_Init-USART1-false-HAL-true
|
||||
RCC.AHBFreq_Value=16000000
|
||||
RCC.APB1Freq_Value=16000000
|
||||
RCC.APB2Freq_Value=16000000
|
||||
RCC.CortexFreq_Value=16000000
|
||||
RCC.FamilyName=M
|
||||
RCC.HSE_VALUE=25000000
|
||||
RCC.HSI_VALUE=16000000
|
||||
RCC.I2SClocksFreq_Value=96000000
|
||||
RCC.IPParameters=AHBFreq_Value,APB1Freq_Value,APB2Freq_Value,CortexFreq_Value,FamilyName,HSE_VALUE,HSI_VALUE,I2SClocksFreq_Value,LSE_VALUE,LSI_VALUE,PLLCLKFreq_Value,PLLQCLKFreq_Value,RTCFreq_Value,RTCHSEDivFreq_Value,SYSCLKFreq_VALUE,VCOI2SOutputFreq_Value,VCOInputFreq_Value,VCOOutputFreq_Value,VcooutputI2S
|
||||
RCC.LSE_VALUE=32768
|
||||
RCC.LSI_VALUE=32000
|
||||
RCC.PLLCLKFreq_Value=96000000
|
||||
RCC.PLLQCLKFreq_Value=48000000
|
||||
RCC.RTCFreq_Value=32000
|
||||
RCC.RTCHSEDivFreq_Value=12500000
|
||||
RCC.SYSCLKFreq_VALUE=16000000
|
||||
RCC.VCOI2SOutputFreq_Value=192000000
|
||||
RCC.VCOInputFreq_Value=1000000
|
||||
RCC.VCOOutputFreq_Value=192000000
|
||||
RCC.VcooutputI2S=96000000
|
||||
SH.COMP_DAC1_group.0=DAC_OUT1,DAC_OUT1
|
||||
SH.COMP_DAC1_group.ConfNb=1
|
||||
SH.S_TIM1_CH4.0=TIM1_CH4,PWM Generation4 CH4
|
||||
SH.S_TIM1_CH4.ConfNb=1
|
||||
SH.S_TIM2_CH1_ETR.0=TIM2_CH1,Encoder_Interface
|
||||
SH.S_TIM2_CH1_ETR.ConfNb=1
|
||||
SH.S_TIM2_CH2.0=TIM2_CH2,Encoder_Interface
|
||||
SH.S_TIM2_CH2.ConfNb=1
|
||||
SH.S_TIM3_CH1.0=TIM3_CH1,Encoder_Interface
|
||||
SH.S_TIM3_CH1.ConfNb=1
|
||||
SH.S_TIM3_CH2.0=TIM3_CH2,Encoder_Interface
|
||||
SH.S_TIM3_CH2.ConfNb=1
|
||||
SH.S_TIM4_CH1.0=TIM4_CH1,Encoder_Interface
|
||||
SH.S_TIM4_CH1.ConfNb=1
|
||||
SH.S_TIM4_CH2.0=TIM4_CH2,Encoder_Interface
|
||||
SH.S_TIM4_CH2.ConfNb=1
|
||||
SH.S_TIM8_CH1.0=TIM8_CH1,Encoder_Interface
|
||||
SH.S_TIM8_CH1.ConfNb=1
|
||||
SH.S_TIM8_CH2.0=TIM8_CH2,Encoder_Interface
|
||||
SH.S_TIM8_CH2.ConfNb=1
|
||||
SH.S_TIM8_CH4.0=TIM8_CH4,PWM Generation4 CH4
|
||||
SH.S_TIM8_CH4.ConfNb=1
|
||||
SPI1.CalculateBaudRate=8.0 MBits/s
|
||||
SPI1.Direction=SPI_DIRECTION_2LINES
|
||||
SPI1.IPParameters=VirtualType,Mode,Direction,CalculateBaudRate
|
||||
SPI1.Mode=SPI_MODE_MASTER
|
||||
SPI1.VirtualType=VM_MASTER
|
||||
TIM1.Channel-PWM\ Generation4\ CH4=TIM_CHANNEL_4
|
||||
TIM1.IPParameters=Channel-PWM Generation4 CH4
|
||||
TIM8.Channel-PWM\ Generation4\ CH4=TIM_CHANNEL_4
|
||||
TIM8.IPParameters=Channel-PWM Generation4 CH4
|
||||
USART1.IPParameters=VirtualMode
|
||||
USART1.VirtualMode=VM_ASYNC
|
||||
VP_SYS_VS_Systick.Mode=SysTick
|
||||
VP_SYS_VS_Systick.Signal=SYS_VS_Systick
|
||||
board=custom
|
||||
69
Pcb-1-lan9252/Dig_8IN_8OUT.xml
Executable file
69
Pcb-1-lan9252/Dig_8IN_8OUT.xml
Executable file
@@ -0,0 +1,69 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<EtherCATInfo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="EtherCATInfo.xsd" Version="1.6">
|
||||
<Vendor>
|
||||
<Id>#x000004D8</Id>
|
||||
<Name>Microchip Technology Inc</Name>
|
||||
</Vendor>
|
||||
<Descriptions>
|
||||
<Groups>
|
||||
<Group>
|
||||
<Type>LAN9252-DIGIO</Type>
|
||||
<Name LcId="1033">LAN9252-DIGIO</Name>
|
||||
<ImageData16x14>424DD8020000000000003600000028000000100000000E0000000100180000000000A2020000120B0000120B000000000000000000001306E31306E3190CE42B1FE62B1FE61306E31F13E5190CE42519E51306E31306E3190CE42F24E7190CE41306E31306E31306E31306E35F56EC645CED645CED4137E91F13E5473DE95F57EC3227E71306E3473DE95A51EC271BE61306E31306E31409CA524CC68E8AD74F48C1615CC82218D03E36BF716BCE746FCE453DC01307CE3931BA7D78D27671D1150CB21409CA1712801B1D1D1B1D1D1B1D1D1B1D1D120B891B1D1D1B1D1D1B1D1D1B1D1D120B891B1D1D1B1D1D1B1D1D1B1D1D1712801712807F8080D4D5D5D4D5D5383939120B89545656D4D5D5D4D5D5626464130C89292B2BD4D5D5D4D5D56264641915801712804647471B1D1DAAAAAAD4D5D5130E82383939292B2B717272D4D5D5151183D4D5D57F80801B1D1D7172721E1C81191580464747D4D5D5D4D5D51B1D1D19158A292B2BD4D5D5D4D5D5292B2B1B1B8AD4D5D56264641B1D1D1B1D1D2427821E1D81D4D5D54647476264643839391E208BD4D5D57F8080464747545656242A8BD4D5D59B9C9C292B2BAAAAAA2D3683252882464747D4D5D5D4D5D51B1D1D272D85292B2BD4D5D5D4D5D5292B2B2E37861B1D1DD4D5D5D4D5D5464747394484323BB52324812122822426822526824554C0323883292B822A2D83353C84424CBF3238843940842E32834853865D6EBB5262EB3E43E83334E74147E94349E9535FEB4D56EA5662EB484DEA545DEB636FED545AEA5A63EC6671ED8CA0F290A5F2748AEF6B7BEE5D68EC6874ED788AEF8397F17684EF7986EF8C9FF2818FF1818EF08E9DF18A97F18791F19BA9F3B0C0F691A4F291A2F28390F192A1F29CACF3A3B3F498A6F3A4B3F4AEBDF5B0BEF59EA8F3A3ADF4BBC7F7C4D1F8CAD7F8CED9F9B4C4F6B8C8F6ACB8F59AA3F3B6C1F6C5D2F8C2CDF8CCD7F9D2DDF9D5E0FAD2DAF9D5DCF9DFE7FBE2E9FBE5EBFBE8EEFB0000</ImageData16x14>
|
||||
</Group>
|
||||
</Groups>
|
||||
<Devices>
|
||||
<Device Physics="YY">
|
||||
<Type ProductCode="#x0000000d" RevisionNo="#x00000001">LAN9252-DIGIO-2PORT</Type>
|
||||
<Name LcId="1033"><![CDATA[9252 8 Ch. Dig. In-/Output 2xMII (No DC)]]></Name>
|
||||
<Info>
|
||||
<EtherCATController>
|
||||
<DpramSize>4096</DpramSize>
|
||||
<SmCount>4</SmCount>
|
||||
<FmmuCount>3</FmmuCount>
|
||||
</EtherCATController>
|
||||
<Port>
|
||||
<Type>MII</Type>
|
||||
<PhysicalPhyAddr>0</PhysicalPhyAddr>
|
||||
</Port>
|
||||
<Port>
|
||||
<Type>MII</Type>
|
||||
<PhysicalPhyAddr>1</PhysicalPhyAddr>
|
||||
</Port>
|
||||
<IdentificationAdo>#x0012</IdentificationAdo>
|
||||
</Info>
|
||||
<GroupType>LAN9252-DIGIO</GroupType>
|
||||
<Fmmu>Outputs</Fmmu>
|
||||
<Fmmu>Inputs</Fmmu>
|
||||
<Sm StartAddress="#x0f01" ControlByte="#x44" Enable="1" OpOnly="1">Outputs</Sm>
|
||||
<Sm StartAddress="#x1000" ControlByte="0" Enable="1">Inputs</Sm>
|
||||
<RxPdo Fixed="1" Sm="0">
|
||||
<Index>#x1a00</Index>
|
||||
<Name>Byte 0</Name>
|
||||
<Entry>
|
||||
<Index>#x3101</Index>
|
||||
<SubIndex>1</SubIndex>
|
||||
<BitLen>8</BitLen>
|
||||
<Name>Output</Name>
|
||||
<DataType>BITARR8</DataType>
|
||||
</Entry>
|
||||
</RxPdo>
|
||||
<TxPdo Fixed="1" Sm="1">
|
||||
<Index>#x1600</Index>
|
||||
<Name>Byte 0</Name>
|
||||
<Entry>
|
||||
<Index>#x3001</Index>
|
||||
<SubIndex>1</SubIndex>
|
||||
<BitLen>8</BitLen>
|
||||
<Name>Input</Name>
|
||||
<DataType>BITARR8</DataType>
|
||||
</Entry>
|
||||
</TxPdo>
|
||||
<Eeprom>
|
||||
<ByteSize>2048</ByteSize>
|
||||
<ConfigData>040F00441027F0FF</ConfigData>
|
||||
</Eeprom>
|
||||
</Device>
|
||||
</Devices>
|
||||
</Descriptions>
|
||||
</EtherCATInfo>
|
||||
2
Pcb-1-lan9252/EEPROM_generator/.gitignore
vendored
Normal file
2
Pcb-1-lan9252/EEPROM_generator/.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
*.bin
|
||||
node_modules
|
||||
26
Pcb-1-lan9252/EEPROM_generator/LICENSE
Normal file
26
Pcb-1-lan9252/EEPROM_generator/LICENSE
Normal file
@@ -0,0 +1,26 @@
|
||||
EEPROM generator
|
||||
|
||||
Victor Sluiter 2013-2018
|
||||
Kuba Buda 2020-2022
|
||||
|
||||
EEPROM generator is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License version 2 as published by the Free
|
||||
Software Foundation.
|
||||
|
||||
EEPROM generator is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
As a special exception, if other files instantiate templates or use macros
|
||||
or inline functions from this file, or you compile this file and link it
|
||||
with other works to produce a work based on this file, this file does not
|
||||
by itself cause the resulting work to be covered by the GNU General Public
|
||||
License. However the source code for this file must still be made available
|
||||
in accordance with section (3) of the GNU General Public License.
|
||||
|
||||
This exception does not invalidate any other reasons why a work based on
|
||||
this file might be covered by the GNU General Public License.
|
||||
|
||||
The EtherCAT Technology, the trade name and logo "EtherCAT" are the intellectual
|
||||
property of, and protected by Beckhoff Automation GmbH.
|
||||
120
Pcb-1-lan9252/EEPROM_generator/README.md
Normal file
120
Pcb-1-lan9252/EEPROM_generator/README.md
Normal file
@@ -0,0 +1,120 @@
|
||||
# [🔁 EEPROM generator](https://kubabuda.github.io/EEPROM_generator)
|
||||
|
||||
This is basic code generator tool for EtherCAT devices, using [SOES library](https://github.com/OpenEtherCATsociety/SOES).
|
||||
|
||||
[It is available online, here](https://kubabuda.github.io/EEPROM_generator)
|
||||
|
||||
You can configure:
|
||||
- ESC (Ethercat Slave Chip)
|
||||
- OD (CANopen Object Dictionary) entries
|
||||
- PDO mappings (which OD objects are mapped in TX, RX datagrams)
|
||||
|
||||
Tool generates consistent data across C sources, ESI file and EEPROM content.
|
||||
|
||||
It also backs up your current project in localstorage. You can save project to JSON file on your hard drive, restore from it later, and download all files at once.
|
||||
|
||||
## Limitations
|
||||
|
||||
- Only single, non-dynamic PDO is supported for TX and RX respectively
|
||||
- Some data types might not be supported
|
||||
- Browsers other than Firefox might not be supported
|
||||
|
||||
If you need more, [RT-Labs](https://rt-labs.com/ethercat/) offers professional IDE - EtherCAT SDK, and training.
|
||||
|
||||
# Development
|
||||
|
||||
Pull requests welcome.
|
||||
|
||||
Source code is intentionally keept in plain Javascript files so that build system like webpack or even web server is not needed.
|
||||
The only dependency is web browser, that should future proof it.
|
||||
|
||||
## [Unit tests](https://kubabuda.github.io/EEPROM_generator/tests.html)
|
||||
|
||||
[Unit tests](https://kubabuda.github.io/EEPROM_generator/tests.html) are using [Jasmine](https://jasmine.github.io).
|
||||
|
||||
## OD structure
|
||||
|
||||
OD is keept as JSON object. Expected data format:
|
||||
|
||||
```js
|
||||
{
|
||||
'1000': { otype: OTYPE.VAR, dtype: DTYPE.UNSIGNED32, name: 'Device Type', value: 0x1389 },
|
||||
'1008': { otype: OTYPE.VAR, dtype: DTYPE.VISIBLE_STRING, name: 'Device Name', data: '' },
|
||||
'1009': { otype: OTYPE.VAR, dtype: DTYPE.VISIBLE_STRING, name: 'Hardware Version', data: '' },
|
||||
'100A': { otype: OTYPE.VAR, dtype: DTYPE.VISIBLE_STRING, name: 'Software Version', data: '' },
|
||||
'1018': { otype: OTYPE.RECORD, name: 'Identity Object', items: [
|
||||
{ name: 'Max SubIndex' },
|
||||
{ name: 'Vendor ID', dtype: DTYPE.UNSIGNED32, value: 600 },
|
||||
{ name: 'Product Code', dtype: DTYPE.UNSIGNED32 },
|
||||
{ name: 'Revision Number', dtype: DTYPE.UNSIGNED32 },
|
||||
{ name: 'Serial Number', dtype: DTYPE.UNSIGNED32, data: '&Obj.serial' },
|
||||
]},
|
||||
'1C00': { otype: OTYPE.ARRAY, dtype: DTYPE.UNSIGNED8, name: 'Sync Manager Communication Type', items: [
|
||||
{ name: 'Max SubIndex' },
|
||||
{ name: 'Communications Type SM0', value: 1 },
|
||||
{ name: 'Communications Type SM1', value: 2 },
|
||||
{ name: 'Communications Type SM2', value: 3 },
|
||||
{ name: 'Communications Type SM3', value: 4 },
|
||||
]},
|
||||
}
|
||||
```
|
||||
|
||||
OD model for generator has 4 sections:
|
||||
|
||||
- `sdo`, not mapped to PDOs
|
||||
- `txpdo`, mapped to TXPDO (SM3). Expected format (for OTYPE VAR):
|
||||
```js
|
||||
{
|
||||
'6000': { otype: OTYPE.VAR, dtype: DTYPE.UNSIGNED32, name: 'TXPDO', value: 0x1389, pdo_mappings: ['tx'] },
|
||||
}
|
||||
```
|
||||
- `rxpdo`, same as above, but `pdo_mappings: ['rx']`
|
||||
- mandatory objects. These are added at code gen stage, with values populated form UI controls.
|
||||
|
||||
Code generation copies all values into single OD, adds PDO mappings and SM assignments.
|
||||
|
||||
## PDO mappings
|
||||
|
||||
Currently single, non-dynamic PDO is supported for TX and RX respectively.
|
||||
|
||||
## Binary file comparison tool for Windows: [VBinDiff](https://www.cjmweb.net/vbindiff/VBinDiff-Win32)
|
||||
|
||||
```cmd
|
||||
VBinDiff et1100.bin lan9252.bin
|
||||
```
|
||||
|
||||
|
||||
# TODO
|
||||
|
||||
- add support for 64bit number types
|
||||
- why default dark mode has dark text in Chromium but not Firefox, when OS is in dark mode
|
||||
- generate .h file for EEPROM emulation
|
||||
- add support for LAN9253 Direct, XMC4300, XMC4800
|
||||
- check output for boolean ARRAY
|
||||
- check output for VISIBLE_STRING ARRAY
|
||||
- check output for VISIBLE_STRING RECORD subitem
|
||||
- dynamic/multiple PDOs
|
||||
- more unit tests
|
||||
- SM2 offset: regardles of value set, SDK generates RXPDO mappings as SDO1600. SM2 offset change affects
|
||||
- `ecat_options.h` #define SM2_sma, MAX_TXPDO_SIZE and MAX_RXPDO_SIZE
|
||||
- `esi.xml` `<Sm ControlByte="#x24" Enable="1" StartAddress="#x1600">Outputs</Sm>`
|
||||
currently this tool mirrors SDK behavior, check if this hack is needed or just duplicated SDK bug
|
||||
- calculate `MAX_RXPDO_SIZE`, `MAX_TXPDO_SIZE` based on selected SM2 offset
|
||||
- modular device profile
|
||||
- set project name from device name
|
||||
- DC config in ESI .bin
|
||||
|
||||
- use [XML parsing](https://www.w3schools.com/xml/xml_parser.asp) for cleaner builiding ESI XML output
|
||||
- read XML files: make reverse eningeering 3rd party devices easier
|
||||
- add indexes list to OD model, to decrease parametes count in methods
|
||||
- 0x1001 UINT8 Error Register is mandatory according to CiA DS301
|
||||
- 0x1C12/0x1C13 `PdoAssign` and 0x1608/0x1A08 `PdoMapping` [should be RW](https://infosys.beckhoff.com/english.php?content=../content/1033/el6695/1317558667.html&id=)
|
||||
|
||||
### Code optimization
|
||||
|
||||
- reuse repeated string constants in objlist.c names, test if does any good or compiler does that for you anyway
|
||||
|
||||
# Disclaimer
|
||||
|
||||
The EtherCAT Technology, the trade name and logo "EtherCAT" are the intellectual
|
||||
property of, and protected by Beckhoff Automation GmbH.
|
||||
BIN
Pcb-1-lan9252/EEPROM_generator/img/banner.JPG
Normal file
BIN
Pcb-1-lan9252/EEPROM_generator/img/banner.JPG
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 46 KiB |
BIN
Pcb-1-lan9252/EEPROM_generator/img/logo.JPG
Normal file
BIN
Pcb-1-lan9252/EEPROM_generator/img/logo.JPG
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 17 KiB |
415
Pcb-1-lan9252/EEPROM_generator/index.html
Normal file
415
Pcb-1-lan9252/EEPROM_generator/index.html
Normal file
@@ -0,0 +1,415 @@
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>🔁 EEPROM Generator | ESI, EEPORM, SOES C code configuration tool</title>
|
||||
<!--
|
||||
* SOES EEPROM generator
|
||||
* This tool serves as:
|
||||
- EtherCAT Slave Information XML + EEPROM binary generator
|
||||
- SOES code generator
|
||||
|
||||
* Victor Sluiter 2013-2018
|
||||
* Kuba Buda 2020-2021
|
||||
-->
|
||||
<script src="lib/jszip.min.js"></script>
|
||||
|
||||
<script src="src/constants.js"></script>
|
||||
<script src="src/od.js"></script>
|
||||
<script src="src/file_io.js"></script>
|
||||
<script src="src/backup.js"></script>
|
||||
|
||||
<script src="src/generators/ecat_options.js"></script>
|
||||
<script src="src/generators/EEPROM.js"></script>
|
||||
<script src="src/generators/esi_xml.js"></script>
|
||||
<script src="src/generators/objectlist.js"></script>
|
||||
<script src="src/generators/utypes.js"></script>
|
||||
|
||||
<script src="src/ui.js"></script>
|
||||
|
||||
<link rel="stylesheet" href="styles/styles.css">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<!-- Modal dialog to edit OD objects -->
|
||||
<div id="editObjectModal" class="modal">
|
||||
<!-- Modal content -->
|
||||
<div class="modal-content">
|
||||
<span class="close" onClick="odModalClose()">×</span>
|
||||
<h3 id="editObjectTitle">Edit object</h3>
|
||||
<form name="EditObjectForm" id="EditObjectForm" action="" onsubmit="onEditObjectSubmit(this); return false;">
|
||||
<table border="0">
|
||||
<tr id="dialogRowIndex">
|
||||
<td>Index:</td>
|
||||
<td><input type = "text" name="Index" value="0x6000" title="Enter OD index for the new object" id="modalInputIndex"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Name of Object:</td>
|
||||
<td><input type = "text" name="ObjectName" value="" title="Enter name for the new object" id="modalInputObjectName"></td>
|
||||
</tr>
|
||||
<tr id="dialogRowDtype">
|
||||
<td>Data Type</td>
|
||||
<td><select type = "text" name="DTYPE" title="Enter data type of new object">
|
||||
<option value="BOOLEAN">BOOLEAN</option>
|
||||
<option value="INTEGER8">INTEGER8</option>
|
||||
<option value="INTEGER16">INTEGER16</option>
|
||||
<option value="INTEGER32">INTEGER32</option>
|
||||
<option value="UNSIGNED8">UNSIGNED8</option>
|
||||
<option value="UNSIGNED16">UNSIGNED16</option>
|
||||
<option value="UNSIGNED32">UNSIGNED32</option>
|
||||
<option value="REAL32">REAL32</option>
|
||||
<option value="VISIBLE_STRING">VISIBLE STRING</option>
|
||||
</select></td>
|
||||
</tr>
|
||||
<tr id="dialogRowValue">
|
||||
<td>Value:</td>
|
||||
<td><input type = "text" name="InitalValue" value="0" title="Enter initial value for the new object"></td>
|
||||
</tr>
|
||||
<tr id="dialogRowAccess">
|
||||
<td>Access:</td>
|
||||
<td><select type = "text" name="Access" title="Enter access mode of new object">
|
||||
<option value="RO">RO</option>
|
||||
<option value="RW">RW</option>
|
||||
<option value="WO">WO</option>
|
||||
<option value="RWpre">RWpre</option>
|
||||
</select></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="center">
|
||||
<button name="Cancel" onClick='odModalClose();'>✖️ Cancel </button>
|
||||
</td><td>
|
||||
<input type="submit" name="SaveChanges" value="✔️ Save changes ">
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Modal dialog to edit synchronization modes -->
|
||||
<div id="syncModal" class="modal">
|
||||
<!-- Modal content -->
|
||||
<div class="modal-content">
|
||||
<span class="close" onClick="syncModalClose()">×</span>
|
||||
<h3 id="editObjectTitle">Edit synchronization mode</h3>
|
||||
|
||||
<form name="syncModalForm" id="syncModalForm" action="" onsubmit="onSyncSubmit(this); return false;">
|
||||
<table border="0">
|
||||
<tr>
|
||||
<td>Name:</td>
|
||||
<td><input type = "text" name="Name" value="New sync modee" title="Enter Name for new sync mode" id="syncModalName"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Description:</td>
|
||||
<td><input type = "text" name="Description" value="New sync mode description" title="Enter Description for new sync mode" id="syncModalDescription"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Assign Activate:</td>
|
||||
<td><input type = "text" name="AssignActivate" value="0x0" title="Enter Assign Activate value for new sync mode" id="syncModalAssignActivate"></td>
|
||||
</tr>
|
||||
</table>
|
||||
<table border="0">
|
||||
<tr>
|
||||
<td>S0 cycle</td>
|
||||
<td><input type = "text" name="Sync0cycleTime" value="0" title="Enter Sync0 cycle time" id="syncModalSync0cycleTime"></td>
|
||||
<td>S0 shift</td>
|
||||
<td><input type = "text" name="Sync0shiftTime" value="0" title="Enter Sync0 shift time" id="syncModalSync0shiftTime"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>S1 cycle</td>
|
||||
<td><input type = "text" name="Sync1cycleTime" value="0" title="Enter Sync1 cycle time" id="syncModalSync1cycleTime"></td>
|
||||
<td>S1 shift</td>
|
||||
<td><input type = "text" name="Sync1shiftTime" value="0" title="Enter Sync1 shift time" id="syncModalSync1shiftTime"></td>
|
||||
</tr>
|
||||
</table>
|
||||
<table border="0" style="padding-top: 20px;">
|
||||
<tr>
|
||||
<td align="center">
|
||||
<button name="Cancel" onClick='syncModalClose();'>✖️ Cancel </button>
|
||||
</td><td>
|
||||
<input type="submit" name="SaveChanges" value="✔️ Save changes ">
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="settings-menu">
|
||||
<span></span>
|
||||
<h1> 🔁 EEPROM generator</h1>
|
||||
<div>
|
||||
<div class="dropdown">
|
||||
<button class="dropbtn">⚙️ Settings</button>
|
||||
<div class="dropdown-content">
|
||||
<a href="#">
|
||||
<button name="DarkMode" onClick='toggleDarkMode();' title="Toggle dark mode">
|
||||
<span class="display-dark">🌞 Light mode</span>
|
||||
<span class="display-light">🌜 Dark mode</span>
|
||||
</button>
|
||||
</a>
|
||||
<a href="./tests.html">
|
||||
<button name="tests" title="Run unit tests">
|
||||
🔴🟢 Tests
|
||||
</button>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="main-wrapper">
|
||||
<div id="pageHeading">
|
||||
<h2> EtherCAT EEPROM + SOES OD configuration tool</h2>
|
||||
<p>
|
||||
This page serves as a tool to generate consistent data across your code, ESI file and EEPROM data.
|
||||
Hover over the fields to get additional info about the items you can change. <br>
|
||||
For more detail on how these values translate to the corresponding files, and where you can find more info in the ETG documentation,
|
||||
look into javascript source that generates these files</a>.<br>
|
||||
</p><p>
|
||||
C source code is generated for SOES: Simple Open source EtherCAT Slave stack.
|
||||
Its source code with example applications <a href="https://github.com/OpenEtherCATsociety/SOES">is available on Github</a>.
|
||||
Docs with basic tutorial <a href="https://rt-labs.com/docs/soes/tutorial.html">can be found on rt-labs page</a>
|
||||
</p>
|
||||
</div>
|
||||
<br>
|
||||
|
||||
<form name="SlaveForm" id="SlaveForm" action="" onsubmit="return false;">
|
||||
<table border="0">
|
||||
<tr>
|
||||
<td><strong>Item:</strong></td><td><strong>Value</strong></td><td width="12%"><strong>ESI</strong></td><td width="12%"><strong>EEPROM</strong></td><td width="12%"><strong>objectlist.c</strong></td><td width="12%"><strong>ecat_options.h</strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Name of Vendor:</td><td><input type = "text" name="VendorName" value="ACME EtherCAT Devices" title="Enter the name as how you are known in the EtherCAT Technology Group members list"></td><td>x</td><td> </td><td> </td><td> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>VendorID:</td><td><input type = "text" name="VendorID" value="0x000" title="You need to be member of the ETG to get a VendorID!
 Enter in hex (0x...) or decimal."></td><td>x</td><td>x</td><td>x</td><td> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>ProductCode:</td><td><input type = "text" name="ProductCode" value="0x00ab123" title="The code of your Product...
Each different product should have its own code.
Enter in hex (0x...) or decimal."></td><td>x</td><td>x</td><td>x</td><td> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Profile No:</td><td><input type = "text" name="ProfileNo" value="5001" title="Profile number of your Product...
Used to identify device type.
Enter in hex (0x...) or decimal."></td><td>x</td><td></td><td></td><td> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>RevisionNumber:</td><td><input type = "text" name="RevisionNumber" value="0x002" title="Revision of Product
 Enter in hex (0x...) or decimal."></td><td>x</td><td>x</td><td>x</td><td> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>SerialNumber:</td><td><input type = "text" name="SerialNumber" value="0x001" title="Serial number; may be used in production.
 Enter in hex (0x...) or decimal."></td><td>x</td><td>x</td><td>x</td><td> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Hardware version:</td><td><input type = "text" name="HWversion" value="0.0.1" title="Enter HW version as string"><td>x</td><td>x</td><td>x</td><td> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Software version:</td><td><input type = "text" name="SWversion" value="0.0.1" title="Enter SW version as string"></td><td>x</td><td>x</td><td>x</td><td> </td>
|
||||
</tr>
|
||||
<tr><td colspan="6"><hr></td</tr>
|
||||
<tr>
|
||||
<td>Number of <strong>bytes</strong> in EEPROM:</td><td><input type = "text" name="EEPROMsize" value="2048" title="Number of bytes in EEPROM; 2048
2048*8=16kilobit
Enter in hex (0x...) or decimal."></td><td>x</td><td>x</td><td> </td><td> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>RxMailbox Offset:</td><td><input type = "text" name="RxMailboxOffset" value="0x1000" title="Offset in memory. Do not change unless you are really sure what you're doing"></td><td>x</td><td>x</td><td> </td><td>x</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>TxMailbox Offset:</td><td><input type = "text" name="TxMailboxOffset" value="0x1200" title="Offset in memory. Do not change unless you are really sure what you're doing"></td><td>x</td><td>x</td><td> </td><td>x</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Tx AND Rx Mailbox Size:</td><td><input type = "text" name="MailboxSize" value="512" title="Size of mailbox in bytes.
Do not change unless you are really sure what you're doing."></td><td>x</td><td>x</td><td> </td><td>x</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>SyncManager 2 offset:</td><td><input type = "text" name="SM2Offset" value="0x1600" title="Offset in memory. Do not change unless you are really sure what you're doing"></td><td>x</td><td>x</td><td> </td><td>x</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>SyncManager 3 offset:</td><td><input type = "text" name="SM3Offset" value="0x1A00" title="Offset in memory. Do not change unless you are really sure what you're doing"></td><td>x</td><td>x</td><td> </td><td>x</td>
|
||||
</tr>
|
||||
<tr><td colspan="6"><hr></td</tr>
|
||||
<tr>
|
||||
<td>Group Type:</td><td><input type = "text" name="TextGroupType" value="DigIn" title="Group Type, like DigIn, DigOut, Measurement, ...
See ETG2000, this is used for grouping in the ESI file"></td><td>x</td><td>x</td><td> </td><td> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Group Name:</td><td><input type = "text" name="TextGroupName5" value="Digital input" title="Description of Group
See ETG2000, this is used for grouping in the ESI file"></td><td>x</td><td> </td><td> </td><td> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Image Name:</td><td><input type = "text" name="ImageName" value="IMGCBY" title="Name of image used in EtherCAT Configurator"></td><td> </td><td>x</td><td> </td><td> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Device Type:</td><td><input type = "text" name="TextDeviceType" value="DigIn2000" title="Name or order code of product"></td><td>x</td><td>x</td><td> </td><td> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Device Name:</td><td><input type = "text" name="TextDeviceName" value="2-channel Hypergalactic input superimpermanator" title="Description of your device"></td><td>x</td><td>x</td><td>x</td><td> </td>
|
||||
</tr>
|
||||
<tr><td colspan="6"><hr></td</tr>
|
||||
<tr>
|
||||
<td>Port 0 Physical interface:</td><td><select name="Port0Physical" title="Select which physical connection is used on each physical port of your Beckhoff ASIC (ET1100, ET1200)">
|
||||
<option value="Y" selected>MII</option>
|
||||
<option value="H">MII-Fast Hot Connect</option>
|
||||
<option value="K">EBUS</option>
|
||||
<option value=" ">Not Used</option>
|
||||
</select></td><td>x</td><td>x</td><td> </td><td> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Port 1 Physical interface:</td><td><select name="Port1Physical" title="Select which physical connection is used on each physical port of your Beckhoff ASIC (ET1100, ET1200)">
|
||||
<option value="Y" selected>MII</option>
|
||||
<option value="H">MII-Fast Hot Connect</option>
|
||||
<option value="K">EBUS</option>
|
||||
<option value=" ">Not Used</option>
|
||||
</select></td><td>x</td><td>x</td><td> </td><td> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Port 2 Physical interface:</td><td><select name="Port2Physical" title="Select which physical connection is used on each physical port of your Beckhoff ASIC (ET1100, ET1200)">
|
||||
<option value="Y">MII</option>
|
||||
<option value="H">MII-Fast Hot Connect</option>
|
||||
<option value="K">EBUS</option>
|
||||
<option value=" " selected>Not Used</option>
|
||||
</select></td><td>x</td><td>x</td><td> </td><td> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Port 3 Physical interface:</td><td><select name="Port3Physical" title="Select which physical connection is used on each physical port of your Beckhoff ASIC (ET1100, ET1200)">
|
||||
<option value="Y">MII</option>
|
||||
<option value="H">MII-Fast Hot Connect</option>
|
||||
<option value="K">EBUS</option>
|
||||
<option value=" " selected>Not Used</option>
|
||||
</select></td><td>x</td><td>x</td><td> </td><td> </td>
|
||||
</tr>
|
||||
<tr><td colspan="6"><hr></td</tr>
|
||||
<tr>
|
||||
<td>ESC (EtherCAT Slave Chip):</td><td><select name="ESC" title="Select which ESC (EtherCAT Slave Chip) is used">
|
||||
<option value="AX58100">AX58100</option>
|
||||
<option value="ET1100">ET1100</option>
|
||||
<option value="LAN9252">LAN9252</option>
|
||||
<option value="LAN9253 Beckhoff">LAN9253 Beckhoff</option>
|
||||
</select></td><td>x</td><td>x</td><td> </td><td> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>SPI mode:</td><td><select name="SPImode" title="Select which SPI mode is used">
|
||||
<option value="3">3 (CPOL=1 CPHA=1) </option>
|
||||
<option value="2">2 (CPOL=1 CPHA=0) </option>
|
||||
<option value="1">1 (CPOL=0 CPHA=1) </option>
|
||||
<option value="0">0 (CPOL=0 CPHA=0) </option>
|
||||
</select></td><td>x</td><td>x</td><td> </td><td> </td>
|
||||
</tr>
|
||||
<tr><td colspan="6"><hr></td</tr>
|
||||
<tr><td>
|
||||
<input type="checkbox" name="CoeDetailsEnableSDO" value="EnableSDO" checked>Enable SDO<br>
|
||||
<input type="checkbox" name="CoeDetailsEnableSDOInfo" value="EnableSDOInfo" checked>Enable SDO Info<br>
|
||||
<input type="checkbox" name="CoeDetailsEnablePDOAssign" value="EnablePDOAssign">Enable PDO Assign<br>
|
||||
<input type="checkbox" name="CoeDetailsEnablePDOConfiguration" value="EnablePDOConfiguration">Enable PDO Configuration<br>
|
||||
<input type="checkbox" name="CoeDetailsEnableUploadAtStartup" value="EnableUploadAtStartup" checked>Enable Upload at startup<br>
|
||||
<input type="checkbox" name="CoeDetailsEnableSDOCompleteAccess" value="EnableSDOCompleteAccess">Enable SDO complete access <br>
|
||||
</td><td> </td><td>x</td><td>x</td><td> </td><td> </td>
|
||||
</tr>
|
||||
<tr><td colspan="6"><hr></td</tr>
|
||||
<tr><td colspan="6">
|
||||
<h3 class="odSectionHeading">
|
||||
<span class="odSectionTitle"> SDO </span>
|
||||
<span>
|
||||
<button onClick="editVAR_Click(sdo)">➕ Add variable</button>
|
||||
<button onClick="editARRAY_Click(sdo)">➕ Add Array</button>
|
||||
<button onClick="editRECORD_Click(sdo)">➕ Add Record</button>
|
||||
</span>
|
||||
</h3>
|
||||
<div id="tr_sdo"></div>
|
||||
</td></tr>
|
||||
|
||||
<tr><td colspan="6"><hr></td</tr>
|
||||
<tr><td colspan="6">
|
||||
<h3 class="odSectionHeading">
|
||||
<span title="We are assuming single, fixed TxPDO" class="odSectionTitle"> TXPDO (slv to master) </span>
|
||||
<span>
|
||||
<button onClick="editVAR_Click(txpdo)">➕ Add variable</button>
|
||||
<button onClick="editARRAY_Click(txpdo)">➕ Add Array</button>
|
||||
<button onClick="editRECORD_Click(txpdo)">➕ Add Record</button>
|
||||
</span>
|
||||
</h3>
|
||||
<div id="tr_txpdo"></div>
|
||||
</td></tr>
|
||||
|
||||
<tr><td colspan="6"><hr></td</tr>
|
||||
<tr><td colspan="6">
|
||||
<h3 class="odSectionHeading">
|
||||
<span title="We are assuming single, fixed RxPDO" class="odSectionTitle"> RXPDO (master to slv) </span>
|
||||
<span>
|
||||
<button onClick="editVAR_Click(rxpdo)">➕ Add variable</button>
|
||||
<button onClick="editARRAY_Click(rxpdo)">➕ Add Array</button>
|
||||
<button onClick="editRECORD_Click(rxpdo)">➕ Add Record</button>
|
||||
</span>
|
||||
</h3>
|
||||
<div id="tr_rxpdo"></div>
|
||||
</td></tr>
|
||||
|
||||
<tr><td colspan="6"><hr></td</tr>
|
||||
<h3 class="odSectionHeading">
|
||||
<span title="Distributed Clocks configuration" class="odSectionTitle"> Synchronization </span>
|
||||
<span>
|
||||
<button onClick="addSyncClick()">➕ Add DC settings</button>
|
||||
</span>
|
||||
</h3>
|
||||
<div id="dcSyncModes"></div>
|
||||
|
||||
<tr><td colspan="6"><hr></td</tr>
|
||||
|
||||
<tr><td colspan="6" align="center">
|
||||
<button name="GenerateDownload" onclick="onGenerateDownloadClick()" title="Generate all files and download at once">
|
||||
⏬ Download all files
|
||||
</button>
|
||||
<button id='GenerateFilesButton' name="Generate" onClick="onGenerateClick();" title="Generate all files">
|
||||
Generate files
|
||||
</button>
|
||||
<button name="Save" onClick='onSaveClick();' title="Download current settings and Object Dictionary state as JSON file">
|
||||
⤵️ Save project
|
||||
</button>
|
||||
<button name="Restore" onClick='onRestoreClick();' title="Load settings and Object Dictionary state from previously saved JSON file">
|
||||
⤴️ Restore project
|
||||
</button>
|
||||
<button name="Reset" onClick='onResetClick();' title="Reset settings to default values and remove all Object Dictionary entries">
|
||||
‼️ Reset project
|
||||
</button>
|
||||
</td></tr>
|
||||
</table>
|
||||
</form>
|
||||
|
||||
<br><br>
|
||||
<form name="outCodeForm" id="outCodeForm" spellcheck="false" action="" onsubmit="return false;">
|
||||
ESI file:
|
||||
<button name="DownloadESI" onClick="onDownloadEsiXmlClick()">
|
||||
🔽 Download
|
||||
</button>
|
||||
<br>
|
||||
<textarea cols = "150" rows = "12" name="ESI">ESI File</textarea><br><br>
|
||||
EEPROM HEX file:
|
||||
<button name="Download_HEX"
|
||||
onClick="downloadFile(getOutputForm().HEX.value, fileName = 'eeprom.hex', contentType = 'application/octet-stream');">
|
||||
🔽 Download
|
||||
</button>
|
||||
<button name="Download_BIN" onClick="onDownloadBinClick();">
|
||||
🔽 Download .bin
|
||||
</button>
|
||||
<br>
|
||||
To flash slave device with generated EEPROM content, you can <a href="https://github.com/OpenEtherCATsociety/SOEM/">install SOEM</a>
|
||||
and run command (for Intel Hex):
|
||||
<br><br><i title="For binary, use flag -w instead of -wi" id="hexInstallCmd">sudo ./eepromtool 1 eth0 -wi eeprom.hex</i><br><br>
|
||||
|
||||
<textarea cols = "150" rows = "12" name="HEX">Hex File</textarea><br><br>
|
||||
ecat_options.h:
|
||||
<button name="Download_ecat_options"
|
||||
onClick="downloadFile(getOutputForm().ecat_options.value, fileName = 'ecat_options.h', contentType = 'text/plain');">
|
||||
🔽 Download
|
||||
</button>
|
||||
<br>
|
||||
<textarea cols = "150" rows = "12" name="ecat_options">ecat_options.h</textarea><br><br>
|
||||
objectlist.c:
|
||||
<button name="Download_objectlist"
|
||||
onClick="downloadFile(getOutputForm().objectlist.value, fileName = 'objectlist.c', contentType = 'text/plain');">
|
||||
🔽 Download
|
||||
</button>
|
||||
<br>
|
||||
<textarea cols = "150" rows = "12" name="objectlist">objectlist.c</textarea><br><br>
|
||||
utypes.h:
|
||||
<button name="Download_utypes"
|
||||
onClick="downloadFile(getOutputForm().utypes.value, fileName = 'utypes.h', contentType = 'text/plain');">
|
||||
🔽 Download
|
||||
</button>
|
||||
<br>
|
||||
<textarea cols = "150" rows = "12" name="utypes">utypes.h</textarea><br><br>
|
||||
<input id="restoreFileInput" type='file' accept=".json" style="visibility:hidden;" onchange="readFile(event)" />
|
||||
</form>
|
||||
</div>
|
||||
</body>
|
||||
139
Pcb-1-lan9252/EEPROM_generator/lib/jasmine-3.8.0/boot.js
Normal file
139
Pcb-1-lan9252/EEPROM_generator/lib/jasmine-3.8.0/boot.js
Normal file
@@ -0,0 +1,139 @@
|
||||
/**
|
||||
Starting with version 2.0, this file "boots" Jasmine, performing all of the necessary initialization before executing the loaded environment and all of a project's specs. This file should be loaded after `jasmine.js` and `jasmine_html.js`, but before any project source files or spec files are loaded. Thus this file can also be used to customize Jasmine for a project.
|
||||
|
||||
If a project is using Jasmine via the standalone distribution, this file can be customized directly. If a project is using Jasmine via the [Ruby gem][jasmine-gem], this file can be copied into the support directory via `jasmine copy_boot_js`. Other environments (e.g., Python) will have different mechanisms.
|
||||
|
||||
The location of `boot.js` can be specified and/or overridden in `jasmine.yml`.
|
||||
|
||||
[jasmine-gem]: http://github.com/pivotal/jasmine-gem
|
||||
*/
|
||||
|
||||
(function() {
|
||||
var jasmineRequire = window.jasmineRequire || require('./jasmine.js');
|
||||
|
||||
/**
|
||||
* ## Require & Instantiate
|
||||
*
|
||||
* Require Jasmine's core files. Specifically, this requires and attaches all of Jasmine's code to the `jasmine` reference.
|
||||
*/
|
||||
var jasmine = jasmineRequire.core(jasmineRequire),
|
||||
global = jasmine.getGlobal();
|
||||
global.jasmine = jasmine;
|
||||
|
||||
/**
|
||||
* Since this is being run in a browser and the results should populate to an HTML page, require the HTML-specific Jasmine code, injecting the same reference.
|
||||
*/
|
||||
jasmineRequire.html(jasmine);
|
||||
|
||||
/**
|
||||
* Create the Jasmine environment. This is used to run all specs in a project.
|
||||
*/
|
||||
var env = jasmine.getEnv();
|
||||
|
||||
/**
|
||||
* ## The Global Interface
|
||||
*
|
||||
* Build up the functions that will be exposed as the Jasmine public interface. A project can customize, rename or alias any of these functions as desired, provided the implementation remains unchanged.
|
||||
*/
|
||||
var jasmineInterface = jasmineRequire.interface(jasmine, env);
|
||||
|
||||
/**
|
||||
* Add all of the Jasmine global/public interface to the global scope, so a project can use the public interface directly. For example, calling `describe` in specs instead of `jasmine.getEnv().describe`.
|
||||
*/
|
||||
extend(global, jasmineInterface);
|
||||
|
||||
/**
|
||||
* ## Runner Parameters
|
||||
*
|
||||
* More browser specific code - wrap the query string in an object and to allow for getting/setting parameters from the runner user interface.
|
||||
*/
|
||||
|
||||
var queryString = new jasmine.QueryString({
|
||||
getWindowLocation: function() { return window.location; }
|
||||
});
|
||||
|
||||
var filterSpecs = !!queryString.getParam("spec");
|
||||
|
||||
var config = {
|
||||
failFast: queryString.getParam("failFast"),
|
||||
oneFailurePerSpec: queryString.getParam("oneFailurePerSpec"),
|
||||
hideDisabled: queryString.getParam("hideDisabled")
|
||||
};
|
||||
|
||||
var random = queryString.getParam("random");
|
||||
|
||||
if (random !== undefined && random !== "") {
|
||||
config.random = random;
|
||||
}
|
||||
|
||||
var seed = queryString.getParam("seed");
|
||||
if (seed) {
|
||||
config.seed = seed;
|
||||
}
|
||||
|
||||
/**
|
||||
* ## Reporters
|
||||
* The `HtmlReporter` builds all of the HTML UI for the runner page. This reporter paints the dots, stars, and x's for specs, as well as all spec names and all failures (if any).
|
||||
*/
|
||||
var htmlReporter = new jasmine.HtmlReporter({
|
||||
env: env,
|
||||
navigateWithNewParam: function(key, value) { return queryString.navigateWithNewParam(key, value); },
|
||||
addToExistingQueryString: function(key, value) { return queryString.fullStringWithNewParam(key, value); },
|
||||
getContainer: function() { return document.body; },
|
||||
createElement: function() { return document.createElement.apply(document, arguments); },
|
||||
createTextNode: function() { return document.createTextNode.apply(document, arguments); },
|
||||
timer: new jasmine.Timer(),
|
||||
filterSpecs: filterSpecs
|
||||
});
|
||||
|
||||
/**
|
||||
* The `jsApiReporter` also receives spec results, and is used by any environment that needs to extract the results from JavaScript.
|
||||
*/
|
||||
env.addReporter(jasmineInterface.jsApiReporter);
|
||||
env.addReporter(htmlReporter);
|
||||
|
||||
/**
|
||||
* Filter which specs will be run by matching the start of the full name against the `spec` query param.
|
||||
*/
|
||||
var specFilter = new jasmine.HtmlSpecFilter({
|
||||
filterString: function() { return queryString.getParam("spec"); }
|
||||
});
|
||||
|
||||
config.specFilter = function(spec) {
|
||||
return specFilter.matches(spec.getFullName());
|
||||
};
|
||||
|
||||
env.configure(config);
|
||||
|
||||
/**
|
||||
* Setting up timing functions to be able to be overridden. Certain browsers (Safari, IE 8, phantomjs) require this hack.
|
||||
*/
|
||||
window.setTimeout = window.setTimeout;
|
||||
window.setInterval = window.setInterval;
|
||||
window.clearTimeout = window.clearTimeout;
|
||||
window.clearInterval = window.clearInterval;
|
||||
|
||||
/**
|
||||
* ## Execution
|
||||
*
|
||||
* Replace the browser window's `onload`, ensure it's called, and then run all of the loaded specs. This includes initializing the `HtmlReporter` instance and then executing the loaded Jasmine environment. All of this will happen after all of the specs are loaded.
|
||||
*/
|
||||
var currentWindowOnload = window.onload;
|
||||
|
||||
window.onload = function() {
|
||||
if (currentWindowOnload) {
|
||||
currentWindowOnload();
|
||||
}
|
||||
htmlReporter.initialize();
|
||||
env.execute();
|
||||
};
|
||||
|
||||
/**
|
||||
* Helper function for readability above.
|
||||
*/
|
||||
function extend(destination, source) {
|
||||
for (var property in source) destination[property] = source[property];
|
||||
return destination;
|
||||
}
|
||||
|
||||
}());
|
||||
853
Pcb-1-lan9252/EEPROM_generator/lib/jasmine-3.8.0/jasmine-html.js
Normal file
853
Pcb-1-lan9252/EEPROM_generator/lib/jasmine-3.8.0/jasmine-html.js
Normal file
@@ -0,0 +1,853 @@
|
||||
/*
|
||||
Copyright (c) 2008-2021 Pivotal Labs
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
"Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
var jasmineRequire = window.jasmineRequire || require('./jasmine.js');
|
||||
|
||||
jasmineRequire.html = function(j$) {
|
||||
j$.ResultsNode = jasmineRequire.ResultsNode();
|
||||
j$.HtmlReporter = jasmineRequire.HtmlReporter(j$);
|
||||
j$.QueryString = jasmineRequire.QueryString();
|
||||
j$.HtmlSpecFilter = jasmineRequire.HtmlSpecFilter();
|
||||
};
|
||||
|
||||
jasmineRequire.HtmlReporter = function(j$) {
|
||||
function ResultsStateBuilder() {
|
||||
this.topResults = new j$.ResultsNode({}, '', null);
|
||||
this.currentParent = this.topResults;
|
||||
this.specsExecuted = 0;
|
||||
this.failureCount = 0;
|
||||
this.pendingSpecCount = 0;
|
||||
}
|
||||
|
||||
ResultsStateBuilder.prototype.suiteStarted = function(result) {
|
||||
this.currentParent.addChild(result, 'suite');
|
||||
this.currentParent = this.currentParent.last();
|
||||
};
|
||||
|
||||
ResultsStateBuilder.prototype.suiteDone = function(result) {
|
||||
this.currentParent.updateResult(result);
|
||||
if (this.currentParent !== this.topResults) {
|
||||
this.currentParent = this.currentParent.parent;
|
||||
}
|
||||
|
||||
if (result.status === 'failed') {
|
||||
this.failureCount++;
|
||||
}
|
||||
};
|
||||
|
||||
ResultsStateBuilder.prototype.specStarted = function(result) {};
|
||||
|
||||
ResultsStateBuilder.prototype.specDone = function(result) {
|
||||
this.currentParent.addChild(result, 'spec');
|
||||
|
||||
if (result.status !== 'excluded') {
|
||||
this.specsExecuted++;
|
||||
}
|
||||
|
||||
if (result.status === 'failed') {
|
||||
this.failureCount++;
|
||||
}
|
||||
|
||||
if (result.status == 'pending') {
|
||||
this.pendingSpecCount++;
|
||||
}
|
||||
};
|
||||
|
||||
function HtmlReporter(options) {
|
||||
var config = function() {
|
||||
return (options.env && options.env.configuration()) || {};
|
||||
},
|
||||
getContainer = options.getContainer,
|
||||
createElement = options.createElement,
|
||||
createTextNode = options.createTextNode,
|
||||
navigateWithNewParam = options.navigateWithNewParam || function() {},
|
||||
addToExistingQueryString =
|
||||
options.addToExistingQueryString || defaultQueryString,
|
||||
filterSpecs = options.filterSpecs,
|
||||
htmlReporterMain,
|
||||
symbols,
|
||||
deprecationWarnings = [];
|
||||
|
||||
this.initialize = function() {
|
||||
clearPrior();
|
||||
htmlReporterMain = createDom(
|
||||
'div',
|
||||
{ className: 'jasmine_html-reporter' },
|
||||
createDom(
|
||||
'div',
|
||||
{ className: 'jasmine-banner' },
|
||||
createDom('a', {
|
||||
className: 'jasmine-title',
|
||||
href: 'http://jasmine.github.io/',
|
||||
target: '_blank'
|
||||
}),
|
||||
createDom('span', { className: 'jasmine-version' }, j$.version)
|
||||
),
|
||||
createDom('ul', { className: 'jasmine-symbol-summary' }),
|
||||
createDom('div', { className: 'jasmine-alert' }),
|
||||
createDom(
|
||||
'div',
|
||||
{ className: 'jasmine-results' },
|
||||
createDom('div', { className: 'jasmine-failures' })
|
||||
)
|
||||
);
|
||||
getContainer().appendChild(htmlReporterMain);
|
||||
};
|
||||
|
||||
var totalSpecsDefined;
|
||||
this.jasmineStarted = function(options) {
|
||||
totalSpecsDefined = options.totalSpecsDefined || 0;
|
||||
};
|
||||
|
||||
var summary = createDom('div', { className: 'jasmine-summary' });
|
||||
|
||||
var stateBuilder = new ResultsStateBuilder();
|
||||
|
||||
this.suiteStarted = function(result) {
|
||||
stateBuilder.suiteStarted(result);
|
||||
};
|
||||
|
||||
this.suiteDone = function(result) {
|
||||
stateBuilder.suiteDone(result);
|
||||
|
||||
if (result.status === 'failed') {
|
||||
failures.push(failureDom(result));
|
||||
}
|
||||
addDeprecationWarnings(result, 'suite');
|
||||
};
|
||||
|
||||
this.specStarted = function(result) {
|
||||
stateBuilder.specStarted(result);
|
||||
};
|
||||
|
||||
var failures = [];
|
||||
this.specDone = function(result) {
|
||||
stateBuilder.specDone(result);
|
||||
|
||||
if (noExpectations(result)) {
|
||||
var noSpecMsg = "Spec '" + result.fullName + "' has no expectations.";
|
||||
if (result.status === 'failed') {
|
||||
console.error(noSpecMsg);
|
||||
} else {
|
||||
console.warn(noSpecMsg);
|
||||
}
|
||||
}
|
||||
|
||||
if (!symbols) {
|
||||
symbols = find('.jasmine-symbol-summary');
|
||||
}
|
||||
|
||||
symbols.appendChild(
|
||||
createDom('li', {
|
||||
className: this.displaySpecInCorrectFormat(result),
|
||||
id: 'spec_' + result.id,
|
||||
title: result.fullName
|
||||
})
|
||||
);
|
||||
|
||||
if (result.status === 'failed') {
|
||||
failures.push(failureDom(result));
|
||||
}
|
||||
|
||||
addDeprecationWarnings(result, 'spec');
|
||||
};
|
||||
|
||||
this.displaySpecInCorrectFormat = function(result) {
|
||||
return noExpectations(result) && result.status === 'passed'
|
||||
? 'jasmine-empty'
|
||||
: this.resultStatus(result.status);
|
||||
};
|
||||
|
||||
this.resultStatus = function(status) {
|
||||
if (status === 'excluded') {
|
||||
return config().hideDisabled
|
||||
? 'jasmine-excluded-no-display'
|
||||
: 'jasmine-excluded';
|
||||
}
|
||||
return 'jasmine-' + status;
|
||||
};
|
||||
|
||||
this.jasmineDone = function(doneResult) {
|
||||
var banner = find('.jasmine-banner');
|
||||
var alert = find('.jasmine-alert');
|
||||
var order = doneResult && doneResult.order;
|
||||
var i;
|
||||
alert.appendChild(
|
||||
createDom(
|
||||
'span',
|
||||
{ className: 'jasmine-duration' },
|
||||
'finished in ' + doneResult.totalTime / 1000 + 's'
|
||||
)
|
||||
);
|
||||
|
||||
banner.appendChild(optionsMenu(config()));
|
||||
|
||||
if (stateBuilder.specsExecuted < totalSpecsDefined) {
|
||||
var skippedMessage =
|
||||
'Ran ' +
|
||||
stateBuilder.specsExecuted +
|
||||
' of ' +
|
||||
totalSpecsDefined +
|
||||
' specs - run all';
|
||||
// include window.location.pathname to fix issue with karma-jasmine-html-reporter in angular: see https://github.com/jasmine/jasmine/issues/1906
|
||||
var skippedLink =
|
||||
(window.location.pathname || '') +
|
||||
addToExistingQueryString('spec', '');
|
||||
alert.appendChild(
|
||||
createDom(
|
||||
'span',
|
||||
{ className: 'jasmine-bar jasmine-skipped' },
|
||||
createDom(
|
||||
'a',
|
||||
{ href: skippedLink, title: 'Run all specs' },
|
||||
skippedMessage
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
var statusBarMessage = '';
|
||||
var statusBarClassName = 'jasmine-overall-result jasmine-bar ';
|
||||
var globalFailures = (doneResult && doneResult.failedExpectations) || [];
|
||||
var failed = stateBuilder.failureCount + globalFailures.length > 0;
|
||||
|
||||
if (totalSpecsDefined > 0 || failed) {
|
||||
statusBarMessage +=
|
||||
pluralize('spec', stateBuilder.specsExecuted) +
|
||||
', ' +
|
||||
pluralize('failure', stateBuilder.failureCount);
|
||||
if (stateBuilder.pendingSpecCount) {
|
||||
statusBarMessage +=
|
||||
', ' + pluralize('pending spec', stateBuilder.pendingSpecCount);
|
||||
}
|
||||
}
|
||||
|
||||
if (doneResult.overallStatus === 'passed') {
|
||||
statusBarClassName += ' jasmine-passed ';
|
||||
} else if (doneResult.overallStatus === 'incomplete') {
|
||||
statusBarClassName += ' jasmine-incomplete ';
|
||||
statusBarMessage =
|
||||
'Incomplete: ' +
|
||||
doneResult.incompleteReason +
|
||||
', ' +
|
||||
statusBarMessage;
|
||||
} else {
|
||||
statusBarClassName += ' jasmine-failed ';
|
||||
}
|
||||
|
||||
var seedBar;
|
||||
if (order && order.random) {
|
||||
seedBar = createDom(
|
||||
'span',
|
||||
{ className: 'jasmine-seed-bar' },
|
||||
', randomized with seed ',
|
||||
createDom(
|
||||
'a',
|
||||
{
|
||||
title: 'randomized with seed ' + order.seed,
|
||||
href: seedHref(order.seed)
|
||||
},
|
||||
order.seed
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
alert.appendChild(
|
||||
createDom(
|
||||
'span',
|
||||
{ className: statusBarClassName },
|
||||
statusBarMessage,
|
||||
seedBar
|
||||
)
|
||||
);
|
||||
|
||||
var errorBarClassName = 'jasmine-bar jasmine-errored';
|
||||
var afterAllMessagePrefix = 'AfterAll ';
|
||||
|
||||
for (i = 0; i < globalFailures.length; i++) {
|
||||
alert.appendChild(
|
||||
createDom(
|
||||
'span',
|
||||
{ className: errorBarClassName },
|
||||
globalFailureMessage(globalFailures[i])
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
function globalFailureMessage(failure) {
|
||||
if (failure.globalErrorType === 'load') {
|
||||
var prefix = 'Error during loading: ' + failure.message;
|
||||
|
||||
if (failure.filename) {
|
||||
return (
|
||||
prefix + ' in ' + failure.filename + ' line ' + failure.lineno
|
||||
);
|
||||
} else {
|
||||
return prefix;
|
||||
}
|
||||
} else {
|
||||
return afterAllMessagePrefix + failure.message;
|
||||
}
|
||||
}
|
||||
|
||||
addDeprecationWarnings(doneResult);
|
||||
|
||||
for (i = 0; i < deprecationWarnings.length; i++) {
|
||||
var context;
|
||||
|
||||
switch (deprecationWarnings[i].runnableType) {
|
||||
case 'spec':
|
||||
context = '(in spec: ' + deprecationWarnings[i].runnableName + ')';
|
||||
break;
|
||||
case 'suite':
|
||||
context = '(in suite: ' + deprecationWarnings[i].runnableName + ')';
|
||||
break;
|
||||
default:
|
||||
context = '';
|
||||
}
|
||||
|
||||
alert.appendChild(
|
||||
createDom(
|
||||
'span',
|
||||
{ className: 'jasmine-bar jasmine-warning' },
|
||||
'DEPRECATION: ' + deprecationWarnings[i].message,
|
||||
createDom('br'),
|
||||
context
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
var results = find('.jasmine-results');
|
||||
results.appendChild(summary);
|
||||
|
||||
summaryList(stateBuilder.topResults, summary);
|
||||
|
||||
if (failures.length) {
|
||||
alert.appendChild(
|
||||
createDom(
|
||||
'span',
|
||||
{ className: 'jasmine-menu jasmine-bar jasmine-spec-list' },
|
||||
createDom('span', {}, 'Spec List | '),
|
||||
createDom(
|
||||
'a',
|
||||
{ className: 'jasmine-failures-menu', href: '#' },
|
||||
'Failures'
|
||||
)
|
||||
)
|
||||
);
|
||||
alert.appendChild(
|
||||
createDom(
|
||||
'span',
|
||||
{ className: 'jasmine-menu jasmine-bar jasmine-failure-list' },
|
||||
createDom(
|
||||
'a',
|
||||
{ className: 'jasmine-spec-list-menu', href: '#' },
|
||||
'Spec List'
|
||||
),
|
||||
createDom('span', {}, ' | Failures ')
|
||||
)
|
||||
);
|
||||
|
||||
find('.jasmine-failures-menu').onclick = function() {
|
||||
setMenuModeTo('jasmine-failure-list');
|
||||
return false;
|
||||
};
|
||||
find('.jasmine-spec-list-menu').onclick = function() {
|
||||
setMenuModeTo('jasmine-spec-list');
|
||||
return false;
|
||||
};
|
||||
|
||||
setMenuModeTo('jasmine-failure-list');
|
||||
|
||||
var failureNode = find('.jasmine-failures');
|
||||
for (i = 0; i < failures.length; i++) {
|
||||
failureNode.appendChild(failures[i]);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
return this;
|
||||
|
||||
function failureDom(result) {
|
||||
var failure = createDom(
|
||||
'div',
|
||||
{ className: 'jasmine-spec-detail jasmine-failed' },
|
||||
failureDescription(result, stateBuilder.currentParent),
|
||||
createDom('div', { className: 'jasmine-messages' })
|
||||
);
|
||||
var messages = failure.childNodes[1];
|
||||
|
||||
for (var i = 0; i < result.failedExpectations.length; i++) {
|
||||
var expectation = result.failedExpectations[i];
|
||||
messages.appendChild(
|
||||
createDom(
|
||||
'div',
|
||||
{ className: 'jasmine-result-message' },
|
||||
expectation.message
|
||||
)
|
||||
);
|
||||
messages.appendChild(
|
||||
createDom(
|
||||
'div',
|
||||
{ className: 'jasmine-stack-trace' },
|
||||
expectation.stack
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
if (result.failedExpectations.length === 0) {
|
||||
messages.appendChild(
|
||||
createDom(
|
||||
'div',
|
||||
{ className: 'jasmine-result-message' },
|
||||
'Spec has no expectations'
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
return failure;
|
||||
}
|
||||
|
||||
function summaryList(resultsTree, domParent) {
|
||||
var specListNode;
|
||||
for (var i = 0; i < resultsTree.children.length; i++) {
|
||||
var resultNode = resultsTree.children[i];
|
||||
if (filterSpecs && !hasActiveSpec(resultNode)) {
|
||||
continue;
|
||||
}
|
||||
if (resultNode.type === 'suite') {
|
||||
var suiteListNode = createDom(
|
||||
'ul',
|
||||
{ className: 'jasmine-suite', id: 'suite-' + resultNode.result.id },
|
||||
createDom(
|
||||
'li',
|
||||
{
|
||||
className:
|
||||
'jasmine-suite-detail jasmine-' + resultNode.result.status
|
||||
},
|
||||
createDom(
|
||||
'a',
|
||||
{ href: specHref(resultNode.result) },
|
||||
resultNode.result.description
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
summaryList(resultNode, suiteListNode);
|
||||
domParent.appendChild(suiteListNode);
|
||||
}
|
||||
if (resultNode.type === 'spec') {
|
||||
if (domParent.getAttribute('class') !== 'jasmine-specs') {
|
||||
specListNode = createDom('ul', { className: 'jasmine-specs' });
|
||||
domParent.appendChild(specListNode);
|
||||
}
|
||||
var specDescription = resultNode.result.description;
|
||||
if (noExpectations(resultNode.result)) {
|
||||
specDescription = 'SPEC HAS NO EXPECTATIONS ' + specDescription;
|
||||
}
|
||||
if (
|
||||
resultNode.result.status === 'pending' &&
|
||||
resultNode.result.pendingReason !== ''
|
||||
) {
|
||||
specDescription =
|
||||
specDescription +
|
||||
' PENDING WITH MESSAGE: ' +
|
||||
resultNode.result.pendingReason;
|
||||
}
|
||||
specListNode.appendChild(
|
||||
createDom(
|
||||
'li',
|
||||
{
|
||||
className: 'jasmine-' + resultNode.result.status,
|
||||
id: 'spec-' + resultNode.result.id
|
||||
},
|
||||
createDom(
|
||||
'a',
|
||||
{ href: specHref(resultNode.result) },
|
||||
specDescription
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function optionsMenu(config) {
|
||||
var optionsMenuDom = createDom(
|
||||
'div',
|
||||
{ className: 'jasmine-run-options' },
|
||||
createDom('span', { className: 'jasmine-trigger' }, 'Options'),
|
||||
createDom(
|
||||
'div',
|
||||
{ className: 'jasmine-payload' },
|
||||
createDom(
|
||||
'div',
|
||||
{ className: 'jasmine-stop-on-failure' },
|
||||
createDom('input', {
|
||||
className: 'jasmine-fail-fast',
|
||||
id: 'jasmine-fail-fast',
|
||||
type: 'checkbox'
|
||||
}),
|
||||
createDom(
|
||||
'label',
|
||||
{ className: 'jasmine-label', for: 'jasmine-fail-fast' },
|
||||
'stop execution on spec failure'
|
||||
)
|
||||
),
|
||||
createDom(
|
||||
'div',
|
||||
{ className: 'jasmine-throw-failures' },
|
||||
createDom('input', {
|
||||
className: 'jasmine-throw',
|
||||
id: 'jasmine-throw-failures',
|
||||
type: 'checkbox'
|
||||
}),
|
||||
createDom(
|
||||
'label',
|
||||
{ className: 'jasmine-label', for: 'jasmine-throw-failures' },
|
||||
'stop spec on expectation failure'
|
||||
)
|
||||
),
|
||||
createDom(
|
||||
'div',
|
||||
{ className: 'jasmine-random-order' },
|
||||
createDom('input', {
|
||||
className: 'jasmine-random',
|
||||
id: 'jasmine-random-order',
|
||||
type: 'checkbox'
|
||||
}),
|
||||
createDom(
|
||||
'label',
|
||||
{ className: 'jasmine-label', for: 'jasmine-random-order' },
|
||||
'run tests in random order'
|
||||
)
|
||||
),
|
||||
createDom(
|
||||
'div',
|
||||
{ className: 'jasmine-hide-disabled' },
|
||||
createDom('input', {
|
||||
className: 'jasmine-disabled',
|
||||
id: 'jasmine-hide-disabled',
|
||||
type: 'checkbox'
|
||||
}),
|
||||
createDom(
|
||||
'label',
|
||||
{ className: 'jasmine-label', for: 'jasmine-hide-disabled' },
|
||||
'hide disabled tests'
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
var failFastCheckbox = optionsMenuDom.querySelector('#jasmine-fail-fast');
|
||||
failFastCheckbox.checked = config.failFast;
|
||||
failFastCheckbox.onclick = function() {
|
||||
navigateWithNewParam('failFast', !config.failFast);
|
||||
};
|
||||
|
||||
var throwCheckbox = optionsMenuDom.querySelector(
|
||||
'#jasmine-throw-failures'
|
||||
);
|
||||
throwCheckbox.checked = config.oneFailurePerSpec;
|
||||
throwCheckbox.onclick = function() {
|
||||
navigateWithNewParam('oneFailurePerSpec', !config.oneFailurePerSpec);
|
||||
};
|
||||
|
||||
var randomCheckbox = optionsMenuDom.querySelector(
|
||||
'#jasmine-random-order'
|
||||
);
|
||||
randomCheckbox.checked = config.random;
|
||||
randomCheckbox.onclick = function() {
|
||||
navigateWithNewParam('random', !config.random);
|
||||
};
|
||||
|
||||
var hideDisabled = optionsMenuDom.querySelector('#jasmine-hide-disabled');
|
||||
hideDisabled.checked = config.hideDisabled;
|
||||
hideDisabled.onclick = function() {
|
||||
navigateWithNewParam('hideDisabled', !config.hideDisabled);
|
||||
};
|
||||
|
||||
var optionsTrigger = optionsMenuDom.querySelector('.jasmine-trigger'),
|
||||
optionsPayload = optionsMenuDom.querySelector('.jasmine-payload'),
|
||||
isOpen = /\bjasmine-open\b/;
|
||||
|
||||
optionsTrigger.onclick = function() {
|
||||
if (isOpen.test(optionsPayload.className)) {
|
||||
optionsPayload.className = optionsPayload.className.replace(
|
||||
isOpen,
|
||||
''
|
||||
);
|
||||
} else {
|
||||
optionsPayload.className += ' jasmine-open';
|
||||
}
|
||||
};
|
||||
|
||||
return optionsMenuDom;
|
||||
}
|
||||
|
||||
function failureDescription(result, suite) {
|
||||
var wrapper = createDom(
|
||||
'div',
|
||||
{ className: 'jasmine-description' },
|
||||
createDom(
|
||||
'a',
|
||||
{ title: result.description, href: specHref(result) },
|
||||
result.description
|
||||
)
|
||||
);
|
||||
var suiteLink;
|
||||
|
||||
while (suite && suite.parent) {
|
||||
wrapper.insertBefore(createTextNode(' > '), wrapper.firstChild);
|
||||
suiteLink = createDom(
|
||||
'a',
|
||||
{ href: suiteHref(suite) },
|
||||
suite.result.description
|
||||
);
|
||||
wrapper.insertBefore(suiteLink, wrapper.firstChild);
|
||||
|
||||
suite = suite.parent;
|
||||
}
|
||||
|
||||
return wrapper;
|
||||
}
|
||||
|
||||
function suiteHref(suite) {
|
||||
var els = [];
|
||||
|
||||
while (suite && suite.parent) {
|
||||
els.unshift(suite.result.description);
|
||||
suite = suite.parent;
|
||||
}
|
||||
|
||||
// include window.location.pathname to fix issue with karma-jasmine-html-reporter in angular: see https://github.com/jasmine/jasmine/issues/1906
|
||||
return (
|
||||
(window.location.pathname || '') +
|
||||
addToExistingQueryString('spec', els.join(' '))
|
||||
);
|
||||
}
|
||||
|
||||
function addDeprecationWarnings(result, runnableType) {
|
||||
if (result && result.deprecationWarnings) {
|
||||
for (var i = 0; i < result.deprecationWarnings.length; i++) {
|
||||
var warning = result.deprecationWarnings[i].message;
|
||||
if (!j$.util.arrayContains(warning)) {
|
||||
deprecationWarnings.push({
|
||||
message: warning,
|
||||
runnableName: result.fullName,
|
||||
runnableType: runnableType
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function find(selector) {
|
||||
return getContainer().querySelector('.jasmine_html-reporter ' + selector);
|
||||
}
|
||||
|
||||
function clearPrior() {
|
||||
// return the reporter
|
||||
var oldReporter = find('');
|
||||
|
||||
if (oldReporter) {
|
||||
getContainer().removeChild(oldReporter);
|
||||
}
|
||||
}
|
||||
|
||||
function createDom(type, attrs, childrenVarArgs) {
|
||||
var el = createElement(type);
|
||||
|
||||
for (var i = 2; i < arguments.length; i++) {
|
||||
var child = arguments[i];
|
||||
|
||||
if (typeof child === 'string') {
|
||||
el.appendChild(createTextNode(child));
|
||||
} else {
|
||||
if (child) {
|
||||
el.appendChild(child);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (var attr in attrs) {
|
||||
if (attr == 'className') {
|
||||
el[attr] = attrs[attr];
|
||||
} else {
|
||||
el.setAttribute(attr, attrs[attr]);
|
||||
}
|
||||
}
|
||||
|
||||
return el;
|
||||
}
|
||||
|
||||
function pluralize(singular, count) {
|
||||
var word = count == 1 ? singular : singular + 's';
|
||||
|
||||
return '' + count + ' ' + word;
|
||||
}
|
||||
|
||||
function specHref(result) {
|
||||
// include window.location.pathname to fix issue with karma-jasmine-html-reporter in angular: see https://github.com/jasmine/jasmine/issues/1906
|
||||
return (
|
||||
(window.location.pathname || '') +
|
||||
addToExistingQueryString('spec', result.fullName)
|
||||
);
|
||||
}
|
||||
|
||||
function seedHref(seed) {
|
||||
// include window.location.pathname to fix issue with karma-jasmine-html-reporter in angular: see https://github.com/jasmine/jasmine/issues/1906
|
||||
return (
|
||||
(window.location.pathname || '') +
|
||||
addToExistingQueryString('seed', seed)
|
||||
);
|
||||
}
|
||||
|
||||
function defaultQueryString(key, value) {
|
||||
return '?' + key + '=' + value;
|
||||
}
|
||||
|
||||
function setMenuModeTo(mode) {
|
||||
htmlReporterMain.setAttribute('class', 'jasmine_html-reporter ' + mode);
|
||||
}
|
||||
|
||||
function noExpectations(result) {
|
||||
var allExpectations =
|
||||
result.failedExpectations.length + result.passedExpectations.length;
|
||||
|
||||
return (
|
||||
allExpectations === 0 &&
|
||||
(result.status === 'passed' || result.status === 'failed')
|
||||
);
|
||||
}
|
||||
|
||||
function hasActiveSpec(resultNode) {
|
||||
if (resultNode.type == 'spec' && resultNode.result.status != 'excluded') {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (resultNode.type == 'suite') {
|
||||
for (var i = 0, j = resultNode.children.length; i < j; i++) {
|
||||
if (hasActiveSpec(resultNode.children[i])) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return HtmlReporter;
|
||||
};
|
||||
|
||||
jasmineRequire.HtmlSpecFilter = function() {
|
||||
function HtmlSpecFilter(options) {
|
||||
var filterString =
|
||||
options &&
|
||||
options.filterString() &&
|
||||
options.filterString().replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&');
|
||||
var filterPattern = new RegExp(filterString);
|
||||
|
||||
this.matches = function(specName) {
|
||||
return filterPattern.test(specName);
|
||||
};
|
||||
}
|
||||
|
||||
return HtmlSpecFilter;
|
||||
};
|
||||
|
||||
jasmineRequire.ResultsNode = function() {
|
||||
function ResultsNode(result, type, parent) {
|
||||
this.result = result;
|
||||
this.type = type;
|
||||
this.parent = parent;
|
||||
|
||||
this.children = [];
|
||||
|
||||
this.addChild = function(result, type) {
|
||||
this.children.push(new ResultsNode(result, type, this));
|
||||
};
|
||||
|
||||
this.last = function() {
|
||||
return this.children[this.children.length - 1];
|
||||
};
|
||||
|
||||
this.updateResult = function(result) {
|
||||
this.result = result;
|
||||
};
|
||||
}
|
||||
|
||||
return ResultsNode;
|
||||
};
|
||||
|
||||
jasmineRequire.QueryString = function() {
|
||||
function QueryString(options) {
|
||||
this.navigateWithNewParam = function(key, value) {
|
||||
options.getWindowLocation().search = this.fullStringWithNewParam(
|
||||
key,
|
||||
value
|
||||
);
|
||||
};
|
||||
|
||||
this.fullStringWithNewParam = function(key, value) {
|
||||
var paramMap = queryStringToParamMap();
|
||||
paramMap[key] = value;
|
||||
return toQueryString(paramMap);
|
||||
};
|
||||
|
||||
this.getParam = function(key) {
|
||||
return queryStringToParamMap()[key];
|
||||
};
|
||||
|
||||
return this;
|
||||
|
||||
function toQueryString(paramMap) {
|
||||
var qStrPairs = [];
|
||||
for (var prop in paramMap) {
|
||||
qStrPairs.push(
|
||||
encodeURIComponent(prop) + '=' + encodeURIComponent(paramMap[prop])
|
||||
);
|
||||
}
|
||||
return '?' + qStrPairs.join('&');
|
||||
}
|
||||
|
||||
function queryStringToParamMap() {
|
||||
var paramStr = options.getWindowLocation().search.substring(1),
|
||||
params = [],
|
||||
paramMap = {};
|
||||
|
||||
if (paramStr.length > 0) {
|
||||
params = paramStr.split('&');
|
||||
for (var i = 0; i < params.length; i++) {
|
||||
var p = params[i].split('=');
|
||||
var value = decodeURIComponent(p[1]);
|
||||
if (value === 'true' || value === 'false') {
|
||||
value = JSON.parse(value);
|
||||
}
|
||||
paramMap[decodeURIComponent(p[0])] = value;
|
||||
}
|
||||
}
|
||||
|
||||
return paramMap;
|
||||
}
|
||||
}
|
||||
|
||||
return QueryString;
|
||||
};
|
||||
271
Pcb-1-lan9252/EEPROM_generator/lib/jasmine-3.8.0/jasmine.css
Normal file
271
Pcb-1-lan9252/EEPROM_generator/lib/jasmine-3.8.0/jasmine.css
Normal file
File diff suppressed because one or more lines are too long
9761
Pcb-1-lan9252/EEPROM_generator/lib/jasmine-3.8.0/jasmine.js
Normal file
9761
Pcb-1-lan9252/EEPROM_generator/lib/jasmine-3.8.0/jasmine.js
Normal file
File diff suppressed because it is too large
Load Diff
Binary file not shown.
|
After Width: | Height: | Size: 1.5 KiB |
13
Pcb-1-lan9252/EEPROM_generator/lib/jszip.min.js
vendored
Normal file
13
Pcb-1-lan9252/EEPROM_generator/lib/jszip.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
282
Pcb-1-lan9252/EEPROM_generator/ref/gen.xml
Normal file
282
Pcb-1-lan9252/EEPROM_generator/ref/gen.xml
Normal file
@@ -0,0 +1,282 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<EtherCATInfo>
|
||||
<Vendor>
|
||||
<Id>0</Id>
|
||||
<Name LcId="1033">ACME EtherCAT Devices</Name>
|
||||
</Vendor>
|
||||
<Descriptions>
|
||||
<Groups>
|
||||
<Group>
|
||||
<Type>DigIn</Type>
|
||||
<Name LcId="1033">Digital input</Name>
|
||||
</Group>
|
||||
</Groups>
|
||||
<Devices>
|
||||
<Device Physics="YY ">
|
||||
<Type ProductCode="#xab123" RevisionNo="#x2">DigIn2000</Type>
|
||||
<Name LcId="1033">2-channel Hypergalactic input superimpermanator</Name>
|
||||
<GroupType>DigIn</GroupType>
|
||||
<Profile>
|
||||
<ProfileNo>5001</ProfileNo>
|
||||
<AddInfo>0</AddInfo>
|
||||
<Dictionary>
|
||||
<DataTypes>
|
||||
<DataType>
|
||||
<Name>DT1018</Name>
|
||||
<BitSize>144</BitSize>
|
||||
<SubItem>
|
||||
<SubIdx>0</SubIdx>
|
||||
<Name>Max SubIndex</Name>
|
||||
<Type>USINT</Type>
|
||||
<BitSize>8</BitSize>
|
||||
<BitOffs>0</BitOffs>
|
||||
<Flags>
|
||||
<Access>ro</Access>
|
||||
</Flags>
|
||||
</SubItem>
|
||||
<SubItem>
|
||||
<SubIdx>1</SubIdx>
|
||||
<Name>Vendor ID</Name>
|
||||
<Type>UDINT</Type>
|
||||
<BitSize>32</BitSize>
|
||||
<BitOffs>16</BitOffs>
|
||||
<Flags>
|
||||
<Access>ro</Access>
|
||||
</Flags>
|
||||
</SubItem>
|
||||
<SubItem>
|
||||
<SubIdx>2</SubIdx>
|
||||
<Name>Product Code</Name>
|
||||
<Type>UDINT</Type>
|
||||
<BitSize>32</BitSize>
|
||||
<BitOffs>48</BitOffs>
|
||||
<Flags>
|
||||
<Access>ro</Access>
|
||||
</Flags>
|
||||
</SubItem>
|
||||
<SubItem>
|
||||
<SubIdx>3</SubIdx>
|
||||
<Name>Revision Number</Name>
|
||||
<Type>UDINT</Type>
|
||||
<BitSize>32</BitSize>
|
||||
<BitOffs>80</BitOffs>
|
||||
<Flags>
|
||||
<Access>ro</Access>
|
||||
</Flags>
|
||||
</SubItem>
|
||||
<SubItem>
|
||||
<SubIdx>4</SubIdx>
|
||||
<Name>Serial Number</Name>
|
||||
<Type>UDINT</Type>
|
||||
<BitSize>32</BitSize>
|
||||
<BitOffs>112</BitOffs>
|
||||
<Flags>
|
||||
<Access>ro</Access>
|
||||
</Flags>
|
||||
</SubItem>
|
||||
</DataType>
|
||||
<DataType>
|
||||
<Name>DT1C00ARR</Name>
|
||||
<BaseType>USINT</BaseType>
|
||||
<BitSize>32</BitSize>
|
||||
<ArrayInfo>
|
||||
<LBound>1</LBound>
|
||||
<Elements>4</Elements>
|
||||
</ArrayInfo>
|
||||
</DataType>
|
||||
<DataType>
|
||||
<Name>DT1C00</Name>
|
||||
<BitSize>48</BitSize>
|
||||
<SubItem>
|
||||
<SubIdx>0</SubIdx>
|
||||
<Name>Max SubIndex</Name>
|
||||
<Type>USINT</Type>
|
||||
<BitSize>8</BitSize>
|
||||
<BitOffs>0</BitOffs>
|
||||
<Flags>
|
||||
<Access>ro</Access>
|
||||
</Flags>
|
||||
</SubItem>
|
||||
<SubItem>
|
||||
<Name>Elements</Name>
|
||||
<Type>DT1C00ARR</Type>
|
||||
<BitSize>32</BitSize>
|
||||
<BitOffs>16</BitOffs>
|
||||
<Flags>
|
||||
<Access>ro</Access>
|
||||
</Flags>
|
||||
</SubItem>
|
||||
</DataType>
|
||||
<DataType>
|
||||
<Name>UDINT</Name>
|
||||
<BitSize>32</BitSize>
|
||||
</DataType>
|
||||
<DataType>
|
||||
<Name>STRING(47)</Name>
|
||||
<BitSize>376</BitSize>
|
||||
</DataType>
|
||||
<DataType>
|
||||
<Name>STRING(5)</Name>
|
||||
<BitSize>40</BitSize>
|
||||
</DataType>
|
||||
<DataType>
|
||||
<Name>USINT</Name>
|
||||
<BitSize>8</BitSize>
|
||||
</DataType>
|
||||
</DataTypes>
|
||||
<Objects>
|
||||
<Object>
|
||||
<Index>#x1000</Index>
|
||||
<Name>Device Type</Name>
|
||||
<Type>UDINT</Type>
|
||||
<BitSize>32</BitSize>
|
||||
<Info>
|
||||
<DefaultValue>5001</DefaultValue>
|
||||
</Info>
|
||||
<Flags>
|
||||
<Access>ro</Access>
|
||||
<Category>m</Category>
|
||||
</Flags>
|
||||
</Object>
|
||||
<Object>
|
||||
<Index>#x1008</Index>
|
||||
<Name>Device Name</Name>
|
||||
<Type>STRING(47)</Type>
|
||||
<BitSize>376</BitSize>
|
||||
<Info>
|
||||
<DefaultString>2-channel Hypergalactic input superimpermanator</DefaultString>
|
||||
</Info>
|
||||
<Flags>
|
||||
<Access>ro</Access>
|
||||
</Flags>
|
||||
</Object>
|
||||
<Object>
|
||||
<Index>#x1009</Index>
|
||||
<Name>Hardware Version</Name>
|
||||
<Type>STRING(5)</Type>
|
||||
<BitSize>40</BitSize>
|
||||
<Info>
|
||||
<DefaultString>0.0.1</DefaultString>
|
||||
</Info>
|
||||
<Flags>
|
||||
<Access>ro</Access>
|
||||
<Category>o</Category>
|
||||
</Flags>
|
||||
</Object>
|
||||
<Object>
|
||||
<Index>#x100A</Index>
|
||||
<Name>Software Version</Name>
|
||||
<Type>STRING(5)</Type>
|
||||
<BitSize>40</BitSize>
|
||||
<Info>
|
||||
<DefaultString>0.0.1</DefaultString>
|
||||
</Info>
|
||||
<Flags>
|
||||
<Access>ro</Access>
|
||||
</Flags>
|
||||
</Object>
|
||||
<Object>
|
||||
<Index>#x1018</Index>
|
||||
<Name>Identity Object</Name>
|
||||
<Type>DT1018</Type>
|
||||
<BitSize>144</BitSize>
|
||||
<Info>
|
||||
<SubItem>
|
||||
<Name>Max SubIndex</Name>
|
||||
<Info>
|
||||
<DefaultValue>4</DefaultValue>
|
||||
</Info>
|
||||
</SubItem>
|
||||
<SubItem>
|
||||
<Name>Vendor ID</Name>
|
||||
<Info>
|
||||
<DefaultValue>0</DefaultValue>
|
||||
</Info>
|
||||
</SubItem>
|
||||
<SubItem>
|
||||
<Name>Product Code</Name>
|
||||
<Info>
|
||||
<DefaultValue>700707</DefaultValue>
|
||||
</Info>
|
||||
</SubItem>
|
||||
<SubItem>
|
||||
<Name>Revision Number</Name>
|
||||
<Info>
|
||||
<DefaultValue>2</DefaultValue>
|
||||
</Info>
|
||||
</SubItem>
|
||||
<SubItem>
|
||||
<Name>Serial Number</Name>
|
||||
<Info>
|
||||
<DefaultValue>1</DefaultValue>
|
||||
</Info>
|
||||
</SubItem>
|
||||
</Info>
|
||||
<Flags>
|
||||
<Access>ro</Access>
|
||||
</Flags>
|
||||
</Object>
|
||||
<Object>
|
||||
<Index>#x1C00</Index>
|
||||
<Name>Sync Manager Communication Type</Name>
|
||||
<Type>DT1C00</Type>
|
||||
<BitSize>48</BitSize>
|
||||
<Info>
|
||||
<SubItem>
|
||||
<Name>Max SubIndex</Name>
|
||||
<Info>
|
||||
<DefaultValue>4</DefaultValue>
|
||||
</Info>
|
||||
</SubItem>
|
||||
<SubItem>
|
||||
<Name>Communications Type SM0</Name>
|
||||
<Info>
|
||||
<DefaultValue>1</DefaultValue>
|
||||
</Info>
|
||||
</SubItem>
|
||||
<SubItem>
|
||||
<Name>Communications Type SM1</Name>
|
||||
<Info>
|
||||
<DefaultValue>2</DefaultValue>
|
||||
</Info>
|
||||
</SubItem>
|
||||
<SubItem>
|
||||
<Name>Communications Type SM2</Name>
|
||||
<Info>
|
||||
<DefaultValue>3</DefaultValue>
|
||||
</Info>
|
||||
</SubItem>
|
||||
<SubItem>
|
||||
<Name>Communications Type SM3</Name>
|
||||
<Info>
|
||||
<DefaultValue>4</DefaultValue>
|
||||
</Info>
|
||||
</SubItem>
|
||||
</Info>
|
||||
<Flags>
|
||||
<Access>ro</Access>
|
||||
</Flags>
|
||||
</Object>
|
||||
</Objects>
|
||||
</Dictionary>
|
||||
</Profile>
|
||||
<Fmmu>Outputs</Fmmu>
|
||||
<Fmmu>Inputs</Fmmu>
|
||||
<Fmmu>MBoxState</Fmmu>
|
||||
<Sm DefaultSize="512" StartAddress="#x1000" ControlByte="#x26" Enable="1">MBoxOut</Sm>
|
||||
<Sm DefaultSize="512" StartAddress="#x1200" ControlByte="#x22" Enable="1">MBoxIn</Sm>
|
||||
<Sm StartAddress="#x1600" ControlByte="#x24" Enable="0">Outputs</Sm>
|
||||
<Sm StartAddress="#x1A00" ControlByte="#x20" Enable="0">Inputs</Sm>
|
||||
<Mailbox DataLinkLayer="true">
|
||||
<CoE SdoInfo="true" PdoAssign="true" PdoConfig="true" PdoUpload="true" CompleteAccess="true" />
|
||||
</Mailbox>
|
||||
<Dc>
|
||||
</Dc>
|
||||
<Eeprom>
|
||||
<ByteSize>2048</ByteSize>
|
||||
<ConfigData>05060344640000</ConfigData>
|
||||
</Eeprom>
|
||||
</Device>
|
||||
</Devices>
|
||||
</Descriptions>
|
||||
</EtherCATInfo>
|
||||
281
Pcb-1-lan9252/EEPROM_generator/ref/start.xml
Normal file
281
Pcb-1-lan9252/EEPROM_generator/ref/start.xml
Normal file
@@ -0,0 +1,281 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<EtherCATInfo>
|
||||
<Vendor>
|
||||
<Id>600</Id>
|
||||
<Name LcId="1033">oss</Name>
|
||||
</Vendor>
|
||||
<Descriptions>
|
||||
<Groups>
|
||||
<Group>
|
||||
<Type>groupType</Type>
|
||||
<Name LcId="1033">groupName</Name>
|
||||
</Group>
|
||||
</Groups>
|
||||
<Devices>
|
||||
<Device Physics="YY">
|
||||
<Type ProductCode="0" RevisionNo="0">codegentool</Type>
|
||||
<Name LcId="1033">slave</Name>
|
||||
<GroupType>groupType</GroupType>
|
||||
<Profile>
|
||||
<ProfileNo>5001</ProfileNo>
|
||||
<AddInfo>0</AddInfo>
|
||||
<Dictionary>
|
||||
<DataTypes>
|
||||
<DataType>
|
||||
<Name>DT1018</Name>
|
||||
<BitSize>144</BitSize>
|
||||
<SubItem>
|
||||
<SubIdx>0</SubIdx>
|
||||
<Name>Max SubIndex</Name>
|
||||
<Type>USINT</Type>
|
||||
<BitSize>8</BitSize>
|
||||
<BitOffs>0</BitOffs>
|
||||
<Flags>
|
||||
<Access>ro</Access>
|
||||
</Flags>
|
||||
</SubItem>
|
||||
<SubItem>
|
||||
<SubIdx>1</SubIdx>
|
||||
<Name>Vendor ID</Name>
|
||||
<Type>UDINT</Type>
|
||||
<BitSize>32</BitSize>
|
||||
<BitOffs>16</BitOffs>
|
||||
<Flags>
|
||||
<Access>ro</Access>
|
||||
</Flags>
|
||||
</SubItem>
|
||||
<SubItem>
|
||||
<SubIdx>2</SubIdx>
|
||||
<Name>Product Code</Name>
|
||||
<Type>UDINT</Type>
|
||||
<BitSize>32</BitSize>
|
||||
<BitOffs>48</BitOffs>
|
||||
<Flags>
|
||||
<Access>ro</Access>
|
||||
</Flags>
|
||||
</SubItem>
|
||||
<SubItem>
|
||||
<SubIdx>3</SubIdx>
|
||||
<Name>Revision Number</Name>
|
||||
<Type>UDINT</Type>
|
||||
<BitSize>32</BitSize>
|
||||
<BitOffs>80</BitOffs>
|
||||
<Flags>
|
||||
<Access>ro</Access>
|
||||
</Flags>
|
||||
</SubItem>
|
||||
<SubItem>
|
||||
<SubIdx>4</SubIdx>
|
||||
<Name>Serial Number</Name>
|
||||
<Type>UDINT</Type>
|
||||
<BitSize>32</BitSize>
|
||||
<BitOffs>112</BitOffs>
|
||||
<Flags>
|
||||
<Access>ro</Access>
|
||||
</Flags>
|
||||
</SubItem>
|
||||
</DataType>
|
||||
<DataType>
|
||||
<Name>DT1C00ARR</Name>
|
||||
<BaseType>USINT</BaseType>
|
||||
<BitSize>32</BitSize>
|
||||
<ArrayInfo>
|
||||
<LBound>1</LBound>
|
||||
<Elements>4</Elements>
|
||||
</ArrayInfo>
|
||||
</DataType>
|
||||
<DataType>
|
||||
<Name>DT1C00</Name>
|
||||
<BitSize>48</BitSize>
|
||||
<SubItem>
|
||||
<SubIdx>0</SubIdx>
|
||||
<Name>Max SubIndex</Name>
|
||||
<Type>USINT</Type>
|
||||
<BitSize>8</BitSize>
|
||||
<BitOffs>0</BitOffs>
|
||||
<Flags>
|
||||
<Access>ro</Access>
|
||||
</Flags>
|
||||
</SubItem>
|
||||
<SubItem>
|
||||
<Name>Elements</Name>
|
||||
<Type>DT1C00ARR</Type>
|
||||
<BitSize>32</BitSize>
|
||||
<BitOffs>16</BitOffs>
|
||||
<Flags>
|
||||
<Access>ro</Access>
|
||||
</Flags>
|
||||
</SubItem>
|
||||
</DataType>
|
||||
<DataType>
|
||||
<Name>STRING(3)</Name>
|
||||
<BitSize>24</BitSize>
|
||||
</DataType>
|
||||
<DataType>
|
||||
<Name>STRING(11)</Name>
|
||||
<BitSize>88</BitSize>
|
||||
</DataType>
|
||||
<DataType>
|
||||
<Name>UDINT</Name>
|
||||
<BitSize>32</BitSize>
|
||||
</DataType>
|
||||
<DataType>
|
||||
<Name>USINT</Name>
|
||||
<BitSize>8</BitSize>
|
||||
</DataType>
|
||||
</DataTypes>
|
||||
<Objects>
|
||||
<Object>
|
||||
<Index>#x1000</Index>
|
||||
<Name>Device Type</Name>
|
||||
<Type>UDINT</Type>
|
||||
<BitSize>32</BitSize>
|
||||
<Info>
|
||||
<DefaultValue>#x00001389</DefaultValue>
|
||||
</Info>
|
||||
<Flags>
|
||||
<Access>ro</Access>
|
||||
<Category>m</Category>
|
||||
</Flags>
|
||||
</Object>
|
||||
<Object>
|
||||
<Index>#x1008</Index>
|
||||
<Name>Device Name</Name>
|
||||
<Type>STRING(11)</Type>
|
||||
<BitSize>88</BitSize>
|
||||
<Info>
|
||||
<DefaultString>codegentool</DefaultString>
|
||||
</Info>
|
||||
<Flags>
|
||||
<Access>ro</Access>
|
||||
</Flags>
|
||||
</Object>
|
||||
<Object>
|
||||
<Index>#x1009</Index>
|
||||
<Name>Hardware Version</Name>
|
||||
<Type>STRING(3)</Type>
|
||||
<BitSize>24</BitSize>
|
||||
<Info>
|
||||
<DefaultString>1.0</DefaultString>
|
||||
</Info>
|
||||
<Flags>
|
||||
<Access>ro</Access>
|
||||
<Category>o</Category>
|
||||
</Flags>
|
||||
</Object>
|
||||
<Object>
|
||||
<Index>#x100A</Index>
|
||||
<Name>Software Version</Name>
|
||||
<Type>STRING(3)</Type>
|
||||
<BitSize>24</BitSize>
|
||||
<Info>
|
||||
<DefaultString>1.0</DefaultString>
|
||||
</Info>
|
||||
<Flags>
|
||||
<Access>ro</Access>
|
||||
</Flags>
|
||||
</Object>
|
||||
<Object>
|
||||
<Index>#x1018</Index>
|
||||
<Name>Identity Object</Name>
|
||||
<Type>DT1018</Type>
|
||||
<BitSize>144</BitSize>
|
||||
<Info>
|
||||
<SubItem>
|
||||
<Name>Max SubIndex</Name>
|
||||
<Info>
|
||||
<DefaultValue>4</DefaultValue>
|
||||
</Info>
|
||||
</SubItem>
|
||||
<SubItem>
|
||||
<Name>Vendor ID</Name>
|
||||
<Info>
|
||||
<DefaultValue>600</DefaultValue>
|
||||
</Info>
|
||||
</SubItem>
|
||||
<SubItem>
|
||||
<Name>Product Code</Name>
|
||||
<Info>
|
||||
<DefaultValue>0</DefaultValue>
|
||||
</Info>
|
||||
</SubItem>
|
||||
<SubItem>
|
||||
<Name>Revision Number</Name>
|
||||
<Info>
|
||||
<DefaultValue>0</DefaultValue>
|
||||
</Info>
|
||||
</SubItem>
|
||||
<SubItem>
|
||||
<Name>Serial Number</Name>
|
||||
<Info>
|
||||
<DefaultValue>#x00000000</DefaultValue>
|
||||
</Info>
|
||||
</SubItem>
|
||||
</Info>
|
||||
<Flags>
|
||||
<Access>ro</Access>
|
||||
</Flags>
|
||||
</Object>
|
||||
<Object>
|
||||
<Index>#x1C00</Index>
|
||||
<Name>Sync Manager Communication Type</Name>
|
||||
<Type>DT1C00</Type>
|
||||
<BitSize>48</BitSize>
|
||||
<Info>
|
||||
<SubItem>
|
||||
<Name>Max SubIndex</Name>
|
||||
<Info>
|
||||
<DefaultValue>4</DefaultValue>
|
||||
</Info>
|
||||
</SubItem>
|
||||
<SubItem>
|
||||
<Name>Communications Type SM0</Name>
|
||||
<Info>
|
||||
<DefaultValue>1</DefaultValue>
|
||||
</Info>
|
||||
</SubItem>
|
||||
<SubItem>
|
||||
<Name>Communications Type SM1</Name>
|
||||
<Info>
|
||||
<DefaultValue>2</DefaultValue>
|
||||
</Info>
|
||||
</SubItem>
|
||||
<SubItem>
|
||||
<Name>Communications Type SM2</Name>
|
||||
<Info>
|
||||
<DefaultValue>3</DefaultValue>
|
||||
</Info>
|
||||
</SubItem>
|
||||
<SubItem>
|
||||
<Name>Communications Type SM3</Name>
|
||||
<Info>
|
||||
<DefaultValue>4</DefaultValue>
|
||||
</Info>
|
||||
</SubItem>
|
||||
</Info>
|
||||
<Flags>
|
||||
<Access>ro</Access>
|
||||
</Flags>
|
||||
</Object>
|
||||
</Objects>
|
||||
</Dictionary>
|
||||
</Profile>
|
||||
<Fmmu>Outputs</Fmmu>
|
||||
<Fmmu>Inputs</Fmmu>
|
||||
<Fmmu>MBoxState</Fmmu>
|
||||
<Sm ControlByte="#x26" DefaultSize="512" Enable="1" StartAddress="#x1000">MBoxOut</Sm>
|
||||
<Sm ControlByte="#x22" DefaultSize="512" Enable="1" StartAddress="#x1200">MBoxIn</Sm>
|
||||
<Sm ControlByte="#x24" Enable="0" StartAddress="#x1400">Outputs</Sm>
|
||||
<Sm ControlByte="#x20" Enable="0" StartAddress="#x1A00">Inputs</Sm>
|
||||
<Mailbox DataLinkLayer="true">
|
||||
<CoE CompleteAccess="false" PdoUpload="false" SdoInfo="true"/>
|
||||
</Mailbox>
|
||||
<Eeprom>
|
||||
<ByteSize>256</ByteSize>
|
||||
<ConfigData>0502030000000000</ConfigData>
|
||||
<BootStrap>0010000200120002</BootStrap>
|
||||
</Eeprom>
|
||||
</Device>
|
||||
</Devices>
|
||||
</Descriptions>
|
||||
</EtherCATInfo>
|
||||
14
Pcb-1-lan9252/EEPROM_generator/spec/backupSpec.js
Normal file
14
Pcb-1-lan9252/EEPROM_generator/spec/backupSpec.js
Normal file
@@ -0,0 +1,14 @@
|
||||
describe("backup", function() {
|
||||
|
||||
beforeEach(function() {
|
||||
});
|
||||
|
||||
it("should return false for button control", function() {
|
||||
// arrange
|
||||
const control = { type: 'button' };
|
||||
// act
|
||||
var result = isBackedUp(control);
|
||||
// assert
|
||||
expect(result).toEqual(false);
|
||||
});
|
||||
});
|
||||
593
Pcb-1-lan9252/EEPROM_generator/spec/generatorsSpec.js
Normal file
593
Pcb-1-lan9252/EEPROM_generator/spec/generatorsSpec.js
Normal file
@@ -0,0 +1,593 @@
|
||||
describe("generators", function() {
|
||||
|
||||
|
||||
describe("for default, empty project", function() {
|
||||
var form;
|
||||
var od;
|
||||
var indexes;
|
||||
|
||||
beforeEach(function() {
|
||||
form = buildMockFormHelper();
|
||||
od = buildObjectDictionary(form);
|
||||
indexes = getUsedIndexes(od);
|
||||
});
|
||||
|
||||
it("esi_generator should generate expected code", function() {
|
||||
// arrange
|
||||
const dc = [];
|
||||
// act
|
||||
var result = esi_generator(form, od, indexes, dc);
|
||||
|
||||
// assert
|
||||
const expectedesi =
|
||||
`<?xml version="1.0" encoding="UTF-8"?>
|
||||
<EtherCATInfo>
|
||||
<Vendor>
|
||||
<Id>0</Id>
|
||||
<Name LcId="1033">ACME EtherCAT Devices</Name>
|
||||
</Vendor>
|
||||
<Descriptions>
|
||||
<Groups>
|
||||
<Group>
|
||||
<Type>DigIn</Type>
|
||||
<Name LcId="1033">Digital input</Name>
|
||||
</Group>
|
||||
</Groups>
|
||||
<Devices>
|
||||
<Device Physics="YY ">
|
||||
<Type ProductCode="#xab123" RevisionNo="#x2">DigIn2000</Type>
|
||||
<Name LcId="1033">2-channel Hypergalactic input superimpermanator</Name>
|
||||
<GroupType>DigIn</GroupType>
|
||||
<Profile>
|
||||
<ProfileNo>5001</ProfileNo>
|
||||
<AddInfo>0</AddInfo>
|
||||
<Dictionary>
|
||||
<DataTypes>
|
||||
<DataType>
|
||||
<Name>DT1018</Name>
|
||||
<BitSize>144</BitSize>
|
||||
<SubItem>
|
||||
<SubIdx>0</SubIdx>
|
||||
<Name>Max SubIndex</Name>
|
||||
<Type>USINT</Type>
|
||||
<BitSize>8</BitSize>
|
||||
<BitOffs>0</BitOffs>
|
||||
<Flags>
|
||||
<Access>ro</Access>
|
||||
</Flags>
|
||||
</SubItem>
|
||||
<SubItem>
|
||||
<SubIdx>1</SubIdx>
|
||||
<Name>Vendor ID</Name>
|
||||
<Type>UDINT</Type>
|
||||
<BitSize>32</BitSize>
|
||||
<BitOffs>16</BitOffs>
|
||||
<Flags>
|
||||
<Access>ro</Access>
|
||||
</Flags>
|
||||
</SubItem>
|
||||
<SubItem>
|
||||
<SubIdx>2</SubIdx>
|
||||
<Name>Product Code</Name>
|
||||
<Type>UDINT</Type>
|
||||
<BitSize>32</BitSize>
|
||||
<BitOffs>48</BitOffs>
|
||||
<Flags>
|
||||
<Access>ro</Access>
|
||||
</Flags>
|
||||
</SubItem>
|
||||
<SubItem>
|
||||
<SubIdx>3</SubIdx>
|
||||
<Name>Revision Number</Name>
|
||||
<Type>UDINT</Type>
|
||||
<BitSize>32</BitSize>
|
||||
<BitOffs>80</BitOffs>
|
||||
<Flags>
|
||||
<Access>ro</Access>
|
||||
</Flags>
|
||||
</SubItem>
|
||||
<SubItem>
|
||||
<SubIdx>4</SubIdx>
|
||||
<Name>Serial Number</Name>
|
||||
<Type>UDINT</Type>
|
||||
<BitSize>32</BitSize>
|
||||
<BitOffs>112</BitOffs>
|
||||
<Flags>
|
||||
<Access>ro</Access>
|
||||
</Flags>
|
||||
</SubItem>
|
||||
</DataType>
|
||||
<DataType>
|
||||
<Name>DT1C00ARR</Name>
|
||||
<BaseType>USINT</BaseType>
|
||||
<BitSize>32</BitSize>
|
||||
<ArrayInfo>
|
||||
<LBound>1</LBound>
|
||||
<Elements>4</Elements>
|
||||
</ArrayInfo>
|
||||
</DataType>
|
||||
<DataType>
|
||||
<Name>DT1C00</Name>
|
||||
<BitSize>48</BitSize>
|
||||
<SubItem>
|
||||
<SubIdx>0</SubIdx>
|
||||
<Name>Max SubIndex</Name>
|
||||
<Type>USINT</Type>
|
||||
<BitSize>8</BitSize>
|
||||
<BitOffs>0</BitOffs>
|
||||
<Flags>
|
||||
<Access>ro</Access>
|
||||
</Flags>
|
||||
</SubItem>
|
||||
<SubItem>
|
||||
<Name>Elements</Name>
|
||||
<Type>DT1C00ARR</Type>
|
||||
<BitSize>32</BitSize>
|
||||
<BitOffs>16</BitOffs>
|
||||
<Flags>
|
||||
<Access>ro</Access>
|
||||
</Flags>
|
||||
</SubItem>
|
||||
</DataType>
|
||||
<DataType>
|
||||
<Name>UDINT</Name>
|
||||
<BitSize>32</BitSize>
|
||||
</DataType>
|
||||
<DataType>
|
||||
<Name>STRING(47)</Name>
|
||||
<BitSize>376</BitSize>
|
||||
</DataType>
|
||||
<DataType>
|
||||
<Name>STRING(5)</Name>
|
||||
<BitSize>40</BitSize>
|
||||
</DataType>
|
||||
<DataType>
|
||||
<Name>USINT</Name>
|
||||
<BitSize>8</BitSize>
|
||||
</DataType>
|
||||
</DataTypes>
|
||||
<Objects>
|
||||
<Object>
|
||||
<Index>#x1000</Index>
|
||||
<Name>Device Type</Name>
|
||||
<Type>UDINT</Type>
|
||||
<BitSize>32</BitSize>
|
||||
<Info>
|
||||
<DefaultValue>5001</DefaultValue>
|
||||
</Info>
|
||||
<Flags>
|
||||
<Access>ro</Access>
|
||||
<Category>m</Category>
|
||||
</Flags>
|
||||
</Object>
|
||||
<Object>
|
||||
<Index>#x1008</Index>
|
||||
<Name>Device Name</Name>
|
||||
<Type>STRING(47)</Type>
|
||||
<BitSize>376</BitSize>
|
||||
<Info>
|
||||
<DefaultString>2-channel Hypergalactic input superimpermanator</DefaultString>
|
||||
</Info>
|
||||
<Flags>
|
||||
<Access>ro</Access>
|
||||
</Flags>
|
||||
</Object>
|
||||
<Object>
|
||||
<Index>#x1009</Index>
|
||||
<Name>Hardware Version</Name>
|
||||
<Type>STRING(5)</Type>
|
||||
<BitSize>40</BitSize>
|
||||
<Info>
|
||||
<DefaultString>0.0.1</DefaultString>
|
||||
</Info>
|
||||
<Flags>
|
||||
<Access>ro</Access>
|
||||
<Category>o</Category>
|
||||
</Flags>
|
||||
</Object>
|
||||
<Object>
|
||||
<Index>#x100A</Index>
|
||||
<Name>Software Version</Name>
|
||||
<Type>STRING(5)</Type>
|
||||
<BitSize>40</BitSize>
|
||||
<Info>
|
||||
<DefaultString>0.0.1</DefaultString>
|
||||
</Info>
|
||||
<Flags>
|
||||
<Access>ro</Access>
|
||||
</Flags>
|
||||
</Object>
|
||||
<Object>
|
||||
<Index>#x1018</Index>
|
||||
<Name>Identity Object</Name>
|
||||
<Type>DT1018</Type>
|
||||
<BitSize>144</BitSize>
|
||||
<Info>
|
||||
<SubItem>
|
||||
<Name>Max SubIndex</Name>
|
||||
<Info>
|
||||
<DefaultValue>4</DefaultValue>
|
||||
</Info>
|
||||
</SubItem>
|
||||
<SubItem>
|
||||
<Name>Vendor ID</Name>
|
||||
<Info>
|
||||
<DefaultValue>0</DefaultValue>
|
||||
</Info>
|
||||
</SubItem>
|
||||
<SubItem>
|
||||
<Name>Product Code</Name>
|
||||
<Info>
|
||||
<DefaultValue>700707</DefaultValue>
|
||||
</Info>
|
||||
</SubItem>
|
||||
<SubItem>
|
||||
<Name>Revision Number</Name>
|
||||
<Info>
|
||||
<DefaultValue>2</DefaultValue>
|
||||
</Info>
|
||||
</SubItem>
|
||||
<SubItem>
|
||||
<Name>Serial Number</Name>
|
||||
<Info>
|
||||
<DefaultValue>1</DefaultValue>
|
||||
</Info>
|
||||
</SubItem>
|
||||
</Info>
|
||||
<Flags>
|
||||
<Access>ro</Access>
|
||||
</Flags>
|
||||
</Object>
|
||||
<Object>
|
||||
<Index>#x1C00</Index>
|
||||
<Name>Sync Manager Communication Type</Name>
|
||||
<Type>DT1C00</Type>
|
||||
<BitSize>48</BitSize>
|
||||
<Info>
|
||||
<SubItem>
|
||||
<Name>Max SubIndex</Name>
|
||||
<Info>
|
||||
<DefaultValue>4</DefaultValue>
|
||||
</Info>
|
||||
</SubItem>
|
||||
<SubItem>
|
||||
<Name>Communications Type SM0</Name>
|
||||
<Info>
|
||||
<DefaultValue>1</DefaultValue>
|
||||
</Info>
|
||||
</SubItem>
|
||||
<SubItem>
|
||||
<Name>Communications Type SM1</Name>
|
||||
<Info>
|
||||
<DefaultValue>2</DefaultValue>
|
||||
</Info>
|
||||
</SubItem>
|
||||
<SubItem>
|
||||
<Name>Communications Type SM2</Name>
|
||||
<Info>
|
||||
<DefaultValue>3</DefaultValue>
|
||||
</Info>
|
||||
</SubItem>
|
||||
<SubItem>
|
||||
<Name>Communications Type SM3</Name>
|
||||
<Info>
|
||||
<DefaultValue>4</DefaultValue>
|
||||
</Info>
|
||||
</SubItem>
|
||||
</Info>
|
||||
<Flags>
|
||||
<Access>ro</Access>
|
||||
</Flags>
|
||||
</Object>
|
||||
</Objects>
|
||||
</Dictionary>
|
||||
</Profile>
|
||||
<Fmmu>Outputs</Fmmu>
|
||||
<Fmmu>Inputs</Fmmu>
|
||||
<Fmmu>MBoxState</Fmmu>
|
||||
<Sm DefaultSize="512" StartAddress="#x1000" ControlByte="#x26" Enable="1">MBoxOut</Sm>
|
||||
<Sm DefaultSize="512" StartAddress="#x1200" ControlByte="#x22" Enable="1">MBoxIn</Sm>
|
||||
<Sm StartAddress="#x1600" ControlByte="#x24" Enable="0">Outputs</Sm>
|
||||
<Sm StartAddress="#x1A00" ControlByte="#x20" Enable="0">Inputs</Sm>
|
||||
<Mailbox DataLinkLayer="true">
|
||||
<CoE SdoInfo="true" PdoAssign="false" PdoConfig="false" PdoUpload="true" CompleteAccess="false" />
|
||||
</Mailbox>
|
||||
<Dc>
|
||||
</Dc>
|
||||
<Eeprom>
|
||||
<ByteSize>2048</ByteSize>
|
||||
<ConfigData>05060344640000</ConfigData>
|
||||
</Eeprom>
|
||||
</Device>
|
||||
</Devices>
|
||||
</Descriptions>
|
||||
</EtherCATInfo>`;
|
||||
console.log(result);
|
||||
debugger;
|
||||
expect(result.slice(9000)).toEqual(expectedesi.slice(9000));
|
||||
});
|
||||
|
||||
it("hex_generator should generate config data", function() {
|
||||
// arrange
|
||||
// act
|
||||
var result = hex_generator(form, true);
|
||||
|
||||
// assert
|
||||
const configData = `05060344640000`;
|
||||
expect(result).toEqual(configData);
|
||||
});
|
||||
|
||||
it("ecat_options_generator should generate config data", function() {
|
||||
// arrange
|
||||
// act
|
||||
var result = ecat_options_generator(form, od, indexes);
|
||||
|
||||
// assert
|
||||
const ecat_options =
|
||||
`#ifndef __ECAT_OPTIONS_H__
|
||||
#define __ECAT_OPTIONS_H__
|
||||
|
||||
#define USE_FOE 0
|
||||
#define USE_EOE 0
|
||||
|
||||
#define MBXSIZE 512
|
||||
#define MBXSIZEBOOT 512
|
||||
#define MBXBUFFERS 3
|
||||
|
||||
#define MBX0_sma 0x1000
|
||||
#define MBX0_sml MBXSIZE
|
||||
#define MBX0_sme MBX0_sma+MBX0_sml-1
|
||||
#define MBX0_smc 0x26
|
||||
#define MBX1_sma MBX0_sma+MBX0_sml
|
||||
#define MBX1_sml MBXSIZE
|
||||
#define MBX1_sme MBX1_sma+MBX1_sml-1
|
||||
#define MBX1_smc 0x22
|
||||
|
||||
#define MBX0_sma_b 0x1000
|
||||
#define MBX0_sml_b MBXSIZEBOOT
|
||||
#define MBX0_sme_b MBX0_sma_b+MBX0_sml_b-1
|
||||
#define MBX0_smc_b 0x26
|
||||
#define MBX1_sma_b MBX0_sma_b+MBX0_sml_b
|
||||
#define MBX1_sml_b MBXSIZEBOOT
|
||||
#define MBX1_sme_b MBX1_sma_b+MBX1_sml_b-1
|
||||
#define MBX1_smc_b 0x22
|
||||
|
||||
#define SM2_sma 0x1600
|
||||
#define SM2_smc 0x24
|
||||
#define SM2_act 1
|
||||
#define SM3_sma 0x1A00
|
||||
#define SM3_smc 0x20
|
||||
#define SM3_act 1
|
||||
|
||||
#define MAX_MAPPINGS_SM2 0
|
||||
#define MAX_MAPPINGS_SM3 0
|
||||
|
||||
#define MAX_RXPDO_SIZE 512
|
||||
#define MAX_TXPDO_SIZE 512
|
||||
|
||||
#endif /* __ECAT_OPTIONS_H__ */
|
||||
`;
|
||||
expect(result).toEqual(ecat_options);
|
||||
});
|
||||
|
||||
it("objectlist_generator should generate config data", function() {
|
||||
// arrange
|
||||
// act
|
||||
var result = objectlist_generator(form, od, indexes);
|
||||
|
||||
// assert
|
||||
const objectlist =
|
||||
`#include "esc_coe.h"
|
||||
#include "utypes.h"
|
||||
#include <stddef.h>
|
||||
|
||||
|
||||
static const char acName1000[] = "Device Type";
|
||||
static const char acName1008[] = "Device Name";
|
||||
static const char acName1009[] = "Hardware Version";
|
||||
static const char acName100A[] = "Software Version";
|
||||
static const char acName1018[] = "Identity Object";
|
||||
static const char acName1018_00[] = "Max SubIndex";
|
||||
static const char acName1018_01[] = "Vendor ID";
|
||||
static const char acName1018_02[] = "Product Code";
|
||||
static const char acName1018_03[] = "Revision Number";
|
||||
static const char acName1018_04[] = "Serial Number";
|
||||
static const char acName1C00[] = "Sync Manager Communication Type";
|
||||
static const char acName1C00_00[] = "Max SubIndex";
|
||||
static const char acName1C00_01[] = "Communications Type SM0";
|
||||
static const char acName1C00_02[] = "Communications Type SM1";
|
||||
static const char acName1C00_03[] = "Communications Type SM2";
|
||||
static const char acName1C00_04[] = "Communications Type SM3";
|
||||
|
||||
const _objd SDO1000[] =
|
||||
{
|
||||
{0x0, DTYPE_UNSIGNED32, 32, ATYPE_RO, acName1000, 5001, NULL},
|
||||
};
|
||||
const _objd SDO1008[] =
|
||||
{
|
||||
{0x0, DTYPE_VISIBLE_STRING, 376, ATYPE_RO, acName1008, 0, "2-channel Hypergalactic input superimpermanator"},
|
||||
};
|
||||
const _objd SDO1009[] =
|
||||
{
|
||||
{0x0, DTYPE_VISIBLE_STRING, 40, ATYPE_RO, acName1009, 0, "0.0.1"},
|
||||
};
|
||||
const _objd SDO100A[] =
|
||||
{
|
||||
{0x0, DTYPE_VISIBLE_STRING, 40, ATYPE_RO, acName100A, 0, "0.0.1"},
|
||||
};
|
||||
const _objd SDO1018[] =
|
||||
{
|
||||
{0x00, DTYPE_UNSIGNED8, 8, ATYPE_RO, acName1018_00, 4, NULL},
|
||||
{0x01, DTYPE_UNSIGNED32, 32, ATYPE_RO, acName1018_01, 0, NULL},
|
||||
{0x02, DTYPE_UNSIGNED32, 32, ATYPE_RO, acName1018_02, 700707, NULL},
|
||||
{0x03, DTYPE_UNSIGNED32, 32, ATYPE_RO, acName1018_03, 2, NULL},
|
||||
{0x04, DTYPE_UNSIGNED32, 32, ATYPE_RO, acName1018_04, 1, &Obj.serial},
|
||||
};
|
||||
const _objd SDO1C00[] =
|
||||
{
|
||||
{0x00, DTYPE_UNSIGNED8, 8, ATYPE_RO, acName1C00_00, 4, NULL},
|
||||
{0x01, DTYPE_UNSIGNED8, 8, ATYPE_RO, acName1C00_01, 1, NULL},
|
||||
{0x02, DTYPE_UNSIGNED8, 8, ATYPE_RO, acName1C00_02, 2, NULL},
|
||||
{0x03, DTYPE_UNSIGNED8, 8, ATYPE_RO, acName1C00_03, 3, NULL},
|
||||
{0x04, DTYPE_UNSIGNED8, 8, ATYPE_RO, acName1C00_04, 4, NULL},
|
||||
};
|
||||
|
||||
const _objectlist SDOobjects[] =
|
||||
{
|
||||
{0x1000, OTYPE_VAR, 0, 0, acName1000, SDO1000},
|
||||
{0x1008, OTYPE_VAR, 0, 0, acName1008, SDO1008},
|
||||
{0x1009, OTYPE_VAR, 0, 0, acName1009, SDO1009},
|
||||
{0x100A, OTYPE_VAR, 0, 0, acName100A, SDO100A},
|
||||
{0x1018, OTYPE_RECORD, 4, 0, acName1018, SDO1018},
|
||||
{0x1C00, OTYPE_ARRAY, 4, 0, acName1C00, SDO1C00},
|
||||
{0xffff, 0xff, 0xff, 0xff, NULL, NULL}
|
||||
};
|
||||
`;
|
||||
expect(result).toEqual(objectlist);
|
||||
});
|
||||
|
||||
it("utypes_generator should generate expected code", function() {
|
||||
// arrange
|
||||
// act
|
||||
var result = utypes_generator(form, od, indexes);
|
||||
|
||||
// assert
|
||||
const expectedUtypes =
|
||||
`#ifndef __UTYPES_H__
|
||||
#define __UTYPES_H__
|
||||
|
||||
#include "cc.h"
|
||||
|
||||
/* Object dictionary storage */
|
||||
|
||||
typedef struct
|
||||
{
|
||||
/* Identity */
|
||||
|
||||
uint32_t serial;
|
||||
|
||||
} _Objects;
|
||||
|
||||
extern _Objects Obj;
|
||||
|
||||
#endif /* __UTYPES_H__ */
|
||||
`;
|
||||
expect(result).toEqual(expectedUtypes);
|
||||
});
|
||||
|
||||
describe("hex_generator given SPImode", function () {
|
||||
const testCases = [
|
||||
{ mode: 0 },
|
||||
{ mode: 1 },
|
||||
{ mode: 2 },
|
||||
{ mode: 3 },
|
||||
];
|
||||
|
||||
testCases.forEach((test, index) => {
|
||||
it(`SPImode ${test.mode} should return 05060${test.mode}44640000 (testcase: ${index + 1})`, () => {
|
||||
// arrange
|
||||
form.SPImode.value = test.mode;
|
||||
|
||||
// act
|
||||
var result = hex_generator(form, true);
|
||||
|
||||
// assert
|
||||
expect(result).toEqual(`05060${test.mode}44640000`);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe("for AX58100 project", function() {
|
||||
var form;
|
||||
var od;
|
||||
var indexes;
|
||||
|
||||
beforeEach(function() {
|
||||
form = buildMockFormHelper();
|
||||
form.ESC.value = SupportedESC.AX58100
|
||||
od = buildObjectDictionary(form);
|
||||
indexes = getUsedIndexes(od);
|
||||
});
|
||||
|
||||
it("hex_generator should generate config data 050603446400000000001A000000", function() {
|
||||
// arrange
|
||||
// act
|
||||
var result = hex_generator(form, true);
|
||||
|
||||
// assert
|
||||
const configData = `050603446400000000001A000000`;
|
||||
expect(result).toEqual(configData);
|
||||
});
|
||||
});
|
||||
|
||||
describe("for ET1100 project", function() {
|
||||
var form;
|
||||
var od;
|
||||
var indexes;
|
||||
|
||||
beforeEach(function() {
|
||||
form = buildMockFormHelper();
|
||||
form.ESC.value = SupportedESC.ET1100
|
||||
od = buildObjectDictionary(form);
|
||||
indexes = getUsedIndexes(od);
|
||||
});
|
||||
|
||||
it("hex_generator should generate config data 05060344640000", function() {
|
||||
// arrange
|
||||
// act
|
||||
var result = hex_generator(form, true);
|
||||
|
||||
// assert
|
||||
const configData = `05060344640000`;
|
||||
expect(result).toEqual(configData);
|
||||
});
|
||||
});
|
||||
|
||||
describe("for LAN9252 project", function() {
|
||||
var form;
|
||||
var od;
|
||||
var indexes;
|
||||
|
||||
beforeEach(function() {
|
||||
form = buildMockFormHelper();
|
||||
form.ESC.value = SupportedESC.LAN9252
|
||||
od = buildObjectDictionary(form);
|
||||
indexes = getUsedIndexes(od);
|
||||
});
|
||||
|
||||
it("hex_generator should generate config data 80060344640000", function() {
|
||||
// arrange
|
||||
// act
|
||||
var result = hex_generator(form, true);
|
||||
|
||||
// assert
|
||||
const configData = `80060344640000`;
|
||||
expect(result).toEqual(configData);
|
||||
});
|
||||
});
|
||||
|
||||
describe("for LAN9253_Beckhoff project", function() {
|
||||
var form;
|
||||
var od;
|
||||
var indexes;
|
||||
|
||||
beforeEach(function() {
|
||||
form = buildMockFormHelper();
|
||||
form.ESC.value = SupportedESC.LAN9253_Beckhoff
|
||||
od = buildObjectDictionary(form);
|
||||
indexes = getUsedIndexes(od);
|
||||
});
|
||||
|
||||
it("hex_generator should generate config data 0506034464000000000040C00000", function() {
|
||||
// arrange
|
||||
// act
|
||||
var result = hex_generator(form, true);
|
||||
|
||||
// assert
|
||||
const configData = `0506034464000000000040C00000`;
|
||||
expect(result).toEqual(configData);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
var formMock = {};
|
||||
|
||||
function buildMockFormHelper(formValues = null) {
|
||||
const defaultFormValues = getFormDefaultValues().form;
|
||||
|
||||
if (!formValues) {
|
||||
formValues = defaultFormValues;
|
||||
}
|
||||
|
||||
formMock = { }
|
||||
|
||||
Object.keys(defaultFormValues).forEach(formControlName => {
|
||||
const formControl = {
|
||||
name: formControlName,
|
||||
};
|
||||
setFormControlValue(formControl, formValues[formControlName]);
|
||||
formMock[formControlName] = formControl;
|
||||
});
|
||||
|
||||
return formMock;
|
||||
}
|
||||
|
||||
function getForm() {
|
||||
return formMock;
|
||||
}
|
||||
127
Pcb-1-lan9252/EEPROM_generator/src/backup.js
Normal file
127
Pcb-1-lan9252/EEPROM_generator/src/backup.js
Normal file
@@ -0,0 +1,127 @@
|
||||
/**
|
||||
* SOES EEPROM generator
|
||||
* Project backup save and restore
|
||||
|
||||
* This tool serves as:
|
||||
- EtherCAT Slave Information XML + EEPROM binary generator
|
||||
- SOES code generator
|
||||
|
||||
* Victor Sluiter 2013-2018
|
||||
* Kuba Buda 2020-2021
|
||||
*/
|
||||
'use strict'
|
||||
|
||||
// ####################### Backup serialization + deserialization ####################### //
|
||||
|
||||
function isValidBackup(backup) {
|
||||
if (!backup || !backup.form || !backup.od ) {
|
||||
if (!confirm('Backup is incomplete or invalid, proceed anyway?')) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
function prepareBackupObject(form) {
|
||||
const formValues = {};
|
||||
if (form) {
|
||||
Object.entries(form).forEach(formEntry => {
|
||||
const formControl = formEntry[1]; // entry[0] is form control order number
|
||||
if(isBackedUp(formControl) && formControl.value) {
|
||||
formValues[formControl.name] = formControl.value;
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
const backup = {
|
||||
form: formValues,
|
||||
od: getObjDict(),
|
||||
dc: _dc,
|
||||
};
|
||||
|
||||
return backup;
|
||||
}
|
||||
|
||||
function isBackedUp(formControl) {
|
||||
return formControl.type != "button";
|
||||
}
|
||||
|
||||
function loadBackup(backupObject, form) {
|
||||
if (backupObject.od) {
|
||||
setObjDictSection(sdo, backupObject.od.sdo);
|
||||
setObjDictSection(txpdo, backupObject.od.txpdo);
|
||||
setObjDictSection(rxpdo, backupObject.od.rxpdo);
|
||||
}
|
||||
|
||||
if (backupObject.dc) {
|
||||
_dc = backupObject.dc;
|
||||
}
|
||||
|
||||
setFormValues(form, backupObject);
|
||||
}
|
||||
|
||||
function setFormValues(form, backupObject) {
|
||||
if (form) {
|
||||
Object.entries(form).forEach(formEntry => {
|
||||
const formControl = formEntry[1]; // entry[0] is index
|
||||
const formControlValue = backupObject.form[formControl.name];
|
||||
if (isBackedUp(formControl) && formControlValue) {
|
||||
setFormControlValue(formControl, formControlValue);
|
||||
};
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function setFormControlValue(formControl, formControlValue) {
|
||||
if (formControl.name.startsWith('CoeDetailsEnable')) {
|
||||
if (formControlValue == true) {
|
||||
formControl.checked = true;
|
||||
} else {
|
||||
}
|
||||
} else {
|
||||
formControl.value = formControlValue;
|
||||
}
|
||||
}
|
||||
|
||||
function prepareBackupFileContent(form) {
|
||||
var backupObject = prepareBackupObject(form);
|
||||
var backupFileContent = JSON.stringify(backupObject, null, 2); // pretty print
|
||||
return backupFileContent;
|
||||
}
|
||||
|
||||
// ####################### Backup using JSON file from filesystem ####################### //
|
||||
|
||||
// Localstorage limit is usually 5MB, super large object dictionaries on older browsers might be problematic
|
||||
|
||||
function downloadBackupFile(form) {
|
||||
const backupFileContent = prepareBackupFileContent(form); // pretty print
|
||||
downloadFile(backupFileContent, 'esi.json', 'text/json');
|
||||
}
|
||||
|
||||
function restoreBackup(fileContent, form) {
|
||||
var backup = JSON.parse(fileContent);
|
||||
if (isValidBackup(backup)) {
|
||||
loadBackup(backup, form);
|
||||
reloadOD_Sections();
|
||||
reloadSyncModes()
|
||||
}
|
||||
}
|
||||
|
||||
// ####################### Backup using browser localstorage ####################### //
|
||||
|
||||
/** persist OD and settings changes over page reload */
|
||||
function saveLocalBackup(form) {
|
||||
localStorage.etherCATeepromGeneratorBackup = prepareBackupFileContent(form);
|
||||
}
|
||||
|
||||
function tryRestoreLocalBackup(form) {
|
||||
if (localStorage.etherCATeepromGeneratorBackup) {
|
||||
restoreBackup(localStorage.etherCATeepromGeneratorBackup, form);
|
||||
}
|
||||
}
|
||||
|
||||
function resetLocalBackup() {
|
||||
if (localStorage.etherCATeepromGeneratorBackup) {
|
||||
delete localStorage.etherCATeepromGeneratorBackup;
|
||||
}
|
||||
}
|
||||
157
Pcb-1-lan9252/EEPROM_generator/src/constants.js
Normal file
157
Pcb-1-lan9252/EEPROM_generator/src/constants.js
Normal file
@@ -0,0 +1,157 @@
|
||||
/**
|
||||
* SOES EEPROM generator
|
||||
* Shared constants, data types
|
||||
|
||||
* This tool serves as:
|
||||
- EtherCAT Slave Information XML + EEPROM binary generator
|
||||
- SOES code generator
|
||||
|
||||
* Victor Sluiter 2013-2018
|
||||
* Kuba Buda 2020-2021
|
||||
*/
|
||||
'use strict'
|
||||
|
||||
const automaticCodegen = true; // code is regenerated on every form change.
|
||||
// no need to remember to generate before copying or downloading
|
||||
// app is noticeably slower
|
||||
|
||||
// ####################### Constants, lookup tables ####################### //
|
||||
/** CoE Object Types */
|
||||
const OTYPE = {
|
||||
VAR : 'VAR',
|
||||
ARRAY : 'ARRAY',
|
||||
RECORD: 'RECORD',
|
||||
};
|
||||
/** CoE Data Types */
|
||||
const DTYPE = {
|
||||
BOOLEAN : 'BOOLEAN',
|
||||
INTEGER8 : 'INTEGER8',
|
||||
INTEGER16 : 'INTEGER16',
|
||||
INTEGER32 : 'INTEGER32',
|
||||
UNSIGNED8 : 'UNSIGNED8',
|
||||
UNSIGNED16 : 'UNSIGNED16',
|
||||
UNSIGNED32 : 'UNSIGNED32',
|
||||
REAL32 : 'REAL32',
|
||||
VISIBLE_STRING : 'VISIBLE_STRING',
|
||||
/* TODO implement missing less common types */
|
||||
// OCTET_STRING : 'OCTET_STRING',
|
||||
// UNICODE_STRING : 'UNICODE_STRING',
|
||||
// INTEGER24 : 'INTEGER24',
|
||||
// UNSIGNED24 : 'UNSIGNED24',
|
||||
// INTEGER64 : 'INTEGER64',
|
||||
// UNSIGNED64 : 'UNSIGNED64',
|
||||
// REAL64 : 'REAL64',
|
||||
// PDO_MAPPING : 'PDO_MAPPING',
|
||||
};
|
||||
/** Data types bitsize as used in objectlist.c */
|
||||
const dtype_bitsize = {
|
||||
'BOOLEAN' : 1,
|
||||
'INTEGER8' : 8,
|
||||
'INTEGER16' : 16,
|
||||
'INTEGER32' : 32,
|
||||
'UNSIGNED8' : 8,
|
||||
'UNSIGNED16' : 16,
|
||||
'UNSIGNED32' : 32,
|
||||
'REAL32' : 32,
|
||||
'VISIBLE_STRING' : 8,
|
||||
};
|
||||
const booleanPaddingBitsize = 7;
|
||||
/** ESI XML data type */
|
||||
const ESI_DT = {
|
||||
'BOOLEAN': { name: 'BOOL', bitsize: 1, ctype: 'uint8_t' },
|
||||
'INTEGER8': { name: 'SINT', bitsize: 8, ctype: 'int8_t' },
|
||||
'INTEGER16': { name: 'INT', bitsize: 16, ctype: 'int16_t' },
|
||||
'INTEGER32': { name: 'DINT', bitsize: 32, ctype: 'int32_t' },
|
||||
'UNSIGNED8': { name: 'USINT', bitsize: 8, ctype: 'uint8_t' },
|
||||
'UNSIGNED16': { name: 'UINT', bitsize: 16, ctype: 'uint16_t' },
|
||||
'UNSIGNED32': { name: 'UDINT', bitsize: 32, ctype: 'uint32_t' },
|
||||
'REAL32': { name: 'REAL', bitsize: 32, ctype: 'float' }, // TODO check C type name
|
||||
'VISIBLE_STRING': { name: 'STRING', bitsize: 8, ctype: 'char *' }, // TODO check C type name
|
||||
};
|
||||
|
||||
/** These are required by minimal CiA 301 device */
|
||||
const SDO_category = {
|
||||
'1000': 'm',
|
||||
'1009': 'o',
|
||||
};
|
||||
|
||||
// ####################### Object Dictionary building ####################### //
|
||||
/**
|
||||
* Returns Object Dictionaty stub with mandatory objects.
|
||||
* OD index is hexadecimal value without '0x' prefix
|
||||
*/
|
||||
function getMandatoryObjects() {
|
||||
const OD = {
|
||||
'1000': { otype: OTYPE.VAR, dtype: DTYPE.UNSIGNED32, name: 'Device Type', value: 0x1389 },
|
||||
'1008': { otype: OTYPE.VAR, dtype: DTYPE.VISIBLE_STRING, name: 'Device Name', data: '' },
|
||||
'1009': { otype: OTYPE.VAR, dtype: DTYPE.VISIBLE_STRING, name: 'Hardware Version', data: '' },
|
||||
'100A': { otype: OTYPE.VAR, dtype: DTYPE.VISIBLE_STRING, name: 'Software Version', data: '' },
|
||||
'1018': { otype: OTYPE.RECORD, name: 'Identity Object', items: [
|
||||
{ name: 'Max SubIndex' },
|
||||
{ name: 'Vendor ID', dtype: DTYPE.UNSIGNED32, value: 600 },
|
||||
{ name: 'Product Code', dtype: DTYPE.UNSIGNED32 },
|
||||
{ name: 'Revision Number', dtype: DTYPE.UNSIGNED32 },
|
||||
{ name: 'Serial Number', dtype: DTYPE.UNSIGNED32, data: '&Obj.serial' },
|
||||
]},
|
||||
'1C00': { otype: OTYPE.ARRAY, dtype: DTYPE.UNSIGNED8, name: 'Sync Manager Communication Type', items: [
|
||||
{ name: 'Max SubIndex' },
|
||||
{ name: 'Communications Type SM0', value: 1 },
|
||||
{ name: 'Communications Type SM1', value: 2 },
|
||||
{ name: 'Communications Type SM2', value: 3 },
|
||||
{ name: 'Communications Type SM3', value: 4 },
|
||||
]},
|
||||
};
|
||||
return OD;
|
||||
};
|
||||
|
||||
const sdo = 'sdo';
|
||||
const txpdo = 'txpdo';
|
||||
const rxpdo = 'rxpdo';
|
||||
|
||||
/** EtherCAT Slave Chips that are supported by this web tool */
|
||||
const SupportedESC = {
|
||||
AX58100: 'AX58100',
|
||||
ET1100: 'ET1100',
|
||||
LAN9252: 'LAN9252',
|
||||
LAN9253_Beckhoff: 'LAN9253 Beckhoff',
|
||||
};
|
||||
|
||||
/** ESCs that are using reserved bytes for configuration, for example AX58100 configdata reaches 0x0A byte */
|
||||
const configOnReservedBytes = [SupportedESC.AX58100, SupportedESC.LAN9253_Beckhoff];
|
||||
|
||||
//** Form default values */
|
||||
function getFormDefaultValues() {
|
||||
return {form: {
|
||||
VendorName: "ACME EtherCAT Devices",
|
||||
VendorID: "0x000",
|
||||
ProductCode: "0x00ab123",
|
||||
ProfileNo: "5001",
|
||||
RevisionNumber: "0x002",
|
||||
SerialNumber: "0x001",
|
||||
HWversion: "0.0.1",
|
||||
SWversion: "0.0.1",
|
||||
EEPROMsize: "2048",
|
||||
RxMailboxOffset: "0x1000",
|
||||
TxMailboxOffset: "0x1200",
|
||||
MailboxSize: "512",
|
||||
SM2Offset: "0x1600",
|
||||
SM3Offset: "0x1A00",
|
||||
TextGroupType: "DigIn",
|
||||
TextGroupName5: "Digital input",
|
||||
ImageName: "IMGCBY",
|
||||
TextDeviceType: "DigIn2000",
|
||||
TextDeviceName: "2-channel Hypergalactic input superimpermanator",
|
||||
Port0Physical: "Y",
|
||||
Port1Physical: "Y",
|
||||
Port2Physical: " ",
|
||||
Port3Physical: " ",
|
||||
ESC: SupportedESC.ET1100,
|
||||
SPImode: "3",
|
||||
CoeDetailsEnableSDO: true,
|
||||
CoeDetailsEnableSDOInfo: true,
|
||||
CoeDetailsEnablePDOAssign: false,
|
||||
CoeDetailsEnablePDOConfiguration: false,
|
||||
CoeDetailsEnableUploadAtStartup: true,
|
||||
CoeDetailsEnableSDOCompleteAccess: false,
|
||||
}};
|
||||
};
|
||||
89
Pcb-1-lan9252/EEPROM_generator/src/file_io.js
Normal file
89
Pcb-1-lan9252/EEPROM_generator/src/file_io.js
Normal file
@@ -0,0 +1,89 @@
|
||||
/**
|
||||
* SOES EEPROM generator
|
||||
* Files input and output
|
||||
|
||||
* This tool serves as:
|
||||
- EtherCAT Slave Information XML + EEPROM binary generator
|
||||
- SOES code generator
|
||||
|
||||
* Victor Sluiter 2013-2018
|
||||
* Kuba Buda 2020-2021
|
||||
*/
|
||||
'use strict'
|
||||
|
||||
// ####################### File operations ####################### //
|
||||
|
||||
/** save file in local filesystem, by downloading from browser */
|
||||
function downloadFile(content, fileName, contentType) {
|
||||
var a = document.createElement("a");
|
||||
var file = new Blob([content], {type: contentType});
|
||||
a.href = URL.createObjectURL(file);
|
||||
a.download = fileName;
|
||||
a.click();
|
||||
// a element will be garbage collected, no need to cleanup
|
||||
}
|
||||
|
||||
/** reads saved project from file user opened */
|
||||
function readFile(e) {
|
||||
var file = e.target.files[0];
|
||||
if (!file) return;
|
||||
var reader = new FileReader();
|
||||
reader.onload = function(e) {
|
||||
onRestoreComplete(e.target.result);
|
||||
}
|
||||
reader.readAsText(file);
|
||||
}
|
||||
|
||||
/** takes bytes array, returns Intel Hex as string */
|
||||
function toIntelHex(record) {
|
||||
var hex = "";
|
||||
const bytes_per_rule = 32;
|
||||
const rulesTotalCount = record.length/bytes_per_rule;
|
||||
|
||||
for (var rulenumber = 0 ; rulenumber < (rulesTotalCount); rulenumber++)
|
||||
{
|
||||
const sliceStart = rulenumber*bytes_per_rule;
|
||||
const sliceEnd = bytes_per_rule + (rulenumber * bytes_per_rule);
|
||||
const recordSlice = record.slice(sliceStart, sliceEnd);
|
||||
hex += CreateiHexRule(bytes_per_rule, rulenumber, recordSlice);
|
||||
}
|
||||
//end of file marker
|
||||
hex += ':00000001FF';
|
||||
return hex.toUpperCase();
|
||||
|
||||
function CreateiHexRule(bytes_per_rule, rulenumber, record)
|
||||
{
|
||||
var record_type_datarecord = '00';
|
||||
var rule = ':'+ bytes_per_rule.toString(16).slice(-2) + generate_hex_address(rulenumber*bytes_per_rule) + record_type_datarecord;
|
||||
for(var byteposition = 0; byteposition < bytes_per_rule ; byteposition++)
|
||||
{
|
||||
var byte = record[byteposition].toString(16).slice(-2); // convert to hexadecimal, crop to last 2 digits
|
||||
if(byte.length < 2)
|
||||
byte = '0' + byte; //minimal field width = 2 characters.
|
||||
rule += byte;
|
||||
}
|
||||
var checksum = 0;
|
||||
for(var rule_pos = 0 ; rule_pos < (rule.length-1)/2 ; rule_pos++)
|
||||
{
|
||||
var byte = parseInt(rule.slice(1+(2*rule_pos), 3+(2*rule_pos)),16);
|
||||
checksum += byte;
|
||||
}
|
||||
checksum %= 0x100; //leave last byte
|
||||
checksum = 0x100-checksum; //two's complement
|
||||
rule += checksum.toString(16).slice(-2) + '\n';
|
||||
return rule;
|
||||
}
|
||||
/** takex number, returns its hexadecimal value padded/trimmed to 4 digits */
|
||||
function generate_hex_address(number)
|
||||
{
|
||||
//convert to hexadecimal string
|
||||
var output = number.toString(16);
|
||||
//take care that 4 characters are present
|
||||
while(output.length<4)
|
||||
{
|
||||
output ='0' + output;
|
||||
}
|
||||
//return 4 characters, prevents overflow
|
||||
return output.slice(-4);
|
||||
}
|
||||
}
|
||||
330
Pcb-1-lan9252/EEPROM_generator/src/generators/EEPROM.js
Normal file
330
Pcb-1-lan9252/EEPROM_generator/src/generators/EEPROM.js
Normal file
@@ -0,0 +1,330 @@
|
||||
/**
|
||||
* SOES EEPROM generator
|
||||
* EEPROM .bin / .hex code generation logic
|
||||
|
||||
* This tool serves as:
|
||||
- EtherCAT Slave Information XML + EEPROM binary generator
|
||||
- SOES code generator
|
||||
|
||||
* Victor Sluiter 2013-2018
|
||||
* Kuba Buda 2020-2021
|
||||
*/
|
||||
'use strict'
|
||||
|
||||
// ####################### EEPROM generating ####################### //
|
||||
|
||||
function hex_generator(form, stringOnly=false)
|
||||
{
|
||||
//WORD ADDRESS 0-7
|
||||
var record = getConfigDataBytes(form);
|
||||
if (stringOnly) { return getConfigDataString(record, form.ESC.value); }
|
||||
|
||||
/** Takes form, returns config data:
|
||||
* first 16 bytes (8 words) with check sum */
|
||||
function getConfigDataBytes(form) {
|
||||
const recordLength = parseInt(form.EEPROMsize.value);
|
||||
var record = new Uint8Array(recordLength);
|
||||
record.fill(0xFF);
|
||||
//Start of EEPROM contents; A lot of information can be found in 5.4 of ETG1000.6
|
||||
let pdiControl = 0x05;
|
||||
const spiMode = parseInt(form.SPImode.value); // valid values ara 0, 1, 2 or 3
|
||||
let reserved_0x05 = 0x0000;
|
||||
|
||||
switch(form.ESC.value) {
|
||||
case SupportedESC.AX58100:
|
||||
reserved_0x05 = 0x001A; // enable IO for SPI driver on AX58100:
|
||||
// Write 0x1A value (INT edge pulse length, 8 mA Control + IO 9:0 Drive Select) to 0x0A (Host Interface Extend Setting and Drive Strength
|
||||
break;
|
||||
case SupportedESC.LAN9252:
|
||||
pdiControl = 0x80;
|
||||
break;
|
||||
case SupportedESC.LAN9253_Beckhoff:
|
||||
reserved_0x05 = 0xC040; // enable ERRLED, STATE_RUNLED and MI Write
|
||||
// in ASIC CONFIGURATION REGISTER: 0142h-0143h (refer to DS00003421A-page 268)
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
//WORD ADDRESS 0-7
|
||||
writeEEPROMbyte_byteaddress(pdiControl, 0, record); //PDI control: SPI slave (mapped to register 0x0140)
|
||||
writeEEPROMbyte_byteaddress(0x06, 1, record); //ESC configuration: Distributed clocks Sync Out and Latch In enabled (mapped register 0x0141)
|
||||
writeEEPROMbyte_byteaddress(spiMode, 2, record); //SPI mode (mapped to register 0x0150)
|
||||
writeEEPROMbyte_byteaddress(0x44, 3, record); //SYNC /LATCH configuration (mapped to 0x0151). Make both Syncs output
|
||||
writeEEPROMword_wordaddress(0x0064, 2, record); //Syncsignal Pulselenght in 10ns units(mapped to 0x0982:0x0983)
|
||||
writeEEPROMword_wordaddress(0x00, 3, record); //Extended PDI configuration (none for SPI slave)(0x0152:0x0153)
|
||||
writeEEPROMword_wordaddress(0x00, 4, record); //Configured Station Alias (0x0012:0x0013)
|
||||
writeEEPROMword_wordaddress(reserved_0x05, 5, record); //Reserved, 0 (when not AX58100)
|
||||
writeEEPROMword_wordaddress(0, 6, record); //Reserved, 0
|
||||
const crc = FindCRC(record, 14);
|
||||
writeEEPROMword_wordaddress(crc, 7, record); //CRC
|
||||
|
||||
return record;
|
||||
}
|
||||
|
||||
//WORD ADDRESS 8-15
|
||||
writeEEPROMDword_wordaddress(parseInt(form.VendorID.value),8,record); //CoE 0x1018:01
|
||||
writeEEPROMDword_wordaddress(parseInt(form.ProductCode.value),10,record); //CoE 0x1018:02
|
||||
writeEEPROMDword_wordaddress(parseInt(form.RevisionNumber.value),12,record);//CoE 0x1018:03
|
||||
writeEEPROMDword_wordaddress(parseInt(form.SerialNumber.value),14,record); //CoE 0x1018:04
|
||||
//WORD ADDRESS 16-23
|
||||
writeEEPROMword_wordaddress(0,16,record); //Execution Delay Time; units?
|
||||
writeEEPROMword_wordaddress(0,17,record); //Port0 Delay Time; units?
|
||||
writeEEPROMword_wordaddress(0,18,record); //Port1 Delay Time; units?
|
||||
writeEEPROMword_wordaddress(0,19,record); //Reserved, zero
|
||||
writeEEPROMword_wordaddress(0,20,record); //Bootstrap Rx mailbox offset //Bootstrap not supported
|
||||
writeEEPROMword_wordaddress(0,21,record); //Bootstrap Rx mailbox size
|
||||
writeEEPROMword_wordaddress(0,22,record); //Bootstrap Tx mailbox offset
|
||||
writeEEPROMword_wordaddress(0,23,record); //Bootstrap Tx mailbox size
|
||||
//WORD ADDRESS 24-...
|
||||
writeEEPROMword_wordaddress(parseInt(form.RxMailboxOffset.value),24,record); //Standard Rx mailbox offset
|
||||
writeEEPROMword_wordaddress(parseInt(form.MailboxSize.value),25,record); //Standard Rx mailbox size
|
||||
writeEEPROMword_wordaddress(parseInt(form.TxMailboxOffset.value),26,record); //Standard Tx mailbox offset
|
||||
writeEEPROMword_wordaddress(parseInt(form.MailboxSize.value),27,record); //Standard Tx mailbox size
|
||||
writeEEPROMword_wordaddress(0x04,28,record); //CoE protocol, see Table18 in ETG1000.6
|
||||
for (var count = 29; count <= 61; count++) { //fill reserved area with zeroes
|
||||
writeEEPROMword_wordaddress(0,count,record);
|
||||
}
|
||||
writeEEPROMword_wordaddress((Math.floor(parseInt(form.EEPROMsize.value)/128))-1,62,record); //EEPROM size
|
||||
writeEEPROMword_wordaddress(1,63,record); //Version
|
||||
////////////////////////////////////
|
||||
/// Vendor Specific Info //
|
||||
////////////////////////////////////
|
||||
|
||||
//Strings
|
||||
var array_of_strings = [form.TextDeviceType.value, form.TextGroupType.value, form.ImageName.value, form.TextDeviceName.value];
|
||||
var offset = 0;
|
||||
offset = writeEEPROMstrings(record, 0x80, array_of_strings); //See ETG1000.6 Table20
|
||||
//General info
|
||||
offset = writeEEPROMgeneral_settings(form,offset,record); //See ETG1000.6 Table21
|
||||
//FMMU
|
||||
offset = writeFMMU(form,offset, record); //see Table 22 ETG1000.6
|
||||
//SyncManagers
|
||||
offset = writeSyncManagers(form, offset, record); //See Table 23 ETG1000.6
|
||||
//End of EEPROM contents
|
||||
const eepromSize = getForm().EEPROMsize.value;
|
||||
|
||||
return record;
|
||||
|
||||
/** See ETG1000.6 Table20 for Category string */
|
||||
function writeEEPROMstrings(record, offset, a_strings)
|
||||
{
|
||||
var number_of_strings = a_strings.length;
|
||||
var total_string_data_length = 0;
|
||||
var length_is_even;
|
||||
for(var strcounter = 0; strcounter < number_of_strings ; strcounter++)
|
||||
{
|
||||
total_string_data_length += a_strings[strcounter].length //add length of strings
|
||||
}
|
||||
total_string_data_length += number_of_strings; //for each string a byte is needed to indicate the length
|
||||
total_string_data_length += 1; //for byte to give 'number of strings'
|
||||
if(total_string_data_length %2) //if length is even (ends at word boundary)
|
||||
length_is_even = false;
|
||||
else
|
||||
length_is_even = true;
|
||||
writeEEPROMword_wordaddress(0x000A, offset/2, record); //Type: STRING
|
||||
writeEEPROMword_wordaddress(Math.ceil(total_string_data_length/2), (offset/2) + 1, record); //write length of complete package
|
||||
offset += 4; //2 words written
|
||||
writeEEPROMbyte_byteaddress(number_of_strings, offset++, record);
|
||||
for(var strcounter = 0; strcounter < number_of_strings ; strcounter++)
|
||||
{
|
||||
writeEEPROMbyte_byteaddress(a_strings[strcounter].length, offset++, record);
|
||||
for(var charcounter = 0 ; charcounter < a_strings[strcounter].length ; charcounter++)
|
||||
{
|
||||
writeEEPROMbyte_byteaddress(a_strings[strcounter].charCodeAt(charcounter), offset++, record);
|
||||
}
|
||||
}
|
||||
if(length_is_even == false)
|
||||
{
|
||||
writeEEPROMbyte_byteaddress(0, offset++, record);
|
||||
}
|
||||
return offset;
|
||||
}
|
||||
/** See ETG1000.6 Table21 */
|
||||
function writeEEPROMgeneral_settings(form,offset,record)
|
||||
{
|
||||
const General_category = 0x1E; // value: 30d
|
||||
const categorysize = 0x10;
|
||||
//Clear memory region
|
||||
for(let wordcount = 0; wordcount < categorysize + 2; wordcount++) {
|
||||
writeEEPROMword_wordaddress(0, (offset/2) + wordcount, record);
|
||||
}
|
||||
//write code 30, 'General type'. See ETG1000.6, Table 19
|
||||
writeEEPROMword_wordaddress(General_category, offset/2, record);
|
||||
//write length of General Category data
|
||||
writeEEPROMword_wordaddress(categorysize, 1+(offset/2), record);
|
||||
offset +=4;
|
||||
writeEEPROMbyte_byteaddress(2,offset++,record);//index to string for Group Info
|
||||
writeEEPROMbyte_byteaddress(3,offset++,record);//index to string for Image Name
|
||||
writeEEPROMbyte_byteaddress(1,offset++,record);//index to string for Device Order Number
|
||||
writeEEPROMbyte_byteaddress(4,offset++,record);//index to string for Device Name Information
|
||||
offset++; //byte 4 is reserved
|
||||
writeEEPROMbyte_byteaddress(getCOEdetails(form),offset++,record);//CoE Details
|
||||
writeEEPROMbyte_byteaddress(0,offset++,record); //Enable FoE
|
||||
writeEEPROMbyte_byteaddress(0,offset++,record); //Enable EoE
|
||||
writeEEPROMbyte_byteaddress(0,offset++,record); //reserved
|
||||
writeEEPROMbyte_byteaddress(0,offset++,record); //reserved
|
||||
writeEEPROMbyte_byteaddress(0,offset++,record); //reserved
|
||||
writeEEPROMbyte_byteaddress(0,offset++,record); //flags (Bit0: Enable SafeOp, Bit1: Enable notLRW
|
||||
writeEEPROMword_wordaddress(0x0000, offset/2, record); //current consumption in mA
|
||||
offset += 2;
|
||||
writeEEPROMword_wordaddress(0x0000, offset/2, record); //2 pad bytes
|
||||
offset += 2;
|
||||
writeEEPROMword_wordaddress(getPhysicalPort(form), offset/2, record);
|
||||
offset += 2;
|
||||
offset += 14; //14 pad bytes
|
||||
return offset;
|
||||
}
|
||||
/** See ETG1000.6 Table 22 */
|
||||
function writeFMMU(form, offset, record)
|
||||
{
|
||||
const FMMU_category = 0x28 // 40d
|
||||
writeEEPROMword_wordaddress(FMMU_category,offset/2,record);
|
||||
offset += 2;
|
||||
const length = 2 //length = 2 word = 4bytes: 3 FMMU's + padding
|
||||
//length = 1 word = 2bytes: 2 FMMU's.
|
||||
writeEEPROMword_wordaddress(length, offset/2, record);
|
||||
offset += 2;
|
||||
writeEEPROMbyte_byteaddress(1, offset++, record); //FMMU0 used for Outputs; see Table 22 ETG1000.6
|
||||
writeEEPROMbyte_byteaddress(2, offset++, record); //FMMU1 used for Inputs; see Table 22 ETG1000.6
|
||||
writeEEPROMbyte_byteaddress(3, offset++, record); //FMMU2 used for Mailbox State
|
||||
writeEEPROMbyte_byteaddress(0, offset++, record); //padding, disable FMMU4 if exists
|
||||
|
||||
return offset;
|
||||
}
|
||||
/** See Table 23 ETG1000.6 */
|
||||
function writeSyncManagers(form, offset, record)
|
||||
{
|
||||
const SyncManager_category = 0x29 // 41d
|
||||
writeEEPROMword_wordaddress(SyncManager_category, offset/2, record); //SyncManager
|
||||
offset += 2;
|
||||
writeEEPROMword_wordaddress(0x10, offset/2, record); //size of structure category
|
||||
offset += 2;
|
||||
//SM0
|
||||
writeEEPROMword_wordaddress(parseInt(form.RxMailboxOffset.value),offset/2, record); //Physical start address
|
||||
offset += 2;
|
||||
writeEEPROMword_wordaddress(parseInt(form.MailboxSize.value),offset/2, record); //Physical size
|
||||
offset += 2;
|
||||
writeEEPROMbyte_byteaddress(0x26,offset++, record); //Mode of operation
|
||||
writeEEPROMbyte_byteaddress(0,offset++, record); //don't care
|
||||
writeEEPROMbyte_byteaddress(1,offset++, record); //Enable Syncmanager; bit0: enable, bit 1: fixed content, bit 2: virtual SyncManager, bit 3: Op Only
|
||||
writeEEPROMbyte_byteaddress(1,offset++, record); //SyncManagerType; 0: not used, 1: Mbx out, 2: Mbx In, 3: PDO, 4: PDI
|
||||
//SM1
|
||||
writeEEPROMword_wordaddress(parseInt(form.TxMailboxOffset.value),offset/2, record); //Physical start address
|
||||
offset += 2;
|
||||
writeEEPROMword_wordaddress(parseInt(form.MailboxSize.value),offset/2, record); //Physical size
|
||||
offset += 2;
|
||||
writeEEPROMbyte_byteaddress(0x22,offset++, record); //Mode of operation
|
||||
writeEEPROMbyte_byteaddress(0,offset++, record); //don't care
|
||||
writeEEPROMbyte_byteaddress(1,offset++, record); //Enable Syncmanager; bit0: enable, bit 1: fixed content, bit 2: virtual SyncManager, bit 3: Op Only
|
||||
writeEEPROMbyte_byteaddress(2,offset++, record); //SyncManagerType; 0: not used, 1: Mbx out, 2: Mbx In, 3: PDO, 4: PDI
|
||||
//SM2
|
||||
writeEEPROMword_wordaddress(parseInt(form.SM2Offset.value),offset/2, record); //Physical start address
|
||||
offset += 2;
|
||||
writeEEPROMword_wordaddress(0,offset/2, record); //Physical size
|
||||
offset += 2;
|
||||
writeEEPROMbyte_byteaddress(0x24,offset++, record); //Mode of operation
|
||||
writeEEPROMbyte_byteaddress(0,offset++, record); //don't care
|
||||
writeEEPROMbyte_byteaddress(1,offset++, record); //Enable Syncmanager; bit0: enable, bit 1: fixed content, bit 2: virtual SyncManager, bit 3: Op Only
|
||||
writeEEPROMbyte_byteaddress(3,offset++, record); //SyncManagerType; 0: not used, 1: Mbx out, 2: Mbx In, 3: PDO, 4: PDI
|
||||
//SM3
|
||||
writeEEPROMword_wordaddress(parseInt(form.SM3Offset.value),offset/2, record); //Physical start address
|
||||
offset += 2;
|
||||
writeEEPROMword_wordaddress(0,offset/2, record); //Physical size
|
||||
offset += 2;
|
||||
writeEEPROMbyte_byteaddress(0x20,offset++, record); //Mode of operation
|
||||
writeEEPROMbyte_byteaddress(0,offset++, record); //don't care
|
||||
writeEEPROMbyte_byteaddress(1,offset++, record); //Enable Syncmanager; bit0: enable, bit 1: fixed content, bit 2: virtual SyncManager, bit 3: Op Only
|
||||
writeEEPROMbyte_byteaddress(4,offset++, record); //SyncManagerType; 0: not used, 1: Mbx out, 2: Mbx In, 3: PDO, 4: PDI
|
||||
return offset;
|
||||
}
|
||||
function getCOEdetails(form)
|
||||
{
|
||||
let coedetails = 0;
|
||||
if(form.CoeDetailsEnableSDO.checked) coedetails |= 0x01; //Enable SDO
|
||||
if(form.CoeDetailsEnableSDOInfo.checked) coedetails |= 0x02; //Enable SDO Info
|
||||
if(form.CoeDetailsEnablePDOAssign.checked) coedetails |= 0x04; //Enable PDO Assign
|
||||
if(form.CoeDetailsEnablePDOConfiguration.checked) coedetails |= 0x08; //Enable PDO Configuration
|
||||
if(form.CoeDetailsEnableUploadAtStartup.checked) coedetails |= 0x10; //Enable Upload at startup
|
||||
if(form.CoeDetailsEnableSDOCompleteAccess.checked) coedetails |= 0x20; //Enable SDO complete access
|
||||
return coedetails;
|
||||
}
|
||||
/** ETG1000.6 Table 21 */
|
||||
function getPhysicalPort(form)
|
||||
{
|
||||
let portinfo = 0;
|
||||
let physicals = [form.Port3Physical.value, form.Port2Physical.value, form.Port1Physical.value, form.Port0Physical.value];
|
||||
for (var physicalcounter = 0; physicalcounter < physicals.length ; physicalcounter++)
|
||||
{
|
||||
portinfo = (portinfo << 4); //shift previous result
|
||||
switch(physicals[physicalcounter])
|
||||
{
|
||||
case 'Y':
|
||||
case 'H':
|
||||
portinfo |= 0x01; //MII
|
||||
break;
|
||||
case 'K':
|
||||
portinfo |= 0x03; //EBUS
|
||||
break;
|
||||
default:
|
||||
portinfo |= 0; //No connection
|
||||
}
|
||||
}
|
||||
return portinfo;
|
||||
}
|
||||
|
||||
/** computes crc value */
|
||||
function FindCRC(data,datalen) {
|
||||
var i,j;
|
||||
var c;
|
||||
var CRC=0xFF;
|
||||
var genPoly = 0x07;
|
||||
for (j=0; j<datalen; j++)
|
||||
{
|
||||
c = data[j];
|
||||
CRC ^= c;
|
||||
for(i = 0; i<8; i++)
|
||||
if(CRC & 0x80 )
|
||||
CRC = (CRC << 1) ^ genPoly;
|
||||
else
|
||||
CRC <<= 1;
|
||||
CRC &= 0xff;
|
||||
}
|
||||
return CRC;
|
||||
}
|
||||
|
||||
function writeEEPROMbyte_byteaddress(byte, address, record)
|
||||
{
|
||||
record[address] = byte;
|
||||
}
|
||||
|
||||
function writeEEPROMbyte_wordaddress(byte, address, record)
|
||||
{
|
||||
record[address*2] = byte;
|
||||
}
|
||||
|
||||
function writeEEPROMword_wordaddress(word, address, record)
|
||||
{//little endian word storage!
|
||||
record[ address*2 ] = word&0xFF;
|
||||
record[1 + (address*2)] = (word>>8) & 0xFF;
|
||||
}
|
||||
|
||||
function writeEEPROMDword_wordaddress(word, address, record)
|
||||
{//little endian word storage!
|
||||
record[ address*2 ] = word&0xFF;
|
||||
record[1 + (address*2)] = (word>>8) & 0xFF;
|
||||
record[2 + (address*2)] = (word>>16) & 0xFF;
|
||||
record[3 + (address*2)] = (word>>24) & 0xFF;
|
||||
}
|
||||
|
||||
/** takes bytes array and count, returns ConfigData string */
|
||||
function getConfigDataString(record, esc) {
|
||||
const configdata_bytecount = new Set(configOnReservedBytes).has(esc) ? 14 : 7;
|
||||
|
||||
var configdata = '';
|
||||
for (var bytecount = 0; bytecount < configdata_bytecount; bytecount++) {
|
||||
configdata += (record[bytecount] + 0x100).toString(16).slice(-2).toUpperCase();
|
||||
}
|
||||
return configdata;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,95 @@
|
||||
/**
|
||||
* SOES EEPROM generator
|
||||
* ecat_options.h code generation logic
|
||||
|
||||
* This tool serves as:
|
||||
- EtherCAT Slave Information XML + EEPROM binary generator
|
||||
- SOES code generator
|
||||
|
||||
* Victor Sluiter 2013-2018
|
||||
* Kuba Buda 2020-2021
|
||||
*/
|
||||
'use strict'
|
||||
|
||||
// ####################### ecat_options.h generation ####################### //
|
||||
|
||||
function ecat_options_generator(form, od, indexes)
|
||||
{
|
||||
let ecat_options = '#ifndef __ECAT_OPTIONS_H__\n#define __ECAT_OPTIONS_H__\n\n#define USE_FOE 0\n#define USE_EOE 0\n\n';
|
||||
|
||||
//Mailbox size
|
||||
ecat_options += '#define MBXSIZE ' + parseInt(form.MailboxSize.value).toString()
|
||||
+ '\n#define MBXSIZEBOOT ' + parseInt(form.MailboxSize.value).toString()
|
||||
+ '\n#define MBXBUFFERS 3\n\n';
|
||||
//Mailbox 0 Config
|
||||
ecat_options += `#define MBX0_sma 0x${indexToString(form.RxMailboxOffset.value)}`
|
||||
+ '\n#define MBX0_sml MBXSIZE'
|
||||
+ '\n#define MBX0_sme MBX0_sma+MBX0_sml-1'
|
||||
+ '\n#define MBX0_smc 0x26\n';
|
||||
//Mailbox 1 Config
|
||||
ecat_options += `#define MBX1_sma MBX0_sma+MBX0_sml` //'0x${indexToString(form.TxMailboxOffset.value)}`;
|
||||
+ '\n#define MBX1_sml MBXSIZE'
|
||||
+ '\n#define MBX1_sme MBX1_sma+MBX1_sml-1'
|
||||
+ '\n#define MBX1_smc 0x22\n\n';
|
||||
// Mailbox boot configuration
|
||||
ecat_options += `#define MBX0_sma_b 0x${indexToString(form.RxMailboxOffset.value)}`
|
||||
+ '\n#define MBX0_sml_b MBXSIZEBOOT'
|
||||
+ '\n#define MBX0_sme_b MBX0_sma_b+MBX0_sml_b-1'
|
||||
+ '\n#define MBX0_smc_b 0x26\n';
|
||||
ecat_options += `#define MBX1_sma_b MBX0_sma_b+MBX0_sml_b` //'0x${indexToString(form.TxMailboxOffset.value)}`;
|
||||
+ '\n#define MBX1_sml_b MBXSIZEBOOT'
|
||||
+ '\n#define MBX1_sme_b MBX1_sma_b+MBX1_sml_b-1'
|
||||
+ '\n#define MBX1_smc_b 0x22\n\n';
|
||||
//SyncManager2 Config
|
||||
ecat_options += `#define SM2_sma 0x${indexToString(form.SM2Offset.value)}`
|
||||
+ '\n#define SM2_smc 0x24'
|
||||
+ '\n#define SM2_act 1\n';
|
||||
//SyncManager3 Config
|
||||
ecat_options += `#define SM3_sma 0x${indexToString(form.SM3Offset.value)}`
|
||||
+ '\n#define SM3_smc 0x20'
|
||||
+ '\n#define SM3_act 1\n\n';
|
||||
// Mappings config
|
||||
const MAX_MAPPINGS_SM2 = getMaxMappings(od, indexes, rxpdo);
|
||||
const MAX_MAPPINGS_SM3 = getMaxMappings(od, indexes, txpdo);
|
||||
ecat_options += `#define MAX_MAPPINGS_SM2 ${MAX_MAPPINGS_SM2}`
|
||||
+ `\n#define MAX_MAPPINGS_SM3 ${MAX_MAPPINGS_SM3}\n\n`
|
||||
// PDO buffer config
|
||||
ecat_options += '#define MAX_RXPDO_SIZE 512' // TODO calculate based on offset, size
|
||||
+ '\n#define MAX_TXPDO_SIZE 512\n\n'
|
||||
+ '#endif /* __ECAT_OPTIONS_H__ */\n';
|
||||
|
||||
return ecat_options;
|
||||
|
||||
function getMaxMappings(od, indexes, pdoName) {
|
||||
let result = 0;
|
||||
|
||||
indexes.forEach(index => {
|
||||
const objd = od[index];
|
||||
if(objd.pdo_mappings) {
|
||||
if(objd.items) {
|
||||
objd.items.slice(1).forEach(subitem => {
|
||||
objd.pdo_mappings.forEach(mapping => {
|
||||
if (mapping == pdoName) {
|
||||
++result;
|
||||
if (subitem.dtype == DTYPE.BOOLEAN) {
|
||||
++result; // boolean padding is mapping too
|
||||
// TODO handle array of booleans
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
} else if(objd.pdo_mappings) {
|
||||
objd.pdo_mappings.forEach(mapping => {
|
||||
if (mapping == pdoName) {
|
||||
++result;
|
||||
if (objd.dtype == DTYPE.BOOLEAN) {
|
||||
++result; // boolean padding is mapping too
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
};
|
||||
});
|
||||
return result;
|
||||
}
|
||||
}
|
||||
410
Pcb-1-lan9252/EEPROM_generator/src/generators/esi_xml.js
Normal file
410
Pcb-1-lan9252/EEPROM_generator/src/generators/esi_xml.js
Normal file
@@ -0,0 +1,410 @@
|
||||
/**
|
||||
* SOES EEPROM generator
|
||||
* ESI XML code generation logic
|
||||
|
||||
* This tool serves as:
|
||||
- EtherCAT Slave Information XML + EEPROM binary generator
|
||||
- SOES code generator
|
||||
|
||||
* Victor Sluiter 2013-2018
|
||||
* Kuba Buda 2020-2021
|
||||
*/
|
||||
'use strict'
|
||||
|
||||
// ####################### ESI.xml generating ####################### //
|
||||
|
||||
function esiDTbitsize(dtype) {
|
||||
return ESI_DT[dtype].bitsize;
|
||||
}
|
||||
|
||||
//See ETG2000 for ESI format
|
||||
function esi_generator(form, od, indexes, dc)
|
||||
{
|
||||
//VendorID
|
||||
var esi =`<?xml version="1.0" encoding="UTF-8"?>\n<EtherCATInfo>\n <Vendor>\n <Id>${parseInt(form.VendorID.value).toString()}</Id>\n`;
|
||||
//VendorName
|
||||
esi += ` <Name LcId="1033">${form.VendorName.value}</Name>\n </Vendor>\n <Descriptions>\n`;
|
||||
//Groups
|
||||
esi += ` <Groups>\n <Group>\n <Type>${form.TextGroupType.value}</Type>\n <Name LcId="1033">${form.TextGroupName5.value}</Name>\n </Group>\n </Groups>\n <Devices>\n`;
|
||||
//Physics
|
||||
esi += ` <Device Physics="${form.Port0Physical.value + form.Port1Physical.value + form.Port2Physical.value || + form.Port3Physical.value}">\n <Type ProductCode="#x${parseInt(form.ProductCode.value).toString(16)}" RevisionNo="#x${parseInt(form.RevisionNumber.value).toString(16)}">${form.TextDeviceType.value}</Type>\n`;
|
||||
//Add Name info
|
||||
esi += ` <Name LcId="1033">${form.TextDeviceName.value}</Name>\n`;
|
||||
//Add in between
|
||||
esi += ` <GroupType>${form.TextGroupType.value}</GroupType>\n`;
|
||||
//Add profile
|
||||
esi += ` <Profile>\n <ProfileNo>${form.ProfileNo.value}</ProfileNo>\n <AddInfo>0</AddInfo>\n <Dictionary>\n <DataTypes>`;
|
||||
const customTypes = {};
|
||||
const variableTypes = {};
|
||||
|
||||
function addVariableType(element) {
|
||||
if (element && element.otype && (element.otype != OTYPE.VAR && element.otype != OTYPE.ARRAY)) {
|
||||
alert(`${element.name} is not OTYPE VAR, cannot treat is as variable type`); return;
|
||||
}
|
||||
if (!element || !element.dtype) {
|
||||
alert(`${element.name} has no DTYPE, cannot treat is as variable type`); return;
|
||||
}
|
||||
let el_name = esiVariableTypeName(element);
|
||||
if (!variableTypes[el_name]) {
|
||||
const bitsize = (element.dtype == DTYPE.VISIBLE_STRING) ? esiBitsize(element) : esiDTbitsize(element.dtype);
|
||||
variableTypes[el_name] = bitsize;
|
||||
}
|
||||
}
|
||||
function addObjectDictionaryDataType(od, index) {
|
||||
const objd = od[index];
|
||||
const dtName = esiDtName(objd, index);
|
||||
var result = '';
|
||||
|
||||
if (objd.otype == OTYPE.VAR) {
|
||||
addVariableType(objd); // variable types will have to be be done later anyway, add to that queue
|
||||
} else if (!customTypes[dtName]) {
|
||||
// generate data types code for complex objects
|
||||
const bitsize = esiBitsize(objd);
|
||||
customTypes[dtName] = true;
|
||||
result += `\n <DataType>`;
|
||||
|
||||
let flags = `\n <Access>ro</Access>`; // PDO assign flags for variables are set in dictionary objects section
|
||||
if (objd.otype == OTYPE.ARRAY) {
|
||||
addVariableType(objd); // queue variable type to add after array code is generated
|
||||
let esi_type = ESI_DT[objd.dtype];
|
||||
let arr_bitsize = (objd.items.length - 1) * esi_type.bitsize
|
||||
result += `\n <Name>${dtName}ARR</Name>\n <BaseType>${esi_type.name}</BaseType>\n <BitSize>${arr_bitsize}</BitSize>`;
|
||||
result += `\n <ArrayInfo>\n <LBound>1</LBound>\n <Elements>${objd.items.length - 1}</Elements>\n </ArrayInfo>`;
|
||||
result += `\n </DataType>`;
|
||||
result += `\n <DataType>`;
|
||||
}
|
||||
result += `\n <Name>${dtName}</Name>\n <BitSize>${bitsize}</BitSize>`;
|
||||
result += `\n <SubItem>\n <SubIdx>0</SubIdx>\n <Name>Max SubIndex</Name>\n <Type>USINT</Type>`
|
||||
+ `\n <BitSize>8</BitSize>\n <BitOffs>0</BitOffs>\n <Flags>${flags}\n </Flags>\n </SubItem>`;
|
||||
|
||||
flags += getPdoMappingFlags(objd); // PDO assign flags for composite type
|
||||
|
||||
switch (objd.otype) {
|
||||
case OTYPE.ARRAY: {
|
||||
let arr_bitsize = (objd.items.length - 1) * esiDTbitsize(objd.dtype);
|
||||
result += `\n <SubItem>\n <Name>Elements</Name>\n <Type>${dtName}ARR</Type>\n <BitSize>${arr_bitsize}</BitSize>`
|
||||
+`\n <BitOffs>16</BitOffs>\n <Flags>${flags}\n </Flags>\n </SubItem>`;
|
||||
break;
|
||||
} case OTYPE.RECORD: {
|
||||
let subindex = 0;
|
||||
let bits_offset = 16;
|
||||
objd.items.forEach(subitem => {
|
||||
if (subindex > 0) { // skipped Max Subindex
|
||||
addVariableType(subitem); // cannot add variable type now that record code is being generated
|
||||
let subitem_dtype = ESI_DT[subitem.dtype];
|
||||
let subitem_bitsize = subitem_dtype.bitsize
|
||||
const subitemFlags = getSubitemFlags(objd, subitem);
|
||||
result += `\n <SubItem>\n <SubIdx>${subindex}</SubIdx>\n <Name>${subitem.name}</Name>`
|
||||
+ `\n <Type>${subitem_dtype.name}</Type>\n <BitSize>${subitem_bitsize}</BitSize>\n <BitOffs>${bits_offset}</BitOffs>`
|
||||
+ `\n <Flags>${subitemFlags}\n </Flags>`
|
||||
+ `\n </SubItem>`;
|
||||
bits_offset += subitem_bitsize;
|
||||
}
|
||||
subindex++;
|
||||
});
|
||||
break;
|
||||
} default: {
|
||||
alert(`Object ${index} "${objd.name}" has unexpected OTYPE ${objd.otype}`);
|
||||
alert;
|
||||
}}
|
||||
result += `\n </DataType>`;
|
||||
}
|
||||
|
||||
return result;
|
||||
|
||||
function getSubitemFlags(objd, subitem) {
|
||||
let access = 'ro';
|
||||
let modifier = '';
|
||||
if (subitem.access) {
|
||||
access = subitem.access.slice(0,2).toLowerCase();
|
||||
modifier = ' WriteRestrictions="PreOP"';
|
||||
}
|
||||
let flags = `\n <Access${modifier}>${access}</Access>`; // PDO assign flags for variables are set in dictionary objects section
|
||||
flags += getPdoMappingFlags(objd); // PDO assign flags for composite type
|
||||
return flags;
|
||||
}
|
||||
}
|
||||
// Add objects dictionary data types
|
||||
indexes.forEach(index => { esi += addObjectDictionaryDataType(od, index); });
|
||||
// Add variable type
|
||||
Object.entries(variableTypes).forEach(variableType => {
|
||||
esi += `\n <DataType>`;
|
||||
esi += `\n <Name>${variableType[0]}</Name>\n <BitSize>${variableType[1]}</BitSize>`;
|
||||
esi += `\n </DataType>`;
|
||||
});
|
||||
esi += `\n </DataTypes>\n <Objects>`;
|
||||
// Add objects dictionary
|
||||
function addDictionaryObject(od, index) {
|
||||
const objd = od[index];
|
||||
const el_dtype = esiDtName(objd, index);
|
||||
const bitsize = esiBitsize(objd);
|
||||
let result = `\n <Object>\n <Index>#x${index}</Index>\n <Name>${objd.name}</Name>\n <Type>${el_dtype}</Type>\n <BitSize>${bitsize}</BitSize>\n <Info>`;
|
||||
if (objd.data) {
|
||||
if (objd.dtype == DTYPE.VISIBLE_STRING) {
|
||||
result += `\n <DefaultString>${objd.data}</DefaultString>`;
|
||||
}
|
||||
}
|
||||
if (objd.value) {
|
||||
result += `\n <DefaultValue>${toEsiHexValue(objd.value)}</DefaultValue>`;
|
||||
}
|
||||
//Add object subitems for complex types
|
||||
if (objd.items) {
|
||||
result += addDictionaryObjectSubitems(objd.items);
|
||||
}
|
||||
|
||||
var flags = `\n <Access>ro</Access>`;
|
||||
if (objd.otype == OTYPE.VAR) {
|
||||
flags += getPdoMappingFlags(objd);
|
||||
}
|
||||
if (SDO_category[index]) {
|
||||
flags += `\n <Category>${SDO_category[index]}</Category>`;
|
||||
}
|
||||
result += `\n </Info>\n <Flags>${flags}\n </Flags>\n </Object>`;
|
||||
return result;
|
||||
|
||||
function addDictionaryObjectSubitems(element_items) {
|
||||
const max_subindex_value = element_items.length - 1;
|
||||
var result = ""
|
||||
let subindex = 0;
|
||||
element_items.forEach(subitem => {
|
||||
var defaultValue = (subindex > 0) ? subitem.value : max_subindex_value;
|
||||
result += `\n <SubItem>\n <Name>${subitem.name}</Name>\n <Info>\n <DefaultValue>${toEsiHexValue(defaultValue)}</DefaultValue>\n </Info>\n </SubItem>`;
|
||||
subindex++;
|
||||
});
|
||||
return result;
|
||||
}
|
||||
}
|
||||
indexes.forEach(index => { esi += addDictionaryObject(od, index); });
|
||||
const is_rxpdo = isPdoWithVariables(od, indexes, rxpdo);
|
||||
const is_txpdo = isPdoWithVariables(od, indexes, txpdo);
|
||||
|
||||
esi += `\n </Objects>\n </Dictionary>\n </Profile>\n <Fmmu>Outputs</Fmmu>\n <Fmmu>Inputs</Fmmu>\n <Fmmu>MBoxState</Fmmu>\n`;
|
||||
//Add Rxmailbox sizes
|
||||
esi += ` <Sm DefaultSize="${parseInt(form.MailboxSize.value).toString(10)}" StartAddress="#x${indexToString(form.RxMailboxOffset.value)}" ControlByte="#x26" Enable="1">MBoxOut</Sm>\n`;
|
||||
//Add Txmailbox sizes
|
||||
esi += ` <Sm DefaultSize="${parseInt(form.MailboxSize.value).toString(10)}" StartAddress="#x${indexToString(form.TxMailboxOffset.value)}" ControlByte="#x22" Enable="1">MBoxIn</Sm>\n`;
|
||||
//Add SM2
|
||||
esi += ` <Sm StartAddress="#x${indexToString(form.SM2Offset.value)}" ControlByte="#x24" Enable="${is_rxpdo ? 1 : 0}">Outputs</Sm>\n`;
|
||||
//Add SM3
|
||||
esi += ` <Sm StartAddress="#x${indexToString(form.SM3Offset.value)}" ControlByte="#x20" Enable="${is_txpdo ? 1 : 0}">Inputs</Sm>\n`;
|
||||
if (is_rxpdo) {
|
||||
var memOffset = getSM2_MappingOffset(form);
|
||||
indexes.forEach(index => {
|
||||
const objd = od[index];
|
||||
|
||||
if (isInArray(objd.pdo_mappings, rxpdo)) {
|
||||
esi += addEsiDevicePDO(objd, index, rxpdo, memOffset);
|
||||
++memOffset;
|
||||
}
|
||||
});
|
||||
}
|
||||
if (is_txpdo) {
|
||||
var memOffset = form.SM3Offset.value;
|
||||
indexes.forEach(index => {
|
||||
const objd = od[index];
|
||||
if (isInArray(objd.pdo_mappings, txpdo)) {
|
||||
esi += addEsiDevicePDO(objd, index, txpdo, memOffset);
|
||||
++memOffset;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//Add Mailbox DLL
|
||||
esi += ` <Mailbox DataLinkLayer="true">\n <CoE ${getCoEString(form)}/>\n </Mailbox>\n`;
|
||||
//Add DCs
|
||||
esi += getEsiDCsection(dc);
|
||||
//Add EEPROM
|
||||
const configdata = hex_generator(form, true);
|
||||
esi +=` <Eeprom>\n <ByteSize>${parseInt(form.EEPROMsize.value)}</ByteSize>\n <ConfigData>${configdata}</ConfigData>\n </Eeprom>\n`;
|
||||
//Close all items
|
||||
esi +=` </Device>\n </Devices>\n </Descriptions>\n</EtherCATInfo>`;
|
||||
|
||||
return esi;
|
||||
|
||||
function addEsiDevicePDO(objd, index, pdo, memOffset) {
|
||||
var esi = '';
|
||||
const PdoName = pdo[0].toUpperCase();
|
||||
const SmNo = (pdo == txpdo) ? 3 : 2;
|
||||
const memoryOffset = indexToString(memOffset);
|
||||
esi += ` <${PdoName}xPdo Fixed="true" Mandatory="true" Sm="${SmNo}">\n <Index>#x${memoryOffset}</Index>\n <Name>${objd.name}</Name>`;
|
||||
var subindex = 0;
|
||||
switch (objd.otype) {
|
||||
case OTYPE.VAR: {
|
||||
const esiType = esiVariableTypeName(objd);
|
||||
const bitsize = esiDTbitsize(objd.dtype);
|
||||
esi += `\n <Entry>\n <Index>#x${index}</Index>\n <SubIndex>#x${subindex.toString(16)}</SubIndex>\n <BitLen>${bitsize}</BitLen>\n <Name>${objd.name}</Name>\n <DataType>${esiType}</DataType>\n </Entry>`;
|
||||
esi += pdoBooleanPadding(objd);
|
||||
break;
|
||||
}
|
||||
case OTYPE.ARRAY: {
|
||||
const esiType = esiVariableTypeName(objd);
|
||||
const bitsize = esiDTbitsize(objd.dtype);
|
||||
subindex = 1; // skip 'Max subindex'
|
||||
objd.items.slice(subindex).forEach(subitem => {
|
||||
esi += `\n <Entry>\n <Index>#x${index}</Index>\n <SubIndex>#x${subindex.toString(16)}</SubIndex>\n <BitLen>${bitsize}</BitLen>\n <Name>${subitem.name}</Name>\n <DataType>${esiType}</DataType>\n </Entry>`;
|
||||
// TODO handle padding for array of booleans
|
||||
++subindex;
|
||||
});
|
||||
break;
|
||||
}
|
||||
case OTYPE.RECORD: {
|
||||
subindex = 1; // skip 'Max subindex'
|
||||
objd.items.slice(subindex).forEach(subitem => {
|
||||
const esiType = esiVariableTypeName(subitem);
|
||||
const bitsize = esiDTbitsize(subitem.dtype);
|
||||
esi += `\n <Entry>\n <Index>#x${index}</Index>\n <SubIndex>#x${subindex.toString(16)}</SubIndex>\n <BitLen>${bitsize}</BitLen>\n <Name>${subitem.name}</Name>\n <DataType>${esiType}</DataType>\n </Entry>`;
|
||||
esi += pdoBooleanPadding(subitem);
|
||||
++subindex;
|
||||
});
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
alert(`Unexpected OTYPE ${objd.otype} for ${index} ${objd.name} in ESI ${PdoName}PDOs`);
|
||||
break;
|
||||
}}
|
||||
esi += `\n </${PdoName}xPdo>\n`;
|
||||
|
||||
return esi;
|
||||
|
||||
function pdoBooleanPadding(item) {
|
||||
if (item.dtype == DTYPE.BOOLEAN) {
|
||||
return `\n <Entry>\n <Index>${0}</Index>\n <SubIndex>${0}</SubIndex>\n <BitLen>${7}</BitLen>\n </Entry>`;
|
||||
}
|
||||
return ``;
|
||||
}
|
||||
}
|
||||
|
||||
function toEsiHexValue(value) {
|
||||
if (!value) {
|
||||
return 0;
|
||||
}
|
||||
if (value.startsWith && value.startsWith('0x')) {
|
||||
value = `#x${value.slice(2)}`;
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
function getPdoMappingFlags(item) {
|
||||
var flags = '';
|
||||
if (item.pdo_mappings) {
|
||||
if (item.pdo_mappings.length > 1) {
|
||||
alert(`Object ${index} "${objd.name}" has multiple PDO mappings, that is not supported by this version of tool`
|
||||
+ `, only first ${pdoMappingFlag}XPDO will be used`);
|
||||
}
|
||||
const pdoMappingFlag = item.pdo_mappings[0].slice(0,1).toUpperCase();
|
||||
flags += `\n <PdoMapping>${pdoMappingFlag}</PdoMapping>`;
|
||||
}
|
||||
return flags;
|
||||
}
|
||||
|
||||
function getEsiDCsection(dc) {
|
||||
if (!dc) {
|
||||
return '';
|
||||
}
|
||||
var dcSection = ' <Dc>';
|
||||
dc.forEach(opMode => {
|
||||
dcSection += `\n <OpMode>\n <Name>${opMode.Name}</Name>\n <Desc>${opMode.Description}</Desc>\n <AssignActivate>${opMode.AssignActivate}</AssignActivate>`;
|
||||
if (opMode.Sync0cycleTime && opMode.Sync0cycleTime != 0) {
|
||||
dcSection += `\n <CycleTimeSync0>${opMode.Sync0cycleTime}</CycleTimeSync0>`;
|
||||
}
|
||||
if (opMode.Sync0shiftTime && opMode.Sync0shiftTime != 0) {
|
||||
dcSection += `\n <ShiftTimeSync0>${opMode.Sync0shiftTime}</ShiftTimeSync0>`;
|
||||
}
|
||||
if (opMode.Sync1cycleTime && opMode.Sync1cycleTime != 0) {
|
||||
dcSection += `\n <CycleTimeSync1>${opMode.Sync1cycleTime}</CycleTimeSync1>`;
|
||||
}
|
||||
if (opMode.Sync1shiftTime && opMode.Sync1shiftTime != 0) {
|
||||
dcSection += `\n <ShiftTimeSync1>${opMode.Sync1shiftTime}</ShiftTimeSync1>`;
|
||||
}
|
||||
dcSection += `\n </OpMode>`;
|
||||
});
|
||||
dcSection += `\n </Dc>\n`;
|
||||
|
||||
return dcSection;
|
||||
}
|
||||
|
||||
//See Table 40 ETG2000
|
||||
function getCoEString(form)
|
||||
{
|
||||
var result = ""
|
||||
// if(form.CoeDetailsEnableSDO.checked)
|
||||
// result += 'SdoInfo="true" ';
|
||||
// else
|
||||
// result += 'SdoInfo="false" ';
|
||||
if(form.CoeDetailsEnableSDOInfo.checked)
|
||||
result += 'SdoInfo="true" ';
|
||||
else
|
||||
result += 'SdoInfo="false" ';
|
||||
if(form.CoeDetailsEnablePDOAssign.checked)
|
||||
result += 'PdoAssign="true" ';
|
||||
else
|
||||
result += 'PdoAssign="false" ';
|
||||
if(form.CoeDetailsEnablePDOConfiguration.checked)
|
||||
result += 'PdoConfig="true" ';
|
||||
else
|
||||
result += 'PdoConfig="false" ';
|
||||
if(form.CoeDetailsEnableUploadAtStartup.checked)
|
||||
result += 'PdoUpload="true" ';
|
||||
else
|
||||
result += 'PdoUpload="false" ';
|
||||
if(form.CoeDetailsEnableSDOCompleteAccess.checked)
|
||||
result += 'CompleteAccess="true" ';
|
||||
else
|
||||
result +='CompleteAccess="false" ';
|
||||
return result;
|
||||
}
|
||||
|
||||
function esiVariableTypeName(element) {
|
||||
let el_name = ESI_DT[element.dtype].name;
|
||||
if (element.dtype == DTYPE.VISIBLE_STRING) {
|
||||
return `${el_name}(${element.data.length})`;
|
||||
}
|
||||
return el_name;
|
||||
}
|
||||
|
||||
function esiDtName(element, index) {
|
||||
switch (element.otype) {
|
||||
case OTYPE.VAR:
|
||||
return esiVariableTypeName(element);
|
||||
case OTYPE.ARRAY:
|
||||
case OTYPE.RECORD:
|
||||
return `DT${index}`;
|
||||
default:
|
||||
alert(`Element 0x${index} has unexpected OTYPE ${element.otype}`);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
function esiBitsize(element) {
|
||||
switch (element.otype) {
|
||||
case OTYPE.VAR: {
|
||||
let bitsize = esiDTbitsize(element.dtype);
|
||||
if (element.dtype == DTYPE.VISIBLE_STRING) {
|
||||
return bitsize * element.data.length;
|
||||
}
|
||||
return bitsize;
|
||||
}
|
||||
case OTYPE.ARRAY: {
|
||||
const maxsubindex_bitsize = esiDTbitsize(DTYPE.UNSIGNED8);
|
||||
let bitsize = esiDTbitsize(element.dtype);
|
||||
let elements = element.items.length - 1; // skip max subindex
|
||||
return maxsubindex_bitsize * 2 + elements * bitsize;
|
||||
}
|
||||
case OTYPE.RECORD: {
|
||||
const maxsubindex_bitsize = esiDTbitsize(DTYPE.UNSIGNED8);
|
||||
let bitsize = maxsubindex_bitsize * 2;
|
||||
for (let subindex = 1; subindex < element.items.length; subindex++) {
|
||||
const subitem = element.items[subindex];
|
||||
bitsize += esiDTbitsize(subitem.dtype);
|
||||
if(subitem.dtype == DTYPE.BOOLEAN) {
|
||||
bitsize += booleanPaddingBitsize;
|
||||
}
|
||||
}
|
||||
return bitsize;
|
||||
}
|
||||
default:
|
||||
alert(`Element ${element} has unexpected OTYPE ${element.otype}`);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
233
Pcb-1-lan9252/EEPROM_generator/src/generators/objectlist.js
Normal file
233
Pcb-1-lan9252/EEPROM_generator/src/generators/objectlist.js
Normal file
@@ -0,0 +1,233 @@
|
||||
/**
|
||||
* SOES EEPROM generator
|
||||
* objectlist.c code generation logic
|
||||
|
||||
* This tool serves as:
|
||||
- EtherCAT Slave Information XML + EEPROM binary generator
|
||||
- SOES code generator
|
||||
|
||||
* Victor Sluiter 2013-2018
|
||||
* Kuba Buda 2020-2021
|
||||
*/
|
||||
'use strict'
|
||||
|
||||
// ####################### Objectlist.c generating ####################### //
|
||||
|
||||
function get_objdBitsize(element) {
|
||||
let bitsize = dtype_bitsize[element.dtype];
|
||||
if (element.dtype == DTYPE.VISIBLE_STRING) {
|
||||
bitsize = bitsize * element.data.length;
|
||||
}
|
||||
return bitsize;
|
||||
}
|
||||
|
||||
|
||||
/** Takes object dictionary item from sdo, rxpdo or txpdo section
|
||||
* Adds objd.data that is displayed in objectlist.c
|
||||
* and links to OD variable declared on OD struct in utypes.h
|
||||
*/
|
||||
function objectlist_link_utypes(objd) {
|
||||
switch (objd.otype) {
|
||||
case OTYPE.VAR: {
|
||||
objd.data = objectlist_VAR_data(objd);
|
||||
break;
|
||||
}
|
||||
case OTYPE.ARRAY: {
|
||||
var subindex = 1;
|
||||
objd.items.slice(subindex).forEach(subitem => {
|
||||
subitem.data = objectlist_ARRAY_data(objd, subindex);
|
||||
++subindex;
|
||||
});
|
||||
break;
|
||||
}
|
||||
case OTYPE.RECORD: {
|
||||
var subindex = 1;
|
||||
objd.items.slice(subindex).forEach(subitem => {
|
||||
subitem.data = objectlist_RECORD_data(objd, subitem);
|
||||
++subindex;
|
||||
});
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
function objectlist_VAR_data(objd) {
|
||||
return `&Obj.${variableName(objd.name)}`;
|
||||
}
|
||||
|
||||
function objectlist_ARRAY_data(objd, subindex) {
|
||||
return `&Obj.${variableName(objd.name)}[${subindex - 1}]`;
|
||||
}
|
||||
|
||||
function objectlist_RECORD_data(objd, subitem) {
|
||||
return `&Obj.${variableName(objd.name)}.${variableName(subitem.name)}`;
|
||||
}
|
||||
}
|
||||
|
||||
function objectlist_generator(form, od, indexes)
|
||||
{
|
||||
var objectlist = '#include "esc_coe.h"\n#include "utypes.h"\n#include <stddef.h>\n\n';
|
||||
|
||||
//Variable names
|
||||
indexes.forEach(index => {
|
||||
const objd = od[index];
|
||||
objectlist += objectlist_variableName(index, objd);
|
||||
|
||||
});
|
||||
objectlist += '\n';
|
||||
//SDO objects declaration
|
||||
indexes.forEach(index => {
|
||||
const objd = od[index];
|
||||
objectlist += objectlist_SdoObjectDeclaration(index, objd);
|
||||
})
|
||||
|
||||
objectlist += '\n\nconst _objectlist SDOobjects[] =\n{';
|
||||
//SDO object dictionary declaration
|
||||
indexes.forEach(index => {
|
||||
const objd = od[index];
|
||||
objectlist += objectlist_DictionaryDeclaration(index, objd);
|
||||
})
|
||||
objectlist += '\n {0xffff, 0xff, 0xff, 0xff, NULL, NULL}\n};\n';
|
||||
|
||||
return objectlist;
|
||||
|
||||
function objectlist_variableName(index, objd) {
|
||||
var objectlist = `\nstatic const char acName${index}[] = "${objd.name}";`;
|
||||
switch (objd.otype) {
|
||||
case OTYPE.VAR:
|
||||
break;
|
||||
case OTYPE.ARRAY:
|
||||
case OTYPE.RECORD:
|
||||
for (let subindex = 0; subindex < objd.items.length; subindex++) {
|
||||
const item = objd.items[subindex];
|
||||
objectlist += `\nstatic const char acName${index}_${subindex_padded(subindex)}[] = "${item.name}";`;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
alert("Unexpected object type in object dictionary: ", objd)
|
||||
break;
|
||||
};
|
||||
return objectlist;
|
||||
}
|
||||
|
||||
function objectlist_SdoObjectDeclaration(index, objd) {
|
||||
var objectlist = `\nconst _objd SDO${index}[] =\n{`;
|
||||
|
||||
switch (objd.otype) {
|
||||
case OTYPE.VAR: {
|
||||
const value = objectlist_getItemValue(objd, objd.dtype);
|
||||
objectlist += `\n {0x0, DTYPE_${objd.dtype}, ${get_objdBitsize(objd)}, ${objectlist_objdFlags(objd)}, acName${index}, ${value}, ${objeclist_objdData(objd)}},`;
|
||||
break;
|
||||
}
|
||||
case OTYPE.ARRAY: {
|
||||
objectlist += `\n {0x00, DTYPE_${DTYPE.UNSIGNED8}, ${8}, ATYPE_RO, acName${index}_00, ${objd.items.length - 1}, NULL},`; // max subindex
|
||||
const bitsize = dtype_bitsize[objd.dtype]; /* TODO what if it is array of strings? */
|
||||
let subindex = 1;
|
||||
objd.items.slice(subindex).forEach(subitem => {
|
||||
var subi = subindex_padded(subindex);
|
||||
const value = objectlist_getItemValue(subitem, objd.dtype);
|
||||
objectlist += `\n {0x${subi}, DTYPE_${objd.dtype}, ${bitsize}, ${objectlist_objdFlags(objd)}, acName${index}_${subi}, ${value}, ${subitem.data || 'NULL'}},`;
|
||||
subindex++;
|
||||
});
|
||||
break;
|
||||
}
|
||||
case OTYPE.RECORD: {
|
||||
objectlist += `\n {0x00, DTYPE_${DTYPE.UNSIGNED8}, ${8}, ATYPE_RO, acName${index}_00, ${objd.items.length - 1}, NULL},`; // max subindex
|
||||
let subindex = 1;
|
||||
objd.items.slice(subindex).forEach(subitem => {
|
||||
var subi = subindex_padded(subindex);
|
||||
const bitsize = dtype_bitsize[subitem.dtype];
|
||||
const value = objectlist_getItemValue(subitem, subitem.dtype);
|
||||
const atypeflag = objectlist_objdFlags(subitem);
|
||||
objectlist += `\n {0x${subi}, DTYPE_${subitem.dtype}, ${bitsize}, ${atypeflag}, acName${index}_${subi}, ${value}, ${subitem.data || 'NULL'}},`;
|
||||
subindex++;
|
||||
});
|
||||
|
||||
break;
|
||||
}
|
||||
default:
|
||||
alert("Unexpected object type om object dictionary");
|
||||
break;
|
||||
};
|
||||
objectlist += '\n};';
|
||||
|
||||
return objectlist;
|
||||
}
|
||||
|
||||
function objectlist_DictionaryDeclaration(index, objd) {
|
||||
var objectlist = ``;
|
||||
switch (objd.otype) {
|
||||
case OTYPE.VAR:
|
||||
case OTYPE.ARRAY:
|
||||
case OTYPE.RECORD:
|
||||
let maxsubindex = 0;
|
||||
if (objd.items) {
|
||||
maxsubindex = objd.items.length - 1;
|
||||
}
|
||||
objectlist += `\n {0x${index}, OTYPE_${objd.otype}, ${maxsubindex}, ${objd.pad1 || 0}, acName${index}, SDO${index}},`;
|
||||
break;
|
||||
default:
|
||||
alert("Unexpected object type om object dictionary")
|
||||
break;
|
||||
};
|
||||
return objectlist;
|
||||
}
|
||||
|
||||
function float32ToHex(float32) {
|
||||
// made by: Jozo132 (https://github.com/Jozo132)
|
||||
const getHex = i => ('00' + i.toString(16)).slice(-2);
|
||||
var view = new DataView(new ArrayBuffer(4))
|
||||
view.setFloat32(0, float32);
|
||||
return Array.apply(null, { length: 4 }).map((_, i) => getHex(view.getUint8(i))).join('');
|
||||
}
|
||||
|
||||
function objectlist_getItemValue(item, dtype) {
|
||||
let value = '0';
|
||||
if (item.value) {
|
||||
value = `${item.value}`;
|
||||
if (dtype == DTYPE.REAL32) {
|
||||
return `0x${float32ToHex(value)}`;
|
||||
}
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
function subindex_padded(subindex) {
|
||||
// pad with 0 if single digit
|
||||
if (subindex > 9) {
|
||||
return `${subindex}`;
|
||||
}
|
||||
return `0${subindex}`;
|
||||
}
|
||||
|
||||
/** Gets flags for objectlist item:
|
||||
*
|
||||
* ATYPE: access type (RO/RW/WO/RWpre)
|
||||
*
|
||||
* PDO mappings */
|
||||
function objectlist_objdFlags(element) {
|
||||
let flags = "ATYPE_RO"; // RO by default
|
||||
if (element.access) {
|
||||
flags = `ATYPE_${element.access}`;
|
||||
}
|
||||
|
||||
if (element.pdo_mappings) {
|
||||
element.pdo_mappings .forEach(mapping => {
|
||||
flags = `${flags} | ATYPE_${mapping.toUpperCase()}`;
|
||||
});
|
||||
}
|
||||
return flags;
|
||||
}
|
||||
|
||||
function objeclist_objdData(element) {
|
||||
let el_data = 'NULL';
|
||||
|
||||
if (element.data) {
|
||||
el_data = element.data;
|
||||
if (element.dtype == DTYPE.VISIBLE_STRING) {
|
||||
el_data = `"${element.data}"`;
|
||||
}
|
||||
}
|
||||
/* TODO el_data is assigned also for PDO mapped variables */
|
||||
return el_data;
|
||||
}
|
||||
}
|
||||
88
Pcb-1-lan9252/EEPROM_generator/src/generators/utypes.js
Normal file
88
Pcb-1-lan9252/EEPROM_generator/src/generators/utypes.js
Normal file
@@ -0,0 +1,88 @@
|
||||
/**
|
||||
* SOES EEPROM generator
|
||||
* utypes.h code generation logic
|
||||
|
||||
* This tool serves as:
|
||||
- EtherCAT Slave Information XML + EEPROM binary generator
|
||||
- SOES code generator
|
||||
|
||||
* Victor Sluiter 2013-2018
|
||||
* Kuba Buda 2020-2021
|
||||
*/
|
||||
'use strict'
|
||||
|
||||
// ####################### utypes.h generation ####################### //
|
||||
|
||||
function utypes_generator(form, od, indexes) {
|
||||
var utypes = '#ifndef __UTYPES_H__\n#define __UTYPES_H__\n\n#include "cc.h"\n\n/* Object dictionary storage */\n\ntypedef struct\n{\n /* Identity */\n'
|
||||
utypes += '\n uint32_t serial;\n';
|
||||
|
||||
var utypesInputs = '\n /* Inputs */\n';
|
||||
var utypesOutputs = '\n /* Outputs */\n';
|
||||
var hasInputs = isPdoWithVariables(od, indexes, txpdo);
|
||||
var hasOutputs = isPdoWithVariables(od, indexes, rxpdo);
|
||||
|
||||
indexes.forEach(index => {
|
||||
const objd = od[index];
|
||||
if (objd.pdo_mappings) {
|
||||
if(objd.pdo_mappings.length > 1) { alert(`${index} ${objd.name} Generating utypes.h for objects with multiple PDO mappings is not yet supported`); }
|
||||
|
||||
const line = getUtypesDeclaration(objd);
|
||||
|
||||
if (objd.pdo_mappings[0] == txpdo) {
|
||||
utypesInputs += line;
|
||||
} else {
|
||||
utypesOutputs += line;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
if (hasInputs) { utypes += utypesInputs + '\n'; }
|
||||
if (hasOutputs) { utypes += utypesOutputs + '\n'; }
|
||||
|
||||
var utypesOutputs = '\n /* Parameters */\n';
|
||||
var anyParameters = false;
|
||||
indexes.forEach(index => {
|
||||
const objd = od[index];
|
||||
if (objd.isSDOitem) {
|
||||
utypesOutputs += getUtypesDeclaration(objd);
|
||||
anyParameters = true;
|
||||
}
|
||||
});
|
||||
if (anyParameters) {
|
||||
utypes += utypesOutputs;
|
||||
}
|
||||
|
||||
utypes += '\n} _Objects;\n\nextern _Objects Obj;\n\n#endif /* __UTYPES_H__ */\n';
|
||||
|
||||
return utypes;
|
||||
|
||||
function getUtypesDeclaration(objd) {
|
||||
const varName = variableName(objd.name);
|
||||
switch (objd.otype) {
|
||||
case OTYPE.VAR: {
|
||||
const ctype = ESI_DT[objd.dtype].ctype;
|
||||
return `\n ${ctype} ${varName};`
|
||||
}
|
||||
case OTYPE.ARRAY: {
|
||||
const ctype = ESI_DT[objd.dtype].ctype;
|
||||
return `\n ${ctype} ${varName}[${objd.items.length - 1}];`
|
||||
}
|
||||
case OTYPE.RECORD: {
|
||||
var section = `\n struct\n {`;
|
||||
/* TODO test */
|
||||
objd.items.slice(1).forEach(subitem => {
|
||||
const subitemCType = ESI_DT[subitem.dtype].ctype;
|
||||
const subitemName = variableName(subitem.name);
|
||||
section += `\n ${subitemCType} ${subitemName};`
|
||||
});
|
||||
section += `\n } ${varName};`
|
||||
return section;
|
||||
}
|
||||
default: {
|
||||
alert(`Cannot generate utypes.h for object ${objd?.name} with has unexpected OTYPE ${objd?.otype}`);
|
||||
return '';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
363
Pcb-1-lan9252/EEPROM_generator/src/od.js
Normal file
363
Pcb-1-lan9252/EEPROM_generator/src/od.js
Normal file
@@ -0,0 +1,363 @@
|
||||
/**
|
||||
* SOES EEPROM generator
|
||||
* Object Dictionary edition logic
|
||||
|
||||
* This tool serves as:
|
||||
- EtherCAT Slave Information XML + EEPROM binary generator
|
||||
- SOES code generator
|
||||
|
||||
* Victor Sluiter 2013-2018
|
||||
* Kuba Buda 2020-2021
|
||||
*/
|
||||
'use strict'
|
||||
|
||||
/** Object Dictionary sections edited by UI
|
||||
* Assumption: single non dynamic PDO */
|
||||
const _odSections = {
|
||||
sdo : {},
|
||||
txpdo : {}, // addding PDO requires matching SDO in Sync Manager, and PDO mapping
|
||||
rxpdo : {}, // this will be done when stitching sections during code generation
|
||||
};
|
||||
|
||||
function getObjDict() {
|
||||
return _odSections;
|
||||
}
|
||||
|
||||
function getObjDictSection(odSectionName) {
|
||||
return _odSections[odSectionName];
|
||||
}
|
||||
|
||||
function setObjDictSection(odSectionName, backupValue) {
|
||||
_odSections[odSectionName] = backupValue;
|
||||
}
|
||||
|
||||
function objectExists(odSectionName, index) {
|
||||
var odSection = getObjDictSection(odSectionName);
|
||||
return index && odSection[index];
|
||||
}
|
||||
|
||||
function checkObjectType(expected, objd) {
|
||||
if (objd.otype != expected) {
|
||||
var msg = `Object ${objd.name} was expected to be OTYPE ${expected} but is ${objd.otype}`;
|
||||
alert(msg);
|
||||
throw new Exception(msg);
|
||||
}
|
||||
}
|
||||
|
||||
function addObject(od, objd, index) {
|
||||
if (od[index]) {
|
||||
alert(`Object ${objd.name} duplicates 0x${index}: ${od[index].name} !`);
|
||||
}
|
||||
od[index] = objd;
|
||||
}
|
||||
|
||||
function removeObject(od, index) {
|
||||
if (index) {
|
||||
if (od[index]) {
|
||||
delete od[index];
|
||||
} else {
|
||||
alert(`Cannot remove object 0x${index}: it does not exist`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function isInArray(array, seekValue) {
|
||||
return array && (array[0] == seekValue
|
||||
|| array.find(currentValue => currentValue == seekValue));
|
||||
}
|
||||
|
||||
function variableName(objectName) {
|
||||
const charsToReplace = [ ' ', '.', ',', ';', ':', '/' ];
|
||||
const charsToRemove = [ '+', '-', '*', '=', '!', '@' ];
|
||||
|
||||
var variableName = objectName;
|
||||
charsToReplace.forEach(c => {
|
||||
variableName = variableName.replaceAll(c, '_');
|
||||
});
|
||||
charsToRemove.forEach(c => {
|
||||
variableName = variableName.replaceAll(c, '');
|
||||
});
|
||||
return variableName;
|
||||
}
|
||||
|
||||
// ####################### Building Object Dictionary model ####################### //
|
||||
|
||||
/** Takes OD entries from UI SDO section and adds to given OD */
|
||||
function addSDOitems(od) {
|
||||
const sdoSection = getObjDictSection(sdo);
|
||||
const indexes = getUsedIndexes(sdoSection);
|
||||
|
||||
indexes.forEach(index => {
|
||||
const item = sdoSection[index];
|
||||
item.isSDOitem = true;
|
||||
objectlist_link_utypes(item);
|
||||
|
||||
addObject(od, item, index);
|
||||
});
|
||||
}
|
||||
/** Returns true if any object in given Object Dictionary has mapping to PDO with given name */
|
||||
function isPdoWithVariables(od, indexes, pdoName) {
|
||||
for (let i = 0; i < indexes.length; i++) {
|
||||
const index = indexes[i];
|
||||
const objd = od[index];
|
||||
if (isInArray(objd.pdo_mappings, pdoName)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
/** Regardles of value set, SDK was generating RXPDO mappings as SDO1600
|
||||
* This offset _can_ be changed, not sure why one would need it
|
||||
*/
|
||||
function getSM2_MappingOffset(form) {
|
||||
return parseInt(form.SM2Offset.value);
|
||||
}
|
||||
/** Takes OD entries from UI RXPDO section and adds to given OD */
|
||||
function addRXPDOitems(od) {
|
||||
const rxpdoSection = getObjDictSection(rxpdo);
|
||||
const form = getForm();
|
||||
const pdo = {
|
||||
name : rxpdo,
|
||||
SMassignmentIndex : '1C12',
|
||||
smOffset : getSM2_MappingOffset(form), // usually 0x1600
|
||||
};
|
||||
addPdoObjectsSection(od, rxpdoSection, pdo);
|
||||
}
|
||||
/** Takes OD entries from UI TXPDO section and adds to given OD */
|
||||
function addTXPDOitems(od) {
|
||||
const txpdoSection = getObjDictSection(txpdo);
|
||||
const form = getForm();
|
||||
const pdo = {
|
||||
name : txpdo,
|
||||
SMassignmentIndex : '1C13',
|
||||
smOffset : parseInt(form.SM3Offset.value), // usually 0x1A00
|
||||
};
|
||||
addPdoObjectsSection(od, txpdoSection, pdo);
|
||||
}
|
||||
|
||||
var _booleanPaddingCount = 0;
|
||||
/**
|
||||
* Takes OD entries from given UI SDO/PDO section and adds to given OD
|
||||
* using provided SM offset, and SM assignment address.
|
||||
|
||||
* Available sections are 'sdo', 'txpdo', 'rxpdo'
|
||||
*/
|
||||
function addPdoObjectsSection(od, odSection, pdo){
|
||||
var currentSMoffsetValue = pdo.smOffset;
|
||||
const indexes = getUsedIndexes(odSection);
|
||||
|
||||
if (indexes.length) {
|
||||
const pdoAssignments = ensurePDOAssignmentExists(od, pdo.SMassignmentIndex);
|
||||
|
||||
indexes.forEach(index => {
|
||||
const objd = odSection[index];
|
||||
const currentOffset = indexToString(currentSMoffsetValue)
|
||||
|
||||
const pdoMappingObj = { otype: OTYPE.RECORD, name: objd.name, items: [
|
||||
{ name: 'Max SubIndex' },
|
||||
]};
|
||||
// create PDO assignment to SM
|
||||
const pdoAssignment = { name: "PDO Mapping", value: `0x${currentOffset}` };
|
||||
addPdoMapping(objd, pdo.name);
|
||||
|
||||
objectlist_link_utypes(objd);
|
||||
|
||||
switch (objd.otype) {
|
||||
case OTYPE.VAR: {
|
||||
// create PDO mapping
|
||||
pdoMappingObj.items.push({ name: objd.name, dtype: DTYPE.UNSIGNED32, value: getPdoMappingValue(index, 0, objd.dtype) });
|
||||
if (objd.dtype == DTYPE.BOOLEAN) {
|
||||
addBooleanPadding(pdoMappingObj.items, ++_booleanPaddingCount);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case OTYPE.ARRAY: {
|
||||
var subindex = 1;
|
||||
objd.items.slice(subindex).forEach(subitem => {
|
||||
// create PDO mappings
|
||||
pdoMappingObj.items.push({ name: subitem.name, dtype: DTYPE.UNSIGNED32, value: getPdoMappingValue(index, subindex , objd.dtype) });
|
||||
// TODO handle padding on array of booleans
|
||||
++subindex;
|
||||
});
|
||||
break;
|
||||
}
|
||||
case OTYPE.RECORD: {
|
||||
var subindex = 1;
|
||||
objd.items.slice(subindex).forEach(subitem => {
|
||||
// create PDO mappings
|
||||
pdoMappingObj.items.push({ name: subitem.name, dtype: DTYPE.UNSIGNED32, value: getPdoMappingValue(index, subindex , subitem.dtype) });
|
||||
if (subitem.dtype == DTYPE.BOOLEAN) {
|
||||
addBooleanPadding(pdoMappingObj.items, ++_booleanPaddingCount);
|
||||
}
|
||||
++subindex;
|
||||
});
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
alert(`${pdoMappingValue} object ${index} ${objd.name} has unexpected object type ${objd.otype}!`);
|
||||
break;
|
||||
}}
|
||||
|
||||
addObject(od, pdoMappingObj, currentOffset);
|
||||
pdoAssignments.items.push(pdoAssignment);
|
||||
|
||||
addObject(od, objd, index);
|
||||
|
||||
++currentSMoffsetValue;
|
||||
});
|
||||
|
||||
function addBooleanPadding(mappingOjbItems, paddingCount) {
|
||||
mappingOjbItems.push({ name: `Padding ${paddingCount}`, dtype: DTYPE.UNSIGNED32, value: `0x0000000${booleanPaddingBitsize}` });
|
||||
}
|
||||
}
|
||||
|
||||
function addPdoMapping(objd, pdoName) {
|
||||
// make sure there is space
|
||||
if (!objd.pdo_mappings) {
|
||||
objd.pdo_mappings = [];
|
||||
}
|
||||
// mark object as PDO mapped, if it is not already
|
||||
if(!isInArray(objd.pdo_mappings, pdoName)) {
|
||||
objd.pdo_mappings.push(pdoName);
|
||||
}
|
||||
}
|
||||
|
||||
function ensurePDOAssignmentExists(od, index) {
|
||||
var pdoAssignments = od[index];
|
||||
if (!pdoAssignments) {
|
||||
pdoAssignments = { otype: OTYPE.ARRAY, dtype: DTYPE.UNSIGNED16, name: `Sync Manager ${index[3]} PDO Assignment`, items: [
|
||||
{ name: 'Max SubIndex' },
|
||||
]};
|
||||
od[index] = pdoAssignments;
|
||||
}
|
||||
return pdoAssignments;
|
||||
}
|
||||
|
||||
function getPdoMappingValue(index, subindex, dtype) {
|
||||
function toByte(value) {
|
||||
var result = value.toString(16).slice(0, 2);
|
||||
while (result.length < 2) {
|
||||
result = `0${result}`;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
var bitsize = esiDTbitsize(dtype);
|
||||
|
||||
return `0x${index}${toByte(subindex)}${toByte(bitsize)}`;
|
||||
}
|
||||
}
|
||||
/** populates mandatory objects with values from UI */
|
||||
function populateMandatoryObjectValues(form, od) {
|
||||
if (form) {
|
||||
od['1008'].data = form.TextDeviceName.value;
|
||||
od['1009'].data = form.HWversion.value;
|
||||
od['100A'].data = form.SWversion.value;
|
||||
od['1018'].items[1].value = parseInt(form.VendorID.value);
|
||||
od['1018'].items[2].value = parseInt(form.ProductCode.value);
|
||||
od['1018'].items[3].value = parseInt(form.RevisionNumber.value);
|
||||
od['1018'].items[4].value = parseInt(form.SerialNumber.value);
|
||||
}
|
||||
}
|
||||
/** builds complete object dictionary, with values from UI */
|
||||
function buildObjectDictionary(form) {
|
||||
const od = getMandatoryObjects();
|
||||
populateMandatoryObjectValues(form, od);
|
||||
// populate custom objects
|
||||
addSDOitems(od);
|
||||
addTXPDOitems(od);
|
||||
addRXPDOitems(od);
|
||||
_booleanPaddingCount = 0;
|
||||
|
||||
return od;
|
||||
}
|
||||
|
||||
// ####################### Object Dictionary index manipulation ####################### //
|
||||
|
||||
function indexToString(index) {
|
||||
var indexValue = parseInt(index);
|
||||
return indexValue.toString(16).toUpperCase();
|
||||
}
|
||||
/** returns list of indexes that are used in given OD, as array of integer values */
|
||||
function getUsedIndexes(od) {
|
||||
const index_min = 0x1000;
|
||||
const index_max = 0xFFFF;
|
||||
const usedIndexes = [];
|
||||
// scan index address space for ones used
|
||||
for (let i = index_min; i <= index_max; i++) {
|
||||
const index = indexToString(i);
|
||||
const element = od[index];
|
||||
if (element) {
|
||||
usedIndexes.push(index);
|
||||
}
|
||||
}
|
||||
return usedIndexes;
|
||||
}
|
||||
|
||||
// ####################### Object Dictionary edition ####################### //
|
||||
|
||||
function getFirstFreeIndex(odSectionName) {
|
||||
var addressRangeStart = {
|
||||
"sdo": 0x2000,
|
||||
"txpdo": 0x6000,
|
||||
"rxpdo": 0x7000,
|
||||
}
|
||||
var result = addressRangeStart[odSectionName];
|
||||
var odSection = getObjDictSection(odSectionName);
|
||||
while (odSection[indexToString(result)]) {
|
||||
result++;
|
||||
}
|
||||
|
||||
return indexToString(result);
|
||||
}
|
||||
/** returns new object description for given PDO section */
|
||||
function getNewObjd(odSectionName, otype) {
|
||||
const readableNames = {
|
||||
VAR: 'Variable',
|
||||
ARRAY: 'Array',
|
||||
RECORD: 'Record'
|
||||
}
|
||||
const objd = {
|
||||
otype: otype,
|
||||
name: `New ${readableNames[otype]}`,
|
||||
access: 'RO',
|
||||
};
|
||||
switch(otype) {
|
||||
case OTYPE.ARRAY: {
|
||||
objd.items = [
|
||||
{ name: 'Max SubIndex' },
|
||||
];
|
||||
addArraySubitem(objd);
|
||||
break;
|
||||
}
|
||||
case OTYPE.RECORD: {
|
||||
objd.items = [
|
||||
{ name: 'Max SubIndex' },
|
||||
];
|
||||
addRecordSubitem(objd);
|
||||
break;
|
||||
}}
|
||||
if (odSectionName == txpdo || odSectionName == rxpdo) {
|
||||
objd.pdo_mappings = [ odSectionName ];
|
||||
}
|
||||
return objd;
|
||||
}
|
||||
|
||||
function addArraySubitem(objd) {
|
||||
if (objd.otype != OTYPE.ARRAY) { alert(`${objd} is not ARRAY, cannot add subitem`); return; }
|
||||
if (!objd.items) { alert(`${objd} does not have items list, cannot add subitem`); return; }
|
||||
const newSubitem = { name: 'New array subitem' }
|
||||
objd.items.push(newSubitem);
|
||||
|
||||
return newSubitem;
|
||||
}
|
||||
|
||||
function addRecordSubitem(objd) {
|
||||
if (objd.otype != OTYPE.RECORD) { alert(`${objd} is not RECORD, cannot add subitem`); return; }
|
||||
if (!objd.items) { alert(`${objd} does not have items list, cannot add subitem`); return; }
|
||||
|
||||
const default_subitemDT = DTYPE.UNSIGNED8; // first from list
|
||||
const newSubitem = { name: 'New record subitem', dtype: default_subitemDT }
|
||||
objd.items.push(newSubitem);
|
||||
|
||||
return newSubitem;
|
||||
}
|
||||
627
Pcb-1-lan9252/EEPROM_generator/src/ui.js
Normal file
627
Pcb-1-lan9252/EEPROM_generator/src/ui.js
Normal file
@@ -0,0 +1,627 @@
|
||||
/**
|
||||
* SOES EEPROM generator
|
||||
* UI behavior logic
|
||||
|
||||
* This tool serves as:
|
||||
- EtherCAT Slave Information XML + EEPROM binary generator
|
||||
- SOES code generator
|
||||
|
||||
* Victor Sluiter 2013-2018
|
||||
* Kuba Buda 2020-2021
|
||||
*/
|
||||
'use strict'
|
||||
|
||||
// ####################### UI changes handlers ####################### //
|
||||
|
||||
function getForm() {
|
||||
return document.getElementById("SlaveForm");
|
||||
}
|
||||
|
||||
function getOutputForm() {
|
||||
return document.getElementById("outCodeForm");
|
||||
}
|
||||
|
||||
function onFormChanged() {
|
||||
const form = getForm();
|
||||
saveLocalBackup(form);
|
||||
processForm(form);
|
||||
}
|
||||
|
||||
/** Shortcuts:
|
||||
* Ctrl + S to save project
|
||||
* Ctrl + O to load save file
|
||||
* Shortcuts start to work after user clicked on page
|
||||
*/
|
||||
document.onkeydown = function(e) {
|
||||
const S_keyCode = 83;
|
||||
const O_keyCode = 79;
|
||||
if (e.ctrlKey){
|
||||
if (e.keyCode === S_keyCode) {
|
||||
event.preventDefault();
|
||||
onSaveClick();
|
||||
return false;
|
||||
}
|
||||
else if (e.keyCode == O_keyCode) {
|
||||
event.preventDefault();
|
||||
onRestoreClick();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// When the user clicks anywhere outside of the modal, close it
|
||||
window.onclick = function(event) {
|
||||
if (event.target == odModal) {
|
||||
odModalClose();
|
||||
}
|
||||
}
|
||||
|
||||
window.onload = (event) => {
|
||||
odModalSetup();
|
||||
syncModalSetup();
|
||||
const form = getForm();
|
||||
setFormValues(form, getFormDefaultValues());
|
||||
tryRestoreLocalBackup(form);
|
||||
// for convinience during tool development, trigger codegen on page refresh
|
||||
processForm(form);
|
||||
|
||||
const _isComputerFast = automaticCodegen;
|
||||
|
||||
if (_isComputerFast) {
|
||||
// code is regenerated on every form change.
|
||||
// no need to remember to generate before copying or downloading
|
||||
// app is noticeably slower
|
||||
|
||||
processForm(form); // make sure displayed code is up to date at startup, e.g redo, if it came from backup
|
||||
|
||||
document.getElementById('GenerateFilesButton').style.display = 'none'; // 'generate' button no longer needed
|
||||
form.addEventListener('change', function() {
|
||||
onFormChanged();
|
||||
});
|
||||
}
|
||||
setupDarkMode();
|
||||
}
|
||||
|
||||
|
||||
// ####################### dark mode logic ####################### //
|
||||
function setupDarkMode() {
|
||||
if (!localStorage.darkMode) {
|
||||
localStorage.darkMode = 'dark'; // dark mode by default
|
||||
}
|
||||
document.documentElement.setAttribute("data-theme", localStorage.darkMode);
|
||||
}
|
||||
|
||||
function toggleDarkMode() {
|
||||
var newMode = (localStorage.darkMode == 'dark') ? "light" : "dark"
|
||||
localStorage.darkMode = newMode;
|
||||
document.documentElement.setAttribute("data-theme", localStorage.darkMode);
|
||||
}
|
||||
|
||||
// ####################### code generation UI logic ####################### //
|
||||
|
||||
/** Code generation method, triggered by UI */
|
||||
function processForm(form)
|
||||
{
|
||||
const od = buildObjectDictionary(form);
|
||||
const indexes = getUsedIndexes(od);
|
||||
var outputCtl = getOutputForm();
|
||||
|
||||
outputCtl.objectlist.value = objectlist_generator(form, od, indexes);
|
||||
outputCtl.ecat_options.value = ecat_options_generator(form, od, indexes);
|
||||
outputCtl.utypes.value = utypes_generator(form, od, indexes);
|
||||
outputCtl.HEX.hexData = hex_generator(form);
|
||||
outputCtl.HEX.value = toIntelHex(outputCtl.HEX.hexData);
|
||||
outputCtl.ESI.value = esi_generator(form, od, indexes, _dc);
|
||||
|
||||
saveLocalBackup(form);
|
||||
|
||||
return outputCtl;
|
||||
}
|
||||
|
||||
// ####################### Button handlers ####################### //
|
||||
function getProjectName(form) {
|
||||
return variableName(form.TextDeviceName.value);
|
||||
}
|
||||
|
||||
function onGenerateDownloadClick()
|
||||
{
|
||||
const form = getForm();
|
||||
var result = processForm(form);
|
||||
downloadGeneratedFilesZipped(form, result);
|
||||
|
||||
function downloadGeneratedFilesZipped(form, result) {
|
||||
var zip = new JSZip();
|
||||
const projectName = getProjectName(form);
|
||||
zip.file(`${projectName}.xml`, result.ESI.value);
|
||||
zip.file('eeprom.hex', result.HEX.value);
|
||||
zip.file('eeprom.bin', result.HEX.hexData);
|
||||
zip.file('ecat_options.h', result.ecat_options.value);
|
||||
zip.file('objectlist.c', result.objectlist.value);
|
||||
zip.file('utypes.h', result.utypes.value);
|
||||
zip.file('esi.json', prepareBackupFileContent(form));
|
||||
|
||||
zip.generateAsync({type:"blob"}).then(function (blob) { // generate the zip file
|
||||
downloadFile(blob, "esi.zip", "application/zip"); // trigger the download
|
||||
}, function (err) {
|
||||
console.log(err);
|
||||
});
|
||||
}
|
||||
|
||||
function downloadGeneratedFiles(form, result) {
|
||||
const projectName = getProjectName(form);
|
||||
downloadFile(result.ESI.value, `${projectName}.xml`, 'text/html');
|
||||
downloadFile(result.HEX.value, 'eeprom.hex', 'application/octet-stream');
|
||||
downloadFile(result.ecat_options.value, 'ecat_options.h', 'text/plain');
|
||||
downloadFile(result.objectlist.value, 'objectlist.c', 'text/plain');
|
||||
downloadFile(result.utypes.value, 'utypes.h', 'text/plain');
|
||||
downloadBackupFile(form);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
function onGenerateClick() {
|
||||
processForm(getForm());
|
||||
}
|
||||
|
||||
function onSaveClick() {
|
||||
const form = getForm();
|
||||
downloadBackupFile(form);
|
||||
saveLocalBackup(form);
|
||||
}
|
||||
|
||||
function onRestoreClick() {
|
||||
// trigger file input dialog window
|
||||
document.getElementById('restoreFileInput').click();
|
||||
}
|
||||
|
||||
function onRestoreComplete(fileContent) {
|
||||
const form = getForm();
|
||||
restoreBackup(fileContent, form);
|
||||
processForm(form);
|
||||
}
|
||||
|
||||
function onResetClick() {
|
||||
if (confirm("Are you sure you want to reset project to default values?")){
|
||||
resetLocalBackup();
|
||||
location.reload(true);
|
||||
}
|
||||
}
|
||||
|
||||
function onDownloadEsiXmlClick() {
|
||||
const form = getForm();
|
||||
const projectName = getProjectName(form);
|
||||
downloadFile(getOutputForm().ESI.value, `${projectName}.xml`, 'text/html');
|
||||
}
|
||||
|
||||
function onDownloadBinClick() {
|
||||
const record = getOutputForm().HEX.hexData;
|
||||
if (!record) { alert("Generate code before you can download it"); return; }
|
||||
downloadFile(record, 'eeprom.bin', 'application/octet-stream');
|
||||
}
|
||||
|
||||
// ####################### Handle modal dialog ####################### //
|
||||
|
||||
var odModal = {};
|
||||
|
||||
function odModalSetup() {
|
||||
// Get the modal
|
||||
odModal = document.getElementById("editObjectModal");
|
||||
if (odModal) {
|
||||
odModal.form = document.getElementById('EditObjectForm');
|
||||
}
|
||||
else {
|
||||
alert("Element required to edit Object Dictionary not found!");
|
||||
}
|
||||
}
|
||||
|
||||
// When the user clicks the button, open the modal
|
||||
function odModalOpen() {
|
||||
odModal.style.display = "block";
|
||||
}
|
||||
|
||||
function odModalClose() {
|
||||
odModal.style.display = "none";
|
||||
}
|
||||
|
||||
/** update control values on OD modal */
|
||||
function odModalUpdate(index, objd) {
|
||||
odModal.form.Index.value = `0x${index}`;
|
||||
odModal.form.ObjectName.value = objd.name;
|
||||
odModal.form.DTYPE.value = objd.dtype || DTYPE.UNSIGNED8;
|
||||
odModal.form.Access.value = objd.access || 'RO';
|
||||
odModal.objd = objd;
|
||||
}
|
||||
|
||||
function odModalHideControls() {
|
||||
document.getElementById('dialogRowIndex').style.display = 'none';
|
||||
document.getElementById('dialogRowDtype').style.display = 'none';
|
||||
document.getElementById('dialogRowValue').style.display = 'none';
|
||||
document.getElementById('dialogRowAccess').style.display = 'none';
|
||||
}
|
||||
|
||||
// ####################### Modal dialogs for OD edition ####################### //
|
||||
|
||||
function editExistingOD_ObjectDialog(odSectionName, index, otype) {
|
||||
const od = getObjDictSection(odSectionName);
|
||||
var objd = od[index];
|
||||
odModal.index_initial_value = index;
|
||||
checkObjectType(otype, objd);
|
||||
odModalUpdate(index, objd);
|
||||
}
|
||||
|
||||
function addNewOD_ObjectDialog(odSectionName, otype) {
|
||||
var objd = getNewObjd(odSectionName, otype);
|
||||
var index = getFirstFreeIndex(odSectionName);
|
||||
delete odModal.index_initial_value; // add new object, not replace edited one
|
||||
odModalUpdate(index, objd);
|
||||
}
|
||||
|
||||
function odModalOpenForObject(otype) {
|
||||
odModalHideControls();
|
||||
document.getElementById('dialogRowIndex').style.display = '';
|
||||
document.getElementById('dialogRowAccess').style.display = '';
|
||||
|
||||
switch (otype) {
|
||||
case OTYPE.VAR: {
|
||||
document.getElementById('dialogRowDtype').style.display = '';
|
||||
document.getElementById('dialogRowValue').style.display = '';
|
||||
break;
|
||||
}
|
||||
case OTYPE.ARRAY: {
|
||||
document.getElementById('dialogRowDtype').style.display = "";
|
||||
break;
|
||||
}
|
||||
case OTYPE.RECORD: {
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
alert(`Unknown object type ${otype}, cannot open modal for it!`);
|
||||
return;
|
||||
}
|
||||
}
|
||||
odModalOpen();
|
||||
document.getElementById('modalInputIndex').focus();
|
||||
}
|
||||
|
||||
function odModalSetTitle(message) {
|
||||
document.getElementById('editObjectTitle').innerHTML = `<strong>${message}</strong>`;
|
||||
}
|
||||
|
||||
// ####################### Edit Object Dictionary UI logic ####################### //
|
||||
|
||||
function editVAR_Click(odSectionName, indexValue = null) {
|
||||
const otype = OTYPE.VAR;
|
||||
const index = indexToString(indexValue);
|
||||
var actionName = "Edit";
|
||||
odModal.odSectionName = odSectionName;
|
||||
|
||||
if (objectExists(odSectionName, index)) {
|
||||
editExistingOD_ObjectDialog(odSectionName, index, otype);
|
||||
odModal.form.DTYPE.value = odModal.objd.dtype;
|
||||
} else {
|
||||
addNewOD_ObjectDialog(odSectionName, otype);
|
||||
actionName = "Add"
|
||||
}
|
||||
odModalSetTitle(`${actionName} ${odSectionName.toUpperCase()} variable`);
|
||||
odModalOpenForObject(otype);
|
||||
}
|
||||
|
||||
function editARRAY_Click(odSectionName, indexValue = null) {
|
||||
const otype = OTYPE.ARRAY;
|
||||
const index = indexToString(indexValue);
|
||||
var actionName = "Edit";
|
||||
odModal.odSectionName = odSectionName;
|
||||
odModal.form.Access
|
||||
|
||||
if (objectExists(odSectionName, index)) {
|
||||
editExistingOD_ObjectDialog(odSectionName, index, otype);
|
||||
odModal.form.DTYPE.value = odModal.objd.dtype;
|
||||
} else {
|
||||
addNewOD_ObjectDialog(odSectionName, otype);
|
||||
actionName = "Add"
|
||||
}
|
||||
odModalSetTitle(`${actionName} ${odSectionName.toUpperCase()} array`);
|
||||
odModalOpenForObject(otype);
|
||||
}
|
||||
|
||||
function editRECORD_Click(odSectionName, indexValue = null) {
|
||||
const otype = OTYPE.RECORD;
|
||||
const index = indexToString(indexValue);
|
||||
var actionName = "Edit";
|
||||
odModal.odSectionName = odSectionName;
|
||||
|
||||
if (objectExists(odSectionName, index)) {
|
||||
editExistingOD_ObjectDialog(odSectionName, index, otype);
|
||||
} else {
|
||||
addNewOD_ObjectDialog(odSectionName, otype);
|
||||
actionName = "Add"
|
||||
}
|
||||
odModalSetTitle(`${actionName} ${odSectionName.toUpperCase()} record`);
|
||||
odModalOpenForObject(otype);
|
||||
}
|
||||
|
||||
function onEditObjectSubmit(modalform) {
|
||||
if (odModal.subitem) {
|
||||
onEditSubitemSubmit(odModal.subitem);
|
||||
delete odModal.subitem;
|
||||
return;
|
||||
}
|
||||
const objd = odModal.objd;
|
||||
const objectType = objd.otype;
|
||||
const index = indexToString(modalform.Index.value);
|
||||
|
||||
objd.name = modalform.ObjectName.value;
|
||||
|
||||
switch (objectType) {
|
||||
case OTYPE.VAR:
|
||||
objd.dtype = modalform.DTYPE.value;
|
||||
|
||||
if (objd.dtype == DTYPE.VISIBLE_STRING) {
|
||||
objd.data = ''
|
||||
} else {
|
||||
objd.value = modalform.InitalValue.value;
|
||||
}
|
||||
break;
|
||||
case OTYPE.ARRAY:
|
||||
objd.dtype = modalform.DTYPE.value;
|
||||
|
||||
break;
|
||||
case OTYPE.RECORD:
|
||||
|
||||
break;
|
||||
default:
|
||||
alert(`Unexpected type ${objectType} on object ${modalform.ObjectName} being edited!`);
|
||||
break;
|
||||
}
|
||||
const odSection = getObjDictSection(odModal.odSectionName);
|
||||
if (odModal.index_initial_value) {
|
||||
removeObject(odSection, odModal.index_initial_value); // detach from OD, to avoid duplicate if index changed
|
||||
}
|
||||
addObject(odSection, objd, index); // attach updated object
|
||||
odModalClose();
|
||||
reloadOD_Section(odModal.odSectionName);
|
||||
delete odModal.odSectionName;
|
||||
odModal.objd = {};
|
||||
|
||||
onFormChanged();
|
||||
}
|
||||
|
||||
function onRemoveClick(odSectionName, indexValue, subindex = null) {
|
||||
const index = indexToString(indexValue);
|
||||
const odSection = getObjDictSection(odSectionName);
|
||||
const objd = odSection[index];
|
||||
if(!objd) { alert(`${odSectionName.toUpperCase()} object ${index} does not exist!`); return; }
|
||||
|
||||
if(subindex) {
|
||||
if(!objd.items) { alert(`Object 0x${index} "${objd.name}" does not have any items!`); return; }
|
||||
if(objd.items.length < subindex) { alert(`Object 0x${index} "${objd.name}" does not have enough items!`); return; }
|
||||
if(objd.items.length < 3) { // only max subindex and one more subitem
|
||||
alert(`Object 0x${index} "${objd.name}" has only 1 subitem, it should not be empty. Remove entire object instead.`); return; }
|
||||
}
|
||||
|
||||
if (confirm(getConfirmMessage(objd, index, subindex))) {
|
||||
|
||||
if (subindex) {
|
||||
const subitemsToRemove = 1;
|
||||
objd.items.splice(subindex, subitemsToRemove);
|
||||
} else {
|
||||
removeObject(odSection, index);
|
||||
}
|
||||
reloadOD_Section(odSectionName);
|
||||
onFormChanged();
|
||||
}
|
||||
|
||||
function getConfirmMessage(objd, index, subindex) {
|
||||
if (subindex) {
|
||||
return `Are you sure you want to remove subitem ${subindex} "${objd.items[subindex].name }" from object 0x${index} "${objd.name}"?`
|
||||
}
|
||||
return `Are you sure you want to remove object 0x${index} "${objd.name}"?`
|
||||
}
|
||||
}
|
||||
|
||||
function addSubitemClick(odSectionName, indexValue) {
|
||||
const index = indexToString(indexValue);
|
||||
const odSection = getObjDictSection(odSectionName);
|
||||
const objd = odSection[index];
|
||||
|
||||
// we expect objd to have items array with at least [{ name: 'Max SubIndex' }]
|
||||
if(!objd.items || !objd.items.length ) { alert(`Object ${index} "${objd.name}" has no subitems!`); return; }
|
||||
|
||||
switch(objd.otype) {
|
||||
case OTYPE.ARRAY: {
|
||||
addArraySubitem(objd);
|
||||
break;
|
||||
}
|
||||
case OTYPE.RECORD: {
|
||||
addRecordSubitem(objd);
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
alert(`Object ${index} "${objd.name}" has OTYPE ${objd.otype} so cannot add subitems`);
|
||||
}
|
||||
}
|
||||
const subindex = objd.items.length - 1; // subitem is added to end of items list
|
||||
editSubitemClick(odSectionName, indexValue, subindex, "Add");
|
||||
}
|
||||
|
||||
function editSubitemClick(odSectionName, indexValue, subindex, actionName = "Edit") {
|
||||
const index = indexToString(indexValue);
|
||||
const odSection = getObjDictSection(odSectionName);
|
||||
const objd = odSection[index];
|
||||
|
||||
if(!objd.items || objd.items.length <= subindex ) { alert(`Object ${index} "${objd.name}" does not have ${subindex} subitems!`); return; }
|
||||
|
||||
odModalSetTitle(`${actionName} ${odSectionName.toUpperCase()} object 0x${index} "${objd.name}" subitem 0x${indexToString(subindex)}`);
|
||||
|
||||
const subitem = objd.items[subindex];
|
||||
|
||||
odModalHideControls();
|
||||
|
||||
document.getElementById('dialogRowValue').style.display = "";
|
||||
odModal.form.InitalValue.value = subitem.value ?? 0;
|
||||
|
||||
if (objd.otype == OTYPE.RECORD) {
|
||||
document.getElementById('dialogRowDtype').style.display = "";
|
||||
odModal.form.DTYPE.value = subitem.dtype;
|
||||
document.getElementById('dialogRowAccess').style.display = ''; // access for record subitems can differ
|
||||
odModal.form.Access.value = subitem.access || 'RO';
|
||||
}
|
||||
odModal.form.ObjectName.value = subitem.name;
|
||||
odModal.subitem = { odSectionName: odSectionName, index: index, subindex: subindex };
|
||||
odModalOpen();
|
||||
document.getElementById('modalInputObjectName').focus();
|
||||
}
|
||||
|
||||
function onEditSubitemSubmit(modalSubitem) {
|
||||
const odSection = getObjDictSection(modalSubitem.odSectionName);
|
||||
const objd = odSection[modalSubitem.index];
|
||||
const subitem = objd.items[modalSubitem.subindex];
|
||||
|
||||
subitem.name = odModal.form.ObjectName.value;
|
||||
subitem.value = odModal.form.InitalValue.value;
|
||||
if (objd.otype == OTYPE.RECORD) {
|
||||
subitem.dtype = odModal.form.DTYPE.value;
|
||||
subitem.access = odModal.form.Access.value;
|
||||
}
|
||||
odModalClose();
|
||||
onFormChanged();
|
||||
reloadOD_Section(modalSubitem.odSectionName);
|
||||
}
|
||||
|
||||
// ####################### Display Object Dictionary state ####################### //
|
||||
|
||||
function reloadOD_Sections() {
|
||||
reloadOD_Section(sdo);
|
||||
reloadOD_Section(txpdo);
|
||||
reloadOD_Section(rxpdo);
|
||||
}
|
||||
|
||||
function reloadOD_Section(odSectionName) {
|
||||
const odSection = getObjDictSection(odSectionName);
|
||||
var indexes = getUsedIndexes(odSection);
|
||||
var section = '';
|
||||
indexes.forEach(index => {
|
||||
const objd = odSection[index];
|
||||
section += `<div class="odItem"><span class="odItemContent"><strong>0x${index}</strong> "${objd.name}" ${objd.otype} ${objd.dtype ?? ''}</span><span>`;
|
||||
if (objd.otype == OTYPE.ARRAY || objd.otype == OTYPE.RECORD) {
|
||||
section += `<button onClick='addSubitemClick(${odSectionName}, 0x${index})'> ➕ Add subitem </button>`;
|
||||
}
|
||||
section += `<button onClick='onRemoveClick(${odSectionName}, 0x${index})'> ❌ Remove </button>`;
|
||||
section += `<button onClick='edit${objd.otype}_Click(${odSectionName}, 0x${index})'> 🛠️ Edit </button>`;
|
||||
section += `</span></div>`;
|
||||
if (objd.items) {
|
||||
var subindex = 1; // skip Max Subindex
|
||||
objd.items.slice(subindex).forEach(subitem => {
|
||||
var subindexHex = subindex < 16 ? `0${subindex.toString(16)}` : subindex.toString(16);
|
||||
section += `<div class="odSubitem"><span class="odSubitemContent"><strong>:0x${subindexHex}</strong> "${subitem.name}" ${subitem.dtype ?? ''}</span>`;
|
||||
section += `<span><button onClick='onRemoveClick(${odSectionName}, 0x${index}, ${subindex})'> ❌ Remove </button>`;
|
||||
section += `<button onClick='editSubitemClick(${odSectionName}, 0x${index}, ${subindex})'> 🛠️ Edit </button>`;
|
||||
section += `</span></div>`;
|
||||
++subindex;
|
||||
});
|
||||
}
|
||||
});
|
||||
const odSectionElement = document.getElementById(`tr_${odSectionName}`);
|
||||
if (odSectionElement) {
|
||||
odSectionElement.innerHTML = section;
|
||||
}
|
||||
}
|
||||
|
||||
// ####################### Synchronization settings UI ####################### //
|
||||
|
||||
var syncModal = {};
|
||||
var _dc = []
|
||||
|
||||
function syncModalSetup() {
|
||||
// Get the modal
|
||||
syncModal = document.getElementById("syncModal");
|
||||
if (syncModal) {
|
||||
syncModal.form = document.getElementById('syncModalForm');
|
||||
}
|
||||
else {
|
||||
alert("Element required to edit Object Dictionary not found!");
|
||||
}
|
||||
}
|
||||
|
||||
function syncModalClose() {
|
||||
syncModal.style.display = "none";
|
||||
delete syncModal.edited;
|
||||
reloadSyncModes();
|
||||
}
|
||||
|
||||
function syncModalOpen() {
|
||||
syncModal.style.display = "block";
|
||||
}
|
||||
|
||||
function syncModeEdit(sync) {
|
||||
syncModal.edited = sync;
|
||||
|
||||
syncModal.form.Name.value = sync.Name;
|
||||
syncModal.form.Description.value = sync.Description;
|
||||
syncModal.form.AssignActivate.value = sync.AssignActivate;
|
||||
syncModal.form.Sync0cycleTime.value = sync.Sync0cycleTime;
|
||||
syncModal.form.Sync0shiftTime.value = sync.Sync0shiftTime;
|
||||
syncModal.form.Sync1cycleTime.value = sync.Sync1cycleTime;
|
||||
syncModal.form.Sync1shiftTime.value = sync.Sync1shiftTime;
|
||||
|
||||
syncModalOpen();
|
||||
}
|
||||
|
||||
function onSyncSubmit(syncForm) {
|
||||
|
||||
syncModal.edited.Name = syncForm.Name.value;
|
||||
syncModal.edited.Description = syncForm.Description.value;
|
||||
syncModal.edited.AssignActivate = syncForm.AssignActivate.value;
|
||||
syncModal.edited.Sync0cycleTime = syncForm.Sync0cycleTime.value;
|
||||
syncModal.edited.Sync0shiftTime = syncForm.Sync0shiftTime.value;
|
||||
syncModal.edited.Sync1cycleTime = syncForm.Sync1cycleTime.value;
|
||||
syncModal.edited.Sync1shiftTime = syncForm.Sync1shiftTime.value;
|
||||
|
||||
syncModalClose();
|
||||
onFormChanged();
|
||||
}
|
||||
|
||||
// ####################### Synchronization settings button handlers ####################### //
|
||||
|
||||
function addSyncClick() {
|
||||
const newSyncMode = {
|
||||
Name: "DcOff",
|
||||
Description: "DC unused",
|
||||
AssignActivate: "#x000",
|
||||
Sync0cycleTime: 0,
|
||||
Sync0shiftTime: 0,
|
||||
Sync1cycleTime: 0,
|
||||
Sync1shiftTime: 0,
|
||||
}
|
||||
_dc.push(newSyncMode);
|
||||
syncModeEdit(newSyncMode);
|
||||
}
|
||||
|
||||
function onEditSyncClick(i) {
|
||||
const syncMode = _dc[i];
|
||||
syncModeEdit(syncMode);
|
||||
}
|
||||
|
||||
function onRemoveSyncClick(i) {
|
||||
_dc.splice(i, 1);
|
||||
reloadSyncModes();
|
||||
onFormChanged();
|
||||
}
|
||||
|
||||
// ####################### Synchronization settings UI ####################### //
|
||||
|
||||
function reloadSyncModes() {
|
||||
var section = '';
|
||||
var i = 0;
|
||||
_dc.forEach(sync => {
|
||||
section += `<div class="odItem"><span class="odItemContent"><strong>${sync.Name}</strong> ${sync.Description} [${sync.AssignActivate}]</span><span>`;
|
||||
section += `<button onClick='onRemoveSyncClick(${i})'> ❌ Remove </button>`;
|
||||
section += `<button onClick='onEditSyncClick(${i})'> 🛠️ Edit </button>`;
|
||||
section += `</span></div>`;
|
||||
++i;
|
||||
});
|
||||
const sectionElement = document.getElementById(`dcSyncModes`);
|
||||
if (sectionElement) {
|
||||
sectionElement.innerHTML = section;
|
||||
}
|
||||
}
|
||||
195
Pcb-1-lan9252/EEPROM_generator/styles/styles.css
Normal file
195
Pcb-1-lan9252/EEPROM_generator/styles/styles.css
Normal file
@@ -0,0 +1,195 @@
|
||||
:root {
|
||||
--background-color: #fff;
|
||||
--text-color: #000;
|
||||
--input-color: #ffffff;
|
||||
--display-dark: none;
|
||||
--display-light: block;
|
||||
}
|
||||
|
||||
/* dark mode */
|
||||
[data-theme="dark"] {
|
||||
/* body, .modal-content { */
|
||||
--background-color: #2D2D2D; /* #4D4D4D; */
|
||||
--text-color: white;
|
||||
--input-color: #3D3D3D;
|
||||
--display-dark: block;
|
||||
--display-light: none;
|
||||
}
|
||||
|
||||
tr td:nth-child(3) {
|
||||
text-align: center;
|
||||
}
|
||||
tr td:nth-child(4) {
|
||||
text-align: center;
|
||||
}
|
||||
tr td:nth-child(5) {
|
||||
text-align: center;
|
||||
}
|
||||
tr td:nth-child(6) {
|
||||
text-align: center;
|
||||
}
|
||||
/* The Modal (background) */
|
||||
.modal {
|
||||
display: none; /* Hidden by default */
|
||||
position: fixed; /* Stay in place */
|
||||
z-index: 1; /* Sit on top */
|
||||
padding-top: 18%; /* Location of the box */
|
||||
left: 0;
|
||||
top: 0;
|
||||
width: 100%; /* Full width */
|
||||
height: 100%; /* Full height */
|
||||
overflow: auto; /* Enable scroll if needed */
|
||||
background-color: rgb(0,0,0); /* Fallback color */
|
||||
background-color: rgba(0,0,0,0.4); /* Black w/ opacity */
|
||||
}
|
||||
|
||||
/* Modal Content */
|
||||
.modal-content {
|
||||
background-color: var(--background-color);
|
||||
margin: auto;
|
||||
padding: 20px;
|
||||
border: 1px solid #888;
|
||||
width: 450px;
|
||||
}
|
||||
|
||||
#editObjectTitle {
|
||||
margin-bottom: 25px;
|
||||
}
|
||||
|
||||
/* The Close Button */
|
||||
.close {
|
||||
color: #aaaaaa;
|
||||
float: right;
|
||||
font-size: 28px;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.close:hover,
|
||||
.close:focus {
|
||||
color: #000;
|
||||
text-decoration: none;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
/* Dropdown Button */
|
||||
.dropbtn {
|
||||
padding: 6px 16px;
|
||||
}
|
||||
|
||||
/* The container <div> - needed to position the dropdown content */
|
||||
.dropdown {
|
||||
position: relative;
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
/* Dropdown Content (Hidden by Default) */
|
||||
.dropdown-content {
|
||||
display: none;
|
||||
position: absolute;
|
||||
background-color: var(--background-color);
|
||||
box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
/* Links inside the dropdown */
|
||||
.dropdown-content a {
|
||||
/* width: 100; */
|
||||
text-decoration: none;
|
||||
margin: 10px 4px;
|
||||
}
|
||||
|
||||
/* Change color of dropdown links on hover */
|
||||
.dropdown-content a:hover {background-color: #ddd;}
|
||||
|
||||
/* Show the dropdown menu on hover */
|
||||
.dropdown:hover .dropdown-content {display: block;}
|
||||
|
||||
/* Change the background color of the dropdown button when the dropdown content is shown */
|
||||
.dropdown:hover .dropbtn {background-color: var(--background-color);}
|
||||
|
||||
/* main content layout */
|
||||
|
||||
body {
|
||||
font-family: Arial, Helvetica, sans-serif;
|
||||
font-size: large;
|
||||
}
|
||||
|
||||
div.main-wrapper {
|
||||
margin: auto;
|
||||
max-width: 960px;
|
||||
}
|
||||
|
||||
h1, h2, h3 {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
table, textarea {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
button {
|
||||
margin-left: 5px;
|
||||
margin-right: 5px;
|
||||
}
|
||||
|
||||
div.settings-menu {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
/* align-items: right; */
|
||||
/* background-color: red; */
|
||||
}
|
||||
|
||||
.odSectionHeading, .odItem, .odSubitem {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
div.odItem, div.odSubitem {
|
||||
padding-top: 4px;
|
||||
padding-bottom: 4px;
|
||||
width: 100%;
|
||||
border-top: 1px dotted;
|
||||
border-bottom: 1px dotted;
|
||||
}
|
||||
|
||||
h3.odSectionHeading {
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
span.odSectionTitle {
|
||||
font-weight: 800;
|
||||
margin-top: 10px;
|
||||
margin-right: -5px;
|
||||
}
|
||||
|
||||
span.odSubitemContent {
|
||||
margin-left: 15px;
|
||||
}
|
||||
|
||||
body {
|
||||
background-color: var(--background-color);
|
||||
color: var(--text-color);
|
||||
}
|
||||
|
||||
input, textarea, select, button {
|
||||
background-color: var(--input-color);
|
||||
color: var(--text-color);
|
||||
}
|
||||
|
||||
.display-dark {
|
||||
display: var(--display-dark);
|
||||
}
|
||||
|
||||
.display-light {
|
||||
display: var(--display-light);
|
||||
}
|
||||
|
||||
a {
|
||||
color: var(--text-color);
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
button {
|
||||
font-size: 16px;
|
||||
}
|
||||
37
Pcb-1-lan9252/EEPROM_generator/tests.html
Normal file
37
Pcb-1-lan9252/EEPROM_generator/tests.html
Normal file
@@ -0,0 +1,37 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>SOES EEPROM Generator spec runner</title>
|
||||
|
||||
<link rel="shortcut icon" type="image/png" href="lib/jasmine-3.8.0/jasmine_favicon.png">
|
||||
<link rel="stylesheet" href="lib/jasmine-3.8.0/jasmine.css">
|
||||
|
||||
<script src="lib/jasmine-3.8.0/jasmine.js"></script>
|
||||
<script src="lib/jasmine-3.8.0/jasmine-html.js"></script>
|
||||
<script src="lib/jasmine-3.8.0/boot.js"></script>
|
||||
|
||||
<!-- include source files here... -->
|
||||
<script src="src/constants.js"></script>
|
||||
<script src="src/od.js"></script>
|
||||
<script src="src/file_io.js"></script>
|
||||
<script src="src/backup.js"></script>
|
||||
|
||||
<script src="src/generators/EEPROM.js"></script>
|
||||
<script src="src/generators/esi_xml.js"></script>
|
||||
<script src="src/generators/ecat_options.js"></script>
|
||||
<script src="src/generators/objectlist.js"></script>
|
||||
<script src="src/generators/utypes.js"></script>
|
||||
|
||||
<!-- include spec files here... -->
|
||||
<script src="spec/helpers/formMockHelper.js"></script>
|
||||
|
||||
<!-- include spec files here... -->
|
||||
<script src="spec/backupSpec.js"></script>
|
||||
<script src="spec/generatorsSpec.js"></script>
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
</body>
|
||||
</html>
|
||||
5
Pcb-1-lan9252/Firmware/.gitignore
vendored
Executable file
5
Pcb-1-lan9252/Firmware/.gitignore
vendored
Executable file
@@ -0,0 +1,5 @@
|
||||
.pio
|
||||
.vscode/.browse.c_cpp.db*
|
||||
.vscode/c_cpp_properties.json
|
||||
.vscode/launch.json
|
||||
.vscode/ipch
|
||||
10
Pcb-1-lan9252/Firmware/.vscode/extensions.json
vendored
Executable file
10
Pcb-1-lan9252/Firmware/.vscode/extensions.json
vendored
Executable file
@@ -0,0 +1,10 @@
|
||||
{
|
||||
// See http://go.microsoft.com/fwlink/?LinkId=827846
|
||||
// for the documentation about the extensions.json format
|
||||
"recommendations": [
|
||||
"platformio.platformio-ide"
|
||||
],
|
||||
"unwantedRecommendations": [
|
||||
"ms-vscode.cpptools-extension-pack"
|
||||
]
|
||||
}
|
||||
13
Pcb-1-lan9252/Firmware/.vscode/settings.json
vendored
Executable file
13
Pcb-1-lan9252/Firmware/.vscode/settings.json
vendored
Executable file
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"files.associations": {
|
||||
"ecat_slv.h": "c",
|
||||
"compare": "cpp",
|
||||
"*.tpp": "cpp",
|
||||
"*.tcc": "cpp",
|
||||
"deque": "cpp",
|
||||
"string": "cpp",
|
||||
"unordered_map": "cpp",
|
||||
"vector": "cpp",
|
||||
"system_error": "cpp"
|
||||
}
|
||||
}
|
||||
39
Pcb-1-lan9252/Firmware/include/README
Executable file
39
Pcb-1-lan9252/Firmware/include/README
Executable file
@@ -0,0 +1,39 @@
|
||||
|
||||
This directory is intended for project header files.
|
||||
|
||||
A header file is a file containing C declarations and macro definitions
|
||||
to be shared between several project source files. You request the use of a
|
||||
header file in your project source file (C, C++, etc) located in `src` folder
|
||||
by including it, with the C preprocessing directive `#include'.
|
||||
|
||||
```src/main.c
|
||||
|
||||
#include "header.h"
|
||||
|
||||
int main (void)
|
||||
{
|
||||
...
|
||||
}
|
||||
```
|
||||
|
||||
Including a header file produces the same results as copying the header file
|
||||
into each source file that needs it. Such copying would be time-consuming
|
||||
and error-prone. With a header file, the related declarations appear
|
||||
in only one place. If they need to be changed, they can be changed in one
|
||||
place, and programs that include the header file will automatically use the
|
||||
new version when next recompiled. The header file eliminates the labor of
|
||||
finding and changing all the copies as well as the risk that a failure to
|
||||
find one copy will result in inconsistencies within a program.
|
||||
|
||||
In C, the usual convention is to give header files names that end with `.h'.
|
||||
It is most portable to use only letters, digits, dashes, and underscores in
|
||||
header file names, and at most one dot.
|
||||
|
||||
Read more about using header files in official GCC documentation:
|
||||
|
||||
* Include Syntax
|
||||
* Include Operation
|
||||
* Once-Only Headers
|
||||
* Computed Includes
|
||||
|
||||
https://gcc.gnu.org/onlinedocs/cpp/Header-Files.html
|
||||
38
Pcb-1-lan9252/Firmware/include/Stepper.h
Executable file
38
Pcb-1-lan9252/Firmware/include/Stepper.h
Executable file
@@ -0,0 +1,38 @@
|
||||
/* USER CODE BEGIN Header */
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file : main.h
|
||||
* @brief : Header for main.c file.
|
||||
* This file contains the common defines of the application.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* Copyright (c) 2023 STMicroelectronics.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This software is licensed under terms that can be found in the LICENSE file
|
||||
* in the root directory of this software component.
|
||||
* If no LICENSE file comes with this software, it is provided AS-IS.
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
/* USER CODE END Header */
|
||||
|
||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||
#ifndef __MAIN_H
|
||||
#define __MAIN_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
void StepperSetup(void);
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "stm32f4xx_hal.h"
|
||||
|
||||
void HAL_TIM_MspPostInit(TIM_HandleTypeDef *htim);
|
||||
void makePulses(uint32_t totalLength /* µsec */, uint32_t nPulses);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __MAIN_H */
|
||||
717
Pcb-1-lan9252/Firmware/include/Stm32F4_Encoder.h
Executable file
717
Pcb-1-lan9252/Firmware/include/Stm32F4_Encoder.h
Executable file
@@ -0,0 +1,717 @@
|
||||
|
||||
#ifndef __Stm32F4_Encoder_H__
|
||||
#define __Stm32F4_Encoder_H__
|
||||
#include <Arduino.h>
|
||||
|
||||
|
||||
#define GPIO_Speed_50MHz 0x02 /*!< Fast speed */
|
||||
|
||||
//#define GPIO_MODER_MODER0 ((uint32_t)0x00000003)
|
||||
#define GPIO_Mode_OUT 0x01
|
||||
//#define GPIO_OSPEEDER_OSPEEDR0 ((uint32_t)0x00000003)
|
||||
//#define GPIO_OTYPER_OT_0 ((uint32_t)0x00000001)
|
||||
//#define GPIO_PUPDR_PUPDR0 ((uint32_t)0x00000003)
|
||||
|
||||
#define GPIO_PuPd_NOPULL 0x00
|
||||
#define GPIO_Mode_AF 0x02
|
||||
#define GPIO_OType_PP 0x00
|
||||
#define GPIO_PuPd_NOPULL 0x00
|
||||
#define GPIO_Pin_0 ((uint16_t)0x0001) /* Pin 0 selected */
|
||||
#define GPIO_Pin_1 ((uint16_t)0x0002) /* Pin 1 selected */
|
||||
#define GPIO_Pin_2 ((uint16_t)0x0004) /* Pin 2 selected */
|
||||
#define GPIO_Pin_3 ((uint16_t)0x0008) /* Pin 3 selected */
|
||||
#define GPIO_Pin_4 ((uint16_t)0x0010) /* Pin 4 selected */
|
||||
#define GPIO_Pin_5 ((uint16_t)0x0020) /* Pin 5 selected */
|
||||
#define GPIO_Pin_6 ((uint16_t)0x0040) /* Pin 6 selected */
|
||||
#define GPIO_Pin_7 ((uint16_t)0x0080) /* Pin 7 selected */
|
||||
#define GPIO_Pin_8 ((uint16_t)0x0100) /* Pin 8 selected */
|
||||
#define GPIO_Pin_9 ((uint16_t)0x0200) /* Pin 9 selected */
|
||||
#define GPIO_Pin_10 ((uint16_t)0x0400) /* Pin 10 selected */
|
||||
#define GPIO_Pin_11 ((uint16_t)0x0800) /* Pin 11 selected */
|
||||
#define GPIO_Pin_12 ((uint16_t)0x1000) /* Pin 12 selected */
|
||||
#define GPIO_Pin_13 ((uint16_t)0x2000) /* Pin 13 selected */
|
||||
#define GPIO_Pin_14 ((uint16_t)0x4000) /* Pin 14 selected */
|
||||
#define GPIO_Pin_15 ((uint16_t)0x8000) /* Pin 15 selected */
|
||||
#define GPIO_Pin_All ((uint16_t)0xFFFF) /* All pins selected */
|
||||
|
||||
|
||||
|
||||
|
||||
typedef struct TIM_TimeBaseInitTypeDef
|
||||
{
|
||||
uint16_t TIM_Prescaler; /*!< Specifies the prescaler value used to divide the TIM clock.
|
||||
This parameter can be a number between 0x0000 and 0xFFFF */
|
||||
|
||||
uint16_t TIM_CounterMode; /*!< Specifies the counter mode.
|
||||
This parameter can be a value of @ref TIM_Counter_Mode */
|
||||
|
||||
uint32_t TIM_Period; /*!< Specifies the period value to be loaded into the active
|
||||
Auto-Reload Register at the next update event.
|
||||
This parameter must be a number between 0x0000 and 0xFFFF. */
|
||||
|
||||
uint16_t TIM_ClockDivision; /*!< Specifies the clock division.
|
||||
This parameter can be a value of @ref TIM_Clock_Division_CKD */
|
||||
|
||||
uint8_t TIM_RepetitionCounter; /*!< Specifies the repetition counter value. Each time the RCR downcounter
|
||||
reaches zero, an update event is generated and counting restarts
|
||||
from the RCR value (N).
|
||||
This means in PWM mode that (N+1) corresponds to:
|
||||
- the number of PWM periods in edge-aligned mode
|
||||
- the number of half PWM period in center-aligned mode
|
||||
This parameter must be a number between 0x00 and 0xFF.
|
||||
@note This parameter is valid only for TIM1 and TIM8. */
|
||||
} TIM_TimeBaseInitTypeDef;
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint16_t setcount;
|
||||
|
||||
} encoder;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint16_t TIM_OCMode; /*!< Specifies the TIM mode.
|
||||
This parameter can be a value of @ref TIM_Output_Compare_and_PWM_modes */
|
||||
|
||||
uint16_t TIM_OutputState; /*!< Specifies the TIM Output Compare state.
|
||||
This parameter can be a value of @ref TIM_Output_Compare_State */
|
||||
|
||||
uint16_t TIM_OutputNState; /*!< Specifies the TIM complementary Output Compare state.
|
||||
This parameter can be a value of @ref TIM_Output_Compare_N_State
|
||||
@note This parameter is valid only for TIM1 and TIM8. */
|
||||
|
||||
uint32_t TIM_Pulse; /*!< Specifies the pulse value to be loaded into the Capture Compare Register.
|
||||
This parameter can be a number between 0x0000 and 0xFFFF */
|
||||
|
||||
uint16_t TIM_OCPolarity; /*!< Specifies the output polarity.
|
||||
This parameter can be a value of @ref TIM_Output_Compare_Polarity */
|
||||
|
||||
uint16_t TIM_OCNPolarity; /*!< Specifies the complementary output polarity.
|
||||
This parameter can be a value of @ref TIM_Output_Compare_N_Polarity
|
||||
@note This parameter is valid only for TIM1 and TIM8. */
|
||||
|
||||
uint16_t TIM_OCIdleState; /*!< Specifies the TIM Output Compare pin state during Idle state.
|
||||
This parameter can be a value of @ref TIM_Output_Compare_Idle_State
|
||||
@note This parameter is valid only for TIM1 and TIM8. */
|
||||
|
||||
uint16_t TIM_OCNIdleState; /*!< Specifies the TIM Output Compare pin state during Idle state.
|
||||
This parameter can be a value of @ref TIM_Output_Compare_N_Idle_State
|
||||
@note This parameter is valid only for TIM1 and TIM8. */
|
||||
} TIM_OCInitTypeDef;
|
||||
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
|
||||
uint16_t TIM_Channel; /*!< Specifies the TIM channel.
|
||||
This parameter can be a value of @ref TIM_Channel */
|
||||
|
||||
uint16_t TIM_ICPolarity; /*!< Specifies the active edge of the input signal.
|
||||
This parameter can be a value of @ref TIM_Input_Capture_Polarity */
|
||||
|
||||
uint16_t TIM_ICSelection; /*!< Specifies the input.
|
||||
This parameter can be a value of @ref TIM_Input_Capture_Selection */
|
||||
|
||||
uint16_t TIM_ICPrescaler; /*!< Specifies the Input Capture Prescaler.
|
||||
This parameter can be a value of @ref TIM_Input_Capture_Prescaler */
|
||||
|
||||
uint16_t TIM_ICFilter; /*!< Specifies the input capture filter.
|
||||
This parameter can be a number between 0x0 and 0xF */
|
||||
} TIM_ICInitTypeDef;
|
||||
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
|
||||
uint16_t TIM_OSSRState; /*!< Specifies the Off-State selection used in Run mode.
|
||||
This parameter can be a value of @ref TIM_OSSR_Off_State_Selection_for_Run_mode_state */
|
||||
|
||||
uint16_t TIM_OSSIState; /*!< Specifies the Off-State used in Idle state.
|
||||
This parameter can be a value of @ref TIM_OSSI_Off_State_Selection_for_Idle_mode_state */
|
||||
|
||||
uint16_t TIM_LOCKLevel; /*!< Specifies the LOCK level parameters.
|
||||
This parameter can be a value of @ref TIM_Lock_level */
|
||||
|
||||
uint16_t TIM_DeadTime; /*!< Specifies the delay time between the switching-off and the
|
||||
switching-on of the outputs.
|
||||
This parameter can be a number between 0x00 and 0xFF */
|
||||
|
||||
uint16_t TIM_Break; /*!< Specifies whether the TIM Break input is enabled or not.
|
||||
This parameter can be a value of @ref TIM_Break_Input_enable_disable */
|
||||
|
||||
uint16_t TIM_BreakPolarity; /*!< Specifies the TIM Break Input pin polarity.
|
||||
This parameter can be a value of @ref TIM_Break_Polarity */
|
||||
|
||||
uint16_t TIM_AutomaticOutput; /*!< Specifies whether the TIM Automatic Output feature is enabled or not.
|
||||
This parameter can be a value of @ref TIM_AOE_Bit_Set_Reset */
|
||||
} TIM_BDTRInitTypeDef;
|
||||
|
||||
|
||||
#define GPIO_PinSource0 ((uint8_t)0x00)
|
||||
#define GPIO_PinSource1 ((uint8_t)0x01)
|
||||
#define GPIO_PinSource2 ((uint8_t)0x02)
|
||||
#define GPIO_PinSource3 ((uint8_t)0x03)
|
||||
#define GPIO_PinSource4 ((uint8_t)0x04)
|
||||
#define GPIO_PinSource5 ((uint8_t)0x05)
|
||||
#define GPIO_PinSource6 ((uint8_t)0x06)
|
||||
#define GPIO_PinSource7 ((uint8_t)0x07)
|
||||
#define GPIO_PinSource8 ((uint8_t)0x08)
|
||||
#define GPIO_PinSource9 ((uint8_t)0x09)
|
||||
#define GPIO_PinSource10 ((uint8_t)0x0A)
|
||||
#define GPIO_PinSource11 ((uint8_t)0x0B)
|
||||
#define GPIO_PinSource12 ((uint8_t)0x0C)
|
||||
#define GPIO_PinSource13 ((uint8_t)0x0D)
|
||||
#define GPIO_PinSource14 ((uint8_t)0x0E)
|
||||
#define GPIO_PinSource15 ((uint8_t)0x0F)
|
||||
#define GPIO_AF_TIM8 ((uint8_t)0x03) /* TIM8 Alternate Function mapping */
|
||||
#define GPIO_AF_TIM3 ((uint8_t)0x02) /* TIM3 Alternate Function mapping */
|
||||
#define GPIO_AF_TIM4 ((uint8_t)0x02) /* TIM4 Alternate Function mapping */
|
||||
#define GPIO_AF_TIM5 ((uint8_t)0x02) /* TIM5 Alternate Function mapping */
|
||||
#define GPIO_AF_TIM1 ((uint8_t)0x01) /* TIM1 Alternate Function mapping */
|
||||
#define GPIO_AF_TIM2 ((uint8_t)0x01) /* TIM2 Alternate Function mapping */
|
||||
|
||||
#define TIM4 ((TIM_TypeDef *) TIM4_BASE)
|
||||
#define TIM8 ((TIM_TypeDef *) TIM8_BASE)
|
||||
#define TIM_EncoderMode_TI12 ((uint16_t)0x0003)
|
||||
#define TIM_ICPolarity_Rising ((uint16_t)0x0000)
|
||||
#define TIM_ICPolarity_Falling ((uint16_t)0x0002)
|
||||
//#define TIM_CR1_CEN ((uint16_t)0x0001) /*!<Counter enable */
|
||||
//#define TIM_CR1_CEN ((uint16_t)0x0001) /*!<Counter enable */
|
||||
|
||||
#define IS_TIM_ALL_PERIPH(PERIPH) (((PERIPH) == TIM1) || \
|
||||
((PERIPH) == TIM2) || \
|
||||
((PERIPH) == TIM3) || \
|
||||
((PERIPH) == TIM4) || \
|
||||
((PERIPH) == TIM5) || \
|
||||
((PERIPH) == TIM6) || \
|
||||
((PERIPH) == TIM7) || \
|
||||
((PERIPH) == TIM8) || \
|
||||
((PERIPH) == TIM9) || \
|
||||
((PERIPH) == TIM10) || \
|
||||
((PERIPH) == TIM11) || \
|
||||
((PERIPH) == TIM12) || \
|
||||
(((PERIPH) == TIM13) || \
|
||||
((PERIPH) == TIM14)))
|
||||
|
||||
#define IS_TIM_LIST1_PERIPH(PERIPH) (((PERIPH) == TIM1) || \
|
||||
((PERIPH) == TIM2) || \
|
||||
((PERIPH) == TIM3) || \
|
||||
((PERIPH) == TIM4) || \
|
||||
((PERIPH) == TIM5) || \
|
||||
((PERIPH) == TIM8) || \
|
||||
((PERIPH) == TIM9) || \
|
||||
((PERIPH) == TIM10) || \
|
||||
((PERIPH) == TIM11) || \
|
||||
((PERIPH) == TIM12) || \
|
||||
((PERIPH) == TIM13) || \
|
||||
((PERIPH) == TIM14))
|
||||
|
||||
|
||||
#define IS_TIM_LIST2_PERIPH(PERIPH) (((PERIPH) == TIM1) || \
|
||||
((PERIPH) == TIM2) || \
|
||||
((PERIPH) == TIM3) || \
|
||||
((PERIPH) == TIM4) || \
|
||||
((PERIPH) == TIM5) || \
|
||||
((PERIPH) == TIM8) || \
|
||||
((PERIPH) == TIM9) || \
|
||||
((PERIPH) == TIM12))
|
||||
|
||||
#define IS_TIM_LIST3_PERIPH(PERIPH) (((PERIPH) == TIM1) || \
|
||||
((PERIPH) == TIM2) || \
|
||||
((PERIPH) == TIM3) || \
|
||||
((PERIPH) == TIM4) || \
|
||||
((PERIPH) == TIM5) || \
|
||||
((PERIPH) == TIM8))
|
||||
|
||||
#define IS_TIM_LIST4_PERIPH(PERIPH) (((PERIPH) == TIM1) || \
|
||||
((PERIPH) == TIM8))
|
||||
|
||||
#define IS_TIM_LIST5_PERIPH(PERIPH) (((PERIPH) == TIM1) || \
|
||||
((PERIPH) == TIM2) || \
|
||||
((PERIPH) == TIM3) || \
|
||||
((PERIPH) == TIM4) || \
|
||||
((PERIPH) == TIM5) || \
|
||||
((PERIPH) == TIM6) || \
|
||||
((PERIPH) == TIM7) || \
|
||||
((PERIPH) == TIM8))
|
||||
|
||||
#define IS_TIM_LIST6_PERIPH(TIMx)(((TIMx) == TIM2) || \
|
||||
((TIMx) == TIM5) || \
|
||||
((TIMx) == TIM11))
|
||||
|
||||
|
||||
|
||||
#define TIM_OCMode_Timing ((uint16_t)0x0000)
|
||||
#define TIM_OCMode_Active ((uint16_t)0x0010)
|
||||
#define TIM_OCMode_Inactive ((uint16_t)0x0020)
|
||||
#define TIM_OCMode_Toggle ((uint16_t)0x0030)
|
||||
#define TIM_OCMode_PWM1 ((uint16_t)0x0060)
|
||||
#define TIM_OCMode_PWM2 ((uint16_t)0x0070)
|
||||
//#define IS_TIM_OC_MODE(MODE) (((MODE) == TIM_OCMode_Timing) || \
|
||||
// ((MODE) == TIM_OCMode_Active) || \
|
||||
// ((MODE) == TIM_OCMode_Inactive) || \
|
||||
// ((MODE) == TIM_OCMode_Toggle)|| \
|
||||
// ((MODE) == TIM_OCMode_PWM1) || \
|
||||
// ((MODE) == TIM_OCMode_PWM2))
|
||||
#define IS_TIM_OCM(MODE) (((MODE) == TIM_OCMode_Timing) || \
|
||||
((MODE) == TIM_OCMode_Active) || \
|
||||
((MODE) == TIM_OCMode_Inactive) || \
|
||||
((MODE) == TIM_OCMode_Toggle)|| \
|
||||
((MODE) == TIM_OCMode_PWM1) || \
|
||||
((MODE) == TIM_OCMode_PWM2) || \
|
||||
((MODE) == TIM_ForcedAction_Active) || \
|
||||
((MODE) == TIM_ForcedAction_InActive))
|
||||
|
||||
|
||||
#define TIM_OPMode_Single ((uint16_t)0x0008)
|
||||
#define TIM_OPMode_Repetitive ((uint16_t)0x0000)
|
||||
//#define IS_TIM_OPM_MODE(MODE) (((MODE) == TIM_OPMode_Single) || \
|
||||
// ((MODE) == TIM_OPMode_Repetitive))
|
||||
|
||||
|
||||
#define TIM_Channel_1 ((uint16_t)0x0000)
|
||||
#define TIM_Channel_2 ((uint16_t)0x0004)
|
||||
#define TIM_Channel_3 ((uint16_t)0x0008)
|
||||
#define TIM_Channel_4 ((uint16_t)0x000C)
|
||||
|
||||
#define IS_TIM_CHANNEL(CHANNEL) (((CHANNEL) == TIM_Channel_1) || \
|
||||
((CHANNEL) == TIM_Channel_2) || \
|
||||
((CHANNEL) == TIM_Channel_3) || \
|
||||
((CHANNEL) == TIM_Channel_4))
|
||||
|
||||
#define IS_TIM_PWMI_CHANNEL(CHANNEL) (((CHANNEL) == TIM_Channel_1) || \
|
||||
((CHANNEL) == TIM_Channel_2))
|
||||
#define IS_TIM_COMPLEMENTARY_CHANNEL(CHANNEL) (((CHANNEL) == TIM_Channel_1) || \
|
||||
((CHANNEL) == TIM_Channel_2) || \
|
||||
((CHANNEL) == TIM_Channel_3))
|
||||
|
||||
|
||||
#define TIM_CKD_DIV1 ((uint16_t)0x0000)
|
||||
#define TIM_CKD_DIV2 ((uint16_t)0x0100)
|
||||
#define TIM_CKD_DIV4 ((uint16_t)0x0200)
|
||||
#define IS_TIM_CKD_DIV(DIV) (((DIV) == TIM_CKD_DIV1) || \
|
||||
((DIV) == TIM_CKD_DIV2) || \
|
||||
((DIV) == TIM_CKD_DIV4))
|
||||
|
||||
|
||||
#define TIM_CounterMode_Up ((uint16_t)0x0000)
|
||||
#define TIM_CounterMode_Down ((uint16_t)0x0010)
|
||||
#define TIM_CounterMode_CenterAligned1 ((uint16_t)0x0020)
|
||||
#define TIM_CounterMode_CenterAligned2 ((uint16_t)0x0040)
|
||||
#define TIM_CounterMode_CenterAligned3 ((uint16_t)0x0060)
|
||||
//#define IS_TIM_COUNTER_MODE(MODE) (((MODE) == TIM_CounterMode_Up) || \
|
||||
// ((MODE) == TIM_CounterMode_Down) || \
|
||||
// ((MODE) == TIM_CounterMode_CenterAligned1) || \
|
||||
// ((MODE) == TIM_CounterMode_CenterAligned2) || \
|
||||
// ((MODE) == TIM_CounterMode_CenterAligned3))
|
||||
|
||||
|
||||
#define TIM_OCPolarity_High ((uint16_t)0x0000)
|
||||
#define TIM_OCPolarity_Low ((uint16_t)0x0002)
|
||||
//#define IS_TIM_OC_POLARITY(POLARITY) (((POLARITY) == TIM_OCPolarity_High) || \
|
||||
// ((POLARITY) == TIM_OCPolarity_Low))
|
||||
|
||||
|
||||
#define TIM_OCNPolarity_High ((uint16_t)0x0000)
|
||||
#define TIM_OCNPolarity_Low ((uint16_t)0x0008)
|
||||
//#define IS_TIM_OCN_POLARITY(POLARITY) (((POLARITY) == TIM_OCNPolarity_High) || \
|
||||
// ((POLARITY) == TIM_OCNPolarity_Low))
|
||||
|
||||
#define TIM_OutputState_Disable ((uint16_t)0x0000)
|
||||
#define TIM_OutputState_Enable ((uint16_t)0x0001)
|
||||
#define IS_TIM_OUTPUT_STATE(STATE) (((STATE) == TIM_OutputState_Disable) || \
|
||||
((STATE) == TIM_OutputState_Enable))
|
||||
|
||||
|
||||
#define TIM_OutputNState_Disable ((uint16_t)0x0000)
|
||||
#define TIM_OutputNState_Enable ((uint16_t)0x0004)
|
||||
#define IS_TIM_OUTPUTN_STATE(STATE) (((STATE) == TIM_OutputNState_Disable) || \
|
||||
((STATE) == TIM_OutputNState_Enable))
|
||||
|
||||
|
||||
#define TIM_CCx_Enable ((uint16_t)0x0001)
|
||||
#define TIM_CCx_Disable ((uint16_t)0x0000)
|
||||
#define IS_TIM_CCX(CCX) (((CCX) == TIM_CCx_Enable) || \
|
||||
((CCX) == TIM_CCx_Disable))
|
||||
|
||||
|
||||
#define TIM_CCxN_Enable ((uint16_t)0x0004)
|
||||
#define TIM_CCxN_Disable ((uint16_t)0x0000)
|
||||
#define IS_TIM_CCXN(CCXN) (((CCXN) == TIM_CCxN_Enable) || \
|
||||
((CCXN) == TIM_CCxN_Disable))
|
||||
|
||||
|
||||
#define TIM_Break_Enable ((uint16_t)0x1000)
|
||||
#define TIM_Break_Disable ((uint16_t)0x0000)
|
||||
//#define IS_TIM_BREAK_STATE(STATE) (((STATE) == TIM_Break_Enable) || \
|
||||
// ((STATE) == TIM_Break_Disable))
|
||||
|
||||
|
||||
#define TIM_BreakPolarity_Low ((uint16_t)0x0000)
|
||||
#define TIM_BreakPolarity_High ((uint16_t)0x2000)
|
||||
//#define IS_TIM_BREAK_POLARITY(POLARITY) (((POLARITY) == TIM_BreakPolarity_Low) || \
|
||||
// ((POLARITY) == TIM_BreakPolarity_High))
|
||||
|
||||
|
||||
#define TIM_AutomaticOutput_Enable ((uint16_t)0x4000)
|
||||
#define TIM_AutomaticOutput_Disable ((uint16_t)0x0000)
|
||||
//#define IS_TIM_AUTOMATIC_OUTPUT_STATE(STATE) (((STATE) == TIM_AutomaticOutput_Enable) || \
|
||||
// ((STATE) == TIM_AutomaticOutput_Disable))
|
||||
|
||||
|
||||
#define TIM_LOCKLevel_OFF ((uint16_t)0x0000)
|
||||
#define TIM_LOCKLevel_1 ((uint16_t)0x0100)
|
||||
#define TIM_LOCKLevel_2 ((uint16_t)0x0200)
|
||||
#define TIM_LOCKLevel_3 ((uint16_t)0x0300)
|
||||
//#define IS_TIM_LOCK_LEVEL(LEVEL) (((LEVEL) == TIM_LOCKLevel_OFF) || \
|
||||
// ((LEVEL) == TIM_LOCKLevel_1) || \
|
||||
// ((LEVEL) == TIM_LOCKLevel_2) || \
|
||||
// ((LEVEL) == TIM_LOCKLevel_3))
|
||||
|
||||
|
||||
#define TIM_OSSIState_Enable ((uint16_t)0x0400)
|
||||
#define TIM_OSSIState_Disable ((uint16_t)0x0000)
|
||||
//#define IS_TIM_OSSI_STATE(STATE) (((STATE) == TIM_OSSIState_Enable) || \
|
||||
// ((STATE) == TIM_OSSIState_Disable))
|
||||
|
||||
|
||||
#define TIM_OSSRState_Enable ((uint16_t)0x0800)
|
||||
#define TIM_OSSRState_Disable ((uint16_t)0x0000)
|
||||
//#define IS_TIM_OSSR_STATE(STATE) (((STATE) == TIM_OSSRState_Enable) || \
|
||||
// ((STATE) == TIM_OSSRState_Disable))
|
||||
|
||||
|
||||
#define TIM_OCIdleState_Set ((uint16_t)0x0100)
|
||||
#define TIM_OCIdleState_Reset ((uint16_t)0x0000)
|
||||
//#define IS_TIM_OCIDLE_STATE(STATE) (((STATE) == TIM_OCIdleState_Set) || \
|
||||
// ((STATE) == TIM_OCIdleState_Reset))
|
||||
//
|
||||
|
||||
#define TIM_OCNIdleState_Set ((uint16_t)0x0200)
|
||||
#define TIM_OCNIdleState_Reset ((uint16_t)0x0000)
|
||||
//#define IS_TIM_OCNIDLE_STATE(STATE) (((STATE) == TIM_OCNIdleState_Set) || \
|
||||
// ((STATE) == TIM_OCNIdleState_Reset))
|
||||
|
||||
|
||||
#define TIM_ICPolarity_Rising ((uint16_t)0x0000)
|
||||
#define TIM_ICPolarity_Falling ((uint16_t)0x0002)
|
||||
#define TIM_ICPolarity_BothEdge ((uint16_t)0x000A)
|
||||
//#define IS_TIM_IC_POLARITY(POLARITY) (((POLARITY) == TIM_ICPolarity_Rising) || \
|
||||
// ((POLARITY) == TIM_ICPolarity_Falling)|| \
|
||||
// ((POLARITY) == TIM_ICPolarity_BothEdge))
|
||||
|
||||
|
||||
#define TIM_ICSelection_DirectTI ((uint16_t)0x0001) /*!< TIM Input 1, 2, 3 or 4 is selected to be
|
||||
connected to IC1, IC2, IC3 or IC4, respectively */
|
||||
#define TIM_ICSelection_IndirectTI ((uint16_t)0x0002) /*!< TIM Input 1, 2, 3 or 4 is selected to be
|
||||
connected to IC2, IC1, IC4 or IC3, respectively. */
|
||||
#define TIM_ICSelection_TRC ((uint16_t)0x0003) /*!< TIM Input 1, 2, 3 or 4 is selected to be connected to TRC. */
|
||||
//#define IS_TIM_IC_SELECTION(SELECTION) (((SELECTION) == TIM_ICSelection_DirectTI) || \
|
||||
// ((SELECTION) == TIM_ICSelection_IndirectTI) || \
|
||||
// ((SELECTION) == TIM_ICSelection_TRC))
|
||||
|
||||
|
||||
//#define TIM_ICPSC_DIV1 ((uint16_t)0x0000) /*!< Capture performed each time an edge is detected on the capture input. */
|
||||
//#define TIM_ICPSC_DIV2 ((uint16_t)0x0004) /*!< Capture performed once every 2 events. */
|
||||
//#define TIM_ICPSC_DIV4 ((uint16_t)0x0008) /*!< Capture performed once every 4 events. */
|
||||
//#define TIM_ICPSC_DIV8 ((uint16_t)0x000C) /*!< Capture performed once every 8 events. */
|
||||
//#define IS_TIM_IC_PRESCALER(PRESCALER) (((PRESCALER) == TIM_ICPSC_DIV1) || \
|
||||
// ((PRESCALER) == TIM_ICPSC_DIV2) || \
|
||||
// ((PRESCALER) == TIM_ICPSC_DIV4) || \
|
||||
// ((PRESCALER) == TIM_ICPSC_DIV8))
|
||||
|
||||
|
||||
#define TIM_IT_Update ((uint16_t)0x0001)
|
||||
//#define TIM_IT_CC1 ((uint16_t)0x0002)
|
||||
//#define TIM_IT_CC2 ((uint16_t)0x0004)
|
||||
//#define TIM_IT_CC3 ((uint16_t)0x0008)
|
||||
//#define TIM_IT_CC4 ((uint16_t)0x0010)
|
||||
//#define TIM_IT_COM ((uint16_t)0x0020)
|
||||
#define TIM_IT_Trigger ((uint16_t)0x0040)
|
||||
#define TIM_IT_Break ((uint16_t)0x0080)
|
||||
#define IS_TIM_IT(IT) ((((IT) & (uint16_t)0xFF00) == 0x0000) && ((IT) != 0x0000))
|
||||
|
||||
#define IS_TIM_GET_IT(IT) (((IT) == TIM_IT_Update) || \
|
||||
((IT) == TIM_IT_CC1) || \
|
||||
((IT) == TIM_IT_CC2) || \
|
||||
((IT) == TIM_IT_CC3) || \
|
||||
((IT) == TIM_IT_CC4) || \
|
||||
((IT) == TIM_IT_COM) || \
|
||||
((IT) == TIM_IT_Trigger) || \
|
||||
((IT) == TIM_IT_Break))
|
||||
|
||||
|
||||
//#define TIM_DMABase_CR1 ((uint16_t)0x0000)
|
||||
//#define TIM_DMABase_CR2 ((uint16_t)0x0001)
|
||||
//#define TIM_DMABase_SMCR ((uint16_t)0x0002)
|
||||
//#define TIM_DMABase_DIER ((uint16_t)0x0003)
|
||||
//#define TIM_DMABase_SR ((uint16_t)0x0004)
|
||||
//#define TIM_DMABase_EGR ((uint16_t)0x0005)
|
||||
//#define TIM_DMABase_CCMR1 ((uint16_t)0x0006)
|
||||
//#define TIM_DMABase_CCMR2 ((uint16_t)0x0007)
|
||||
//#define TIM_DMABase_CCER ((uint16_t)0x0008)
|
||||
//#define TIM_DMABase_CNT ((uint16_t)0x0009)
|
||||
//#define TIM_DMABase_PSC ((uint16_t)0x000A)
|
||||
//#define TIM_DMABase_ARR ((uint16_t)0x000B)
|
||||
//#define TIM_DMABase_RCR ((uint16_t)0x000C)
|
||||
//#define TIM_DMABase_CCR1 ((uint16_t)0x000D)
|
||||
//#define TIM_DMABase_CCR2 ((uint16_t)0x000E)
|
||||
//#define TIM_DMABase_CCR3 ((uint16_t)0x000F)
|
||||
//#define TIM_DMABase_CCR4 ((uint16_t)0x0010)
|
||||
//#define TIM_DMABase_BDTR ((uint16_t)0x0011)
|
||||
//#define TIM_DMABase_DCR ((uint16_t)0x0012)
|
||||
//#define TIM_DMABase_OR ((uint16_t)0x0013)
|
||||
//#define IS_TIM_DMA_BASE(BASE) (((BASE) == TIM_DMABase_CR1) || \
|
||||
// ((BASE) == TIM_DMABase_CR2) || \
|
||||
// ((BASE) == TIM_DMABase_SMCR) || \
|
||||
// ((BASE) == TIM_DMABase_DIER) || \
|
||||
// ((BASE) == TIM_DMABase_SR) || \
|
||||
// ((BASE) == TIM_DMABase_EGR) || \
|
||||
// ((BASE) == TIM_DMABase_CCMR1) || \
|
||||
// ((BASE) == TIM_DMABase_CCMR2) || \
|
||||
// ((BASE) == TIM_DMABase_CCER) || \
|
||||
// ((BASE) == TIM_DMABase_CNT) || \
|
||||
// ((BASE) == TIM_DMABase_PSC) || \
|
||||
// ((BASE) == TIM_DMABase_ARR) || \
|
||||
// ((BASE) == TIM_DMABase_RCR) || \
|
||||
// ((BASE) == TIM_DMABase_CCR1) || \
|
||||
// ((BASE) == TIM_DMABase_CCR2) || \
|
||||
// ((BASE) == TIM_DMABase_CCR3) || \
|
||||
// ((BASE) == TIM_DMABase_CCR4) || \
|
||||
// ((BASE) == TIM_DMABase_BDTR) || \
|
||||
// ((BASE) == TIM_DMABase_DCR) || \
|
||||
// ((BASE) == TIM_DMABase_OR))
|
||||
|
||||
|
||||
//#define TIM_DMABurstLength_1Transfer ((uint16_t)0x0000)
|
||||
//#define TIM_DMABurstLength_2Transfers ((uint16_t)0x0100)
|
||||
//#define TIM_DMABurstLength_3Transfers ((uint16_t)0x0200)
|
||||
//#define TIM_DMABurstLength_4Transfers ((uint16_t)0x0300)
|
||||
//#define TIM_DMABurstLength_5Transfers ((uint16_t)0x0400)
|
||||
//#define TIM_DMABurstLength_6Transfers ((uint16_t)0x0500)
|
||||
//#define TIM_DMABurstLength_7Transfers ((uint16_t)0x0600)
|
||||
//#define TIM_DMABurstLength_8Transfers ((uint16_t)0x0700)
|
||||
//#define TIM_DMABurstLength_9Transfers ((uint16_t)0x0800)
|
||||
//#define TIM_DMABurstLength_10Transfers ((uint16_t)0x0900)
|
||||
//#define TIM_DMABurstLength_11Transfers ((uint16_t)0x0A00)
|
||||
//#define TIM_DMABurstLength_12Transfers ((uint16_t)0x0B00)
|
||||
//#define TIM_DMABurstLength_13Transfers ((uint16_t)0x0C00)
|
||||
//#define TIM_DMABurstLength_14Transfers ((uint16_t)0x0D00)
|
||||
//#define TIM_DMABurstLength_15Transfers ((uint16_t)0x0E00)
|
||||
//#define TIM_DMABurstLength_16Transfers ((uint16_t)0x0F00)
|
||||
//#define TIM_DMABurstLength_17Transfers ((uint16_t)0x1000)
|
||||
//#define TIM_DMABurstLength_18Transfers ((uint16_t)0x1100)
|
||||
//#define IS_TIM_DMA_LENGTH(LENGTH) (((LENGTH) == TIM_DMABurstLength_1Transfer) || \
|
||||
// ((LENGTH) == TIM_DMABurstLength_2Transfers) || \
|
||||
// ((LENGTH) == TIM_DMABurstLength_3Transfers) || \
|
||||
// ((LENGTH) == TIM_DMABurstLength_4Transfers) || \
|
||||
// ((LENGTH) == TIM_DMABurstLength_5Transfers) || \
|
||||
// ((LENGTH) == TIM_DMABurstLength_6Transfers) || \
|
||||
// ((LENGTH) == TIM_DMABurstLength_7Transfers) || \
|
||||
// ((LENGTH) == TIM_DMABurstLength_8Transfers) || \
|
||||
// ((LENGTH) == TIM_DMABurstLength_9Transfers) || \
|
||||
// ((LENGTH) == TIM_DMABurstLength_10Transfers) || \
|
||||
// ((LENGTH) == TIM_DMABurstLength_11Transfers) || \
|
||||
// ((LENGTH) == TIM_DMABurstLength_12Transfers) || \
|
||||
// ((LENGTH) == TIM_DMABurstLength_13Transfers) || \
|
||||
// ((LENGTH) == TIM_DMABurstLength_14Transfers) || \
|
||||
// ((LENGTH) == TIM_DMABurstLength_15Transfers) || \
|
||||
// ((LENGTH) == TIM_DMABurstLength_16Transfers) || \
|
||||
// ((LENGTH) == TIM_DMABurstLength_17Transfers) || \
|
||||
// ((LENGTH) == TIM_DMABurstLength_18Transfers))
|
||||
|
||||
|
||||
//#define TIM_DMA_Update ((uint16_t)0x0100)
|
||||
//#define TIM_DMA_CC1 ((uint16_t)0x0200)
|
||||
//#define TIM_DMA_CC2 ((uint16_t)0x0400)
|
||||
//#define TIM_DMA_CC3 ((uint16_t)0x0800)
|
||||
//#define TIM_DMA_CC4 ((uint16_t)0x1000)
|
||||
//#define TIM_DMA_COM ((uint16_t)0x2000)
|
||||
//#define TIM_DMA_Trigger ((uint16_t)0x4000)
|
||||
//#define IS_TIM_DMA_SOURCE(SOURCE) ((((SOURCE) & (uint16_t)0x80FF) == 0x0000) && ((SOURCE) != 0x0000))
|
||||
|
||||
|
||||
|
||||
#define TIM_ExtTRGPSC_OFF ((uint16_t)0x0000)
|
||||
#define TIM_ExtTRGPSC_DIV2 ((uint16_t)0x1000)
|
||||
#define TIM_ExtTRGPSC_DIV4 ((uint16_t)0x2000)
|
||||
#define TIM_ExtTRGPSC_DIV8 ((uint16_t)0x3000)
|
||||
#define IS_TIM_EXT_PRESCALER(PRESCALER) (((PRESCALER) == TIM_ExtTRGPSC_OFF) || \
|
||||
((PRESCALER) == TIM_ExtTRGPSC_DIV2) || \
|
||||
((PRESCALER) == TIM_ExtTRGPSC_DIV4) || \
|
||||
((PRESCALER) == TIM_ExtTRGPSC_DIV8))
|
||||
|
||||
|
||||
//#define TIM_TS_ITR0 ((uint16_t)0x0000)
|
||||
//#define TIM_TS_ITR1 ((uint16_t)0x0010)
|
||||
//#define TIM_TS_ITR2 ((uint16_t)0x0020)
|
||||
//#define TIM_TS_ITR3 ((uint16_t)0x0030)
|
||||
//#define TIM_TS_TI1F_ED ((uint16_t)0x0040)
|
||||
//#define TIM_TS_TI1FP1 ((uint16_t)0x0050)
|
||||
//#define TIM_TS_TI2FP2 ((uint16_t)0x0060)
|
||||
//#define TIM_TS_ETRF ((uint16_t)0x0070)
|
||||
//#define IS_TIM_TRIGGER_SELECTION(SELECTION) (((SELECTION) == TIM_TS_ITR0) || \
|
||||
// ((SELECTION) == TIM_TS_ITR1) || \
|
||||
// ((SELECTION) == TIM_TS_ITR2) || \
|
||||
// ((SELECTION) == TIM_TS_ITR3) || \
|
||||
// ((SELECTION) == TIM_TS_TI1F_ED) || \
|
||||
// ((SELECTION) == TIM_TS_TI1FP1) || \
|
||||
// ((SELECTION) == TIM_TS_TI2FP2) || \
|
||||
// ((SELECTION) == TIM_TS_ETRF))
|
||||
#define IS_TIM_INTERNAL_TRIGGER_SELECTION(SELECTION) (((SELECTION) == TIM_TS_ITR0) || \
|
||||
((SELECTION) == TIM_TS_ITR1) || \
|
||||
((SELECTION) == TIM_TS_ITR2) || \
|
||||
((SELECTION) == TIM_TS_ITR3))
|
||||
|
||||
|
||||
#define TIM_TIxExternalCLK1Source_TI1 ((uint16_t)0x0050)
|
||||
#define TIM_TIxExternalCLK1Source_TI2 ((uint16_t)0x0060)
|
||||
#define TIM_TIxExternalCLK1Source_TI1ED ((uint16_t)0x0040)
|
||||
|
||||
|
||||
#define TIM_ExtTRGPolarity_Inverted ((uint16_t)0x8000)
|
||||
#define TIM_ExtTRGPolarity_NonInverted ((uint16_t)0x0000)
|
||||
#define IS_TIM_EXT_POLARITY(POLARITY) (((POLARITY) == TIM_ExtTRGPolarity_Inverted) || \
|
||||
((POLARITY) == TIM_ExtTRGPolarity_NonInverted))
|
||||
|
||||
|
||||
#define TIM_PSCReloadMode_Update ((uint16_t)0x0000)
|
||||
#define TIM_PSCReloadMode_Immediate ((uint16_t)0x0001)
|
||||
#define IS_TIM_PRESCALER_RELOAD(RELOAD) (((RELOAD) == TIM_PSCReloadMode_Update) || \
|
||||
((RELOAD) == TIM_PSCReloadMode_Immediate))
|
||||
|
||||
#define TIM_ForcedAction_Active ((uint16_t)0x0050)
|
||||
#define TIM_ForcedAction_InActive ((uint16_t)0x0040)
|
||||
#define IS_TIM_FORCED_ACTION(ACTION) (((ACTION) == TIM_ForcedAction_Active) || \
|
||||
((ACTION) == TIM_ForcedAction_InActive))
|
||||
|
||||
|
||||
#define TIM_EncoderMode_TI1 ((uint16_t)0x0001)
|
||||
#define TIM_EncoderMode_TI2 ((uint16_t)0x0002)
|
||||
#define TIM_EncoderMode_TI12 ((uint16_t)0x0003)
|
||||
//#define IS_TIM_ENCODER_MODE(MODE) (((MODE) == TIM_EncoderMode_TI1) || \
|
||||
// ((MODE) == TIM_EncoderMode_TI2) || \
|
||||
// ((MODE) == TIM_EncoderMode_TI12))
|
||||
|
||||
|
||||
//#define TIM_EventSource_Update ((uint16_t)0x0001)
|
||||
//#define TIM_EventSource_CC1 ((uint16_t)0x0002)
|
||||
//#define TIM_EventSource_CC2 ((uint16_t)0x0004)
|
||||
//#define TIM_EventSource_CC3 ((uint16_t)0x0008)
|
||||
//#define TIM_EventSource_CC4 ((uint16_t)0x0010)
|
||||
//#define TIM_EventSource_COM ((uint16_t)0x0020)
|
||||
//#define TIM_EventSource_Trigger ((uint16_t)0x0040)
|
||||
//#define TIM_EventSource_Break ((uint16_t)0x0080)
|
||||
//#define IS_TIM_EVENT_SOURCE(SOURCE) ((((SOURCE) & (uint16_t)0xFF00) == 0x0000) && ((SOURCE) != 0x0000))
|
||||
|
||||
|
||||
|
||||
#define TIM_UpdateSource_Global ((uint16_t)0x0000) /*!< Source of update is the counter overflow/underflow
|
||||
or the setting of UG bit, or an update generation
|
||||
through the slave mode controller. */
|
||||
#define TIM_UpdateSource_Regular ((uint16_t)0x0001) /*!< Source of update is counter overflow/underflow. */
|
||||
#define IS_TIM_UPDATE_SOURCE(SOURCE) (((SOURCE) == TIM_UpdateSource_Global) || \
|
||||
((SOURCE) == TIM_UpdateSource_Regular))
|
||||
|
||||
|
||||
#define TIM_OCPreload_Enable ((uint16_t)0x0008)
|
||||
#define TIM_OCPreload_Disable ((uint16_t)0x0000)
|
||||
#define IS_TIM_OCPRELOAD_STATE(STATE) (((STATE) == TIM_OCPreload_Enable) || \
|
||||
((STATE) == TIM_OCPreload_Disable))
|
||||
|
||||
|
||||
#define TIM_OCFast_Enable ((uint16_t)0x0004)
|
||||
#define TIM_OCFast_Disable ((uint16_t)0x0000)
|
||||
#define IS_TIM_OCFAST_STATE(STATE) (((STATE) == TIM_OCFast_Enable) || \
|
||||
((STATE) == TIM_OCFast_Disable))
|
||||
|
||||
|
||||
#define TIM_OCClear_Enable ((uint16_t)0x0080)
|
||||
#define TIM_OCClear_Disable ((uint16_t)0x0000)
|
||||
#define IS_TIM_OCCLEAR_STATE(STATE) (((STATE) == TIM_OCClear_Enable) || \
|
||||
((STATE) == TIM_OCClear_Disable))
|
||||
|
||||
#define TIM_TRGOSource_Reset ((uint16_t)0x0000)
|
||||
#define TIM_TRGOSource_Enable ((uint16_t)0x0010)
|
||||
#define TIM_TRGOSource_Update ((uint16_t)0x0020)
|
||||
#define TIM_TRGOSource_OC1 ((uint16_t)0x0030)
|
||||
#define TIM_TRGOSource_OC1Ref ((uint16_t)0x0040)
|
||||
#define TIM_TRGOSource_OC2Ref ((uint16_t)0x0050)
|
||||
#define TIM_TRGOSource_OC3Ref ((uint16_t)0x0060)
|
||||
#define TIM_TRGOSource_OC4Ref ((uint16_t)0x0070)
|
||||
//#define IS_TIM_TRGO_SOURCE(SOURCE) (((SOURCE) == TIM_TRGOSource_Reset) || \
|
||||
// ((SOURCE) == TIM_TRGOSource_Enable) || \
|
||||
// ((SOURCE) == TIM_TRGOSource_Update) || \
|
||||
// ((SOURCE) == TIM_TRGOSource_OC1) || \
|
||||
// ((SOURCE) == TIM_TRGOSource_OC1Ref) || \
|
||||
// ((SOURCE) == TIM_TRGOSource_OC2Ref) || \
|
||||
// ((SOURCE) == TIM_TRGOSource_OC3Ref) || \
|
||||
// ((SOURCE) == TIM_TRGOSource_OC4Ref))
|
||||
|
||||
|
||||
|
||||
|
||||
#define TIM_SlaveMode_Reset ((uint16_t)0x0004)
|
||||
#define TIM_SlaveMode_Gated ((uint16_t)0x0005)
|
||||
#define TIM_SlaveMode_Trigger ((uint16_t)0x0006)
|
||||
#define TIM_SlaveMode_External1 ((uint16_t)0x0007)
|
||||
//#define IS_TIM_SLAVE_MODE(MODE) (((MODE) == TIM_SlaveMode_Reset) || \
|
||||
// ((MODE) == TIM_SlaveMode_Gated) || \
|
||||
// ((MODE) == TIM_SlaveMode_Trigger) || \
|
||||
// ((MODE) == TIM_SlaveMode_External1))
|
||||
|
||||
#define TIM_MasterSlaveMode_Enable ((uint16_t)0x0080)
|
||||
#define TIM_MasterSlaveMode_Disable ((uint16_t)0x0000)
|
||||
//#define IS_TIM_MSM_STATE(STATE) (((STATE) == TIM_MasterSlaveMode_Enable) || \
|
||||
// ((STATE) == TIM_MasterSlaveMode_Disable))
|
||||
|
||||
#define TIM2_TIM8_TRGO ((uint16_t)0x0000)
|
||||
#define TIM2_ETH_PTP ((uint16_t)0x0400)
|
||||
#define TIM2_USBFS_SOF ((uint16_t)0x0800)
|
||||
#define TIM2_USBHS_SOF ((uint16_t)0x0C00)
|
||||
|
||||
#define TIM5_GPIO ((uint16_t)0x0000)
|
||||
#define TIM5_LSI ((uint16_t)0x0040)
|
||||
#define TIM5_LSE ((uint16_t)0x0080)
|
||||
#define TIM5_RTC ((uint16_t)0x00C0)
|
||||
|
||||
#define TIM11_GPIO ((uint16_t)0x0000)
|
||||
#define TIM11_HSE ((uint16_t)0x0002)
|
||||
|
||||
|
||||
enum EncTimer {
|
||||
Tim2,
|
||||
Tim3,
|
||||
Tim4,
|
||||
Tim8
|
||||
};
|
||||
|
||||
class Encoder
|
||||
{
|
||||
private:
|
||||
int _pin;
|
||||
|
||||
public:
|
||||
void eattach(int enco);
|
||||
Encoder();
|
||||
void SetCount( enum EncTimer enc, int64_t Counter);
|
||||
uint16_t GetCount( enum EncTimer enc);
|
||||
void attachh(int encoNumber);
|
||||
uint16_t c;
|
||||
};
|
||||
|
||||
void rcc_config();
|
||||
void GpioConfigPortA(GPIO_TypeDef * GPIOx) ;
|
||||
void GpioConfigPortC(GPIO_TypeDef * GPIOx) ;
|
||||
void GpioConfigPortD(GPIO_TypeDef * GPIOx) ;
|
||||
void TIM_EncoderInterConfig(TIM_TypeDef* TIMx, uint16_t TIM_EncoderMode, uint16_t TIM_IC1Polarity, uint16_t TIM_IC2Polarity);
|
||||
void TIM_TimeBaseStructInit(TIM_TimeBaseInitTypeDef* TIM_TimeBaseInitStruct);
|
||||
void TIM_TimeBaseInit(TIM_TypeDef* TIMx, TIM_TimeBaseInitTypeDef* TIM_TimeBaseInitStruct);
|
||||
#endif
|
||||
46
Pcb-1-lan9252/Firmware/lib/README
Executable file
46
Pcb-1-lan9252/Firmware/lib/README
Executable file
@@ -0,0 +1,46 @@
|
||||
|
||||
This directory is intended for project specific (private) libraries.
|
||||
PlatformIO will compile them to static libraries and link into executable file.
|
||||
|
||||
The source code of each library should be placed in a an own separate directory
|
||||
("lib/your_library_name/[here are source files]").
|
||||
|
||||
For example, see a structure of the following two libraries `Foo` and `Bar`:
|
||||
|
||||
|--lib
|
||||
| |
|
||||
| |--Bar
|
||||
| | |--docs
|
||||
| | |--examples
|
||||
| | |--src
|
||||
| | |- Bar.c
|
||||
| | |- Bar.h
|
||||
| | |- library.json (optional, custom build options, etc) https://docs.platformio.org/page/librarymanager/config.html
|
||||
| |
|
||||
| |--Foo
|
||||
| | |- Foo.c
|
||||
| | |- Foo.h
|
||||
| |
|
||||
| |- README --> THIS FILE
|
||||
|
|
||||
|- platformio.ini
|
||||
|--src
|
||||
|- main.c
|
||||
|
||||
and a contents of `src/main.c`:
|
||||
```
|
||||
#include <Foo.h>
|
||||
#include <Bar.h>
|
||||
|
||||
int main (void)
|
||||
{
|
||||
...
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
PlatformIO Library Dependency Finder will find automatically dependent
|
||||
libraries scanning project source files.
|
||||
|
||||
More information about PlatformIO Library Dependency Finder
|
||||
- https://docs.platformio.org/page/librarymanager/ldf.html
|
||||
29
Pcb-1-lan9252/Firmware/lib/soes/CMakeLists.txt
Executable file
29
Pcb-1-lan9252/Firmware/lib/soes/CMakeLists.txt
Executable file
@@ -0,0 +1,29 @@
|
||||
|
||||
# NOTE: add headers to make them show up in an IDE
|
||||
add_library (soes
|
||||
esc.c
|
||||
esc.h
|
||||
esc_coe.c
|
||||
esc_coe.h
|
||||
esc_foe.c
|
||||
esc_foe.h
|
||||
esc_eoe.c
|
||||
esc_eoe.h
|
||||
esc_eep.c
|
||||
esc_eep.h
|
||||
ecat_slv.c
|
||||
ecat_slv.h
|
||||
options.h
|
||||
${HAL_SOURCES}
|
||||
)
|
||||
|
||||
include_directories(${HAL_INCLUDES})
|
||||
|
||||
install (TARGETS soes DESTINATION bin)
|
||||
install (FILES
|
||||
esc.h
|
||||
esc_coe.h
|
||||
esc_foe.h
|
||||
esc_eoe.h
|
||||
esc_eep.h
|
||||
DESTINATION include)
|
||||
1742
Pcb-1-lan9252/Firmware/lib/soes/Doxyfile
Executable file
1742
Pcb-1-lan9252/Firmware/lib/soes/Doxyfile
Executable file
File diff suppressed because it is too large
Load Diff
941
Pcb-1-lan9252/Firmware/lib/soes/MetalMusings_EaserCAT_2000.xml
Executable file
941
Pcb-1-lan9252/Firmware/lib/soes/MetalMusings_EaserCAT_2000.xml
Executable file
@@ -0,0 +1,941 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<EtherCATInfo>
|
||||
<Vendor>
|
||||
<Id>2730</Id>
|
||||
<Name LcId="1033">MetalMusings</Name>
|
||||
</Vendor>
|
||||
<Descriptions>
|
||||
<Groups>
|
||||
<Group>
|
||||
<Type>MachineControl</Type>
|
||||
<Name LcId="1033">Incremental encoder</Name>
|
||||
</Group>
|
||||
</Groups>
|
||||
<Devices>
|
||||
<Device Physics="YY ">
|
||||
<Type ProductCode="#xbbbccc" RevisionNo="#x2">EaserCAT2000</Type>
|
||||
<Name LcId="1033">MetalMusings EaserCAT 2000</Name>
|
||||
<GroupType>MachineControl</GroupType>
|
||||
<Profile>
|
||||
<ProfileNo>5001</ProfileNo>
|
||||
<AddInfo>0</AddInfo>
|
||||
<Dictionary>
|
||||
<DataTypes>
|
||||
<DataType>
|
||||
<Name>DT1018</Name>
|
||||
<BitSize>144</BitSize>
|
||||
<SubItem>
|
||||
<SubIdx>0</SubIdx>
|
||||
<Name>Max SubIndex</Name>
|
||||
<Type>USINT</Type>
|
||||
<BitSize>8</BitSize>
|
||||
<BitOffs>0</BitOffs>
|
||||
<Flags>
|
||||
<Access>ro</Access>
|
||||
</Flags>
|
||||
</SubItem>
|
||||
<SubItem>
|
||||
<SubIdx>1</SubIdx>
|
||||
<Name>Vendor ID</Name>
|
||||
<Type>UDINT</Type>
|
||||
<BitSize>32</BitSize>
|
||||
<BitOffs>16</BitOffs>
|
||||
<Flags>
|
||||
<Access>ro</Access>
|
||||
</Flags>
|
||||
</SubItem>
|
||||
<SubItem>
|
||||
<SubIdx>2</SubIdx>
|
||||
<Name>Product Code</Name>
|
||||
<Type>UDINT</Type>
|
||||
<BitSize>32</BitSize>
|
||||
<BitOffs>48</BitOffs>
|
||||
<Flags>
|
||||
<Access>ro</Access>
|
||||
</Flags>
|
||||
</SubItem>
|
||||
<SubItem>
|
||||
<SubIdx>3</SubIdx>
|
||||
<Name>Revision Number</Name>
|
||||
<Type>UDINT</Type>
|
||||
<BitSize>32</BitSize>
|
||||
<BitOffs>80</BitOffs>
|
||||
<Flags>
|
||||
<Access>ro</Access>
|
||||
</Flags>
|
||||
</SubItem>
|
||||
<SubItem>
|
||||
<SubIdx>4</SubIdx>
|
||||
<Name>Serial Number</Name>
|
||||
<Type>UDINT</Type>
|
||||
<BitSize>32</BitSize>
|
||||
<BitOffs>112</BitOffs>
|
||||
<Flags>
|
||||
<Access>ro</Access>
|
||||
</Flags>
|
||||
</SubItem>
|
||||
</DataType>
|
||||
<DataType>
|
||||
<Name>DT1600</Name>
|
||||
<BitSize>48</BitSize>
|
||||
<SubItem>
|
||||
<SubIdx>0</SubIdx>
|
||||
<Name>Max SubIndex</Name>
|
||||
<Type>USINT</Type>
|
||||
<BitSize>8</BitSize>
|
||||
<BitOffs>0</BitOffs>
|
||||
<Flags>
|
||||
<Access>ro</Access>
|
||||
</Flags>
|
||||
</SubItem>
|
||||
<SubItem>
|
||||
<SubIdx>1</SubIdx>
|
||||
<Name>EncPosScale</Name>
|
||||
<Type>UDINT</Type>
|
||||
<BitSize>32</BitSize>
|
||||
<BitOffs>16</BitOffs>
|
||||
<Flags>
|
||||
<Access>ro</Access>
|
||||
</Flags>
|
||||
</SubItem>
|
||||
</DataType>
|
||||
<DataType>
|
||||
<Name>DT1601</Name>
|
||||
<BitSize>48</BitSize>
|
||||
<SubItem>
|
||||
<SubIdx>0</SubIdx>
|
||||
<Name>Max SubIndex</Name>
|
||||
<Type>USINT</Type>
|
||||
<BitSize>8</BitSize>
|
||||
<BitOffs>0</BitOffs>
|
||||
<Flags>
|
||||
<Access>ro</Access>
|
||||
</Flags>
|
||||
</SubItem>
|
||||
<SubItem>
|
||||
<SubIdx>1</SubIdx>
|
||||
<Name>IndexLatchEnable</Name>
|
||||
<Type>UDINT</Type>
|
||||
<BitSize>32</BitSize>
|
||||
<BitOffs>16</BitOffs>
|
||||
<Flags>
|
||||
<Access>ro</Access>
|
||||
</Flags>
|
||||
</SubItem>
|
||||
</DataType>
|
||||
<DataType>
|
||||
<Name>DT1A00</Name>
|
||||
<BitSize>48</BitSize>
|
||||
<SubItem>
|
||||
<SubIdx>0</SubIdx>
|
||||
<Name>Max SubIndex</Name>
|
||||
<Type>USINT</Type>
|
||||
<BitSize>8</BitSize>
|
||||
<BitOffs>0</BitOffs>
|
||||
<Flags>
|
||||
<Access>ro</Access>
|
||||
</Flags>
|
||||
</SubItem>
|
||||
<SubItem>
|
||||
<SubIdx>1</SubIdx>
|
||||
<Name>EncPos</Name>
|
||||
<Type>UDINT</Type>
|
||||
<BitSize>32</BitSize>
|
||||
<BitOffs>16</BitOffs>
|
||||
<Flags>
|
||||
<Access>ro</Access>
|
||||
</Flags>
|
||||
</SubItem>
|
||||
</DataType>
|
||||
<DataType>
|
||||
<Name>DT1A01</Name>
|
||||
<BitSize>48</BitSize>
|
||||
<SubItem>
|
||||
<SubIdx>0</SubIdx>
|
||||
<Name>Max SubIndex</Name>
|
||||
<Type>USINT</Type>
|
||||
<BitSize>8</BitSize>
|
||||
<BitOffs>0</BitOffs>
|
||||
<Flags>
|
||||
<Access>ro</Access>
|
||||
</Flags>
|
||||
</SubItem>
|
||||
<SubItem>
|
||||
<SubIdx>1</SubIdx>
|
||||
<Name>EncFrequency</Name>
|
||||
<Type>UDINT</Type>
|
||||
<BitSize>32</BitSize>
|
||||
<BitOffs>16</BitOffs>
|
||||
<Flags>
|
||||
<Access>ro</Access>
|
||||
</Flags>
|
||||
</SubItem>
|
||||
</DataType>
|
||||
<DataType>
|
||||
<Name>DT1A02</Name>
|
||||
<BitSize>48</BitSize>
|
||||
<SubItem>
|
||||
<SubIdx>0</SubIdx>
|
||||
<Name>Max SubIndex</Name>
|
||||
<Type>USINT</Type>
|
||||
<BitSize>8</BitSize>
|
||||
<BitOffs>0</BitOffs>
|
||||
<Flags>
|
||||
<Access>ro</Access>
|
||||
</Flags>
|
||||
</SubItem>
|
||||
<SubItem>
|
||||
<SubIdx>1</SubIdx>
|
||||
<Name>DiffT</Name>
|
||||
<Type>UDINT</Type>
|
||||
<BitSize>32</BitSize>
|
||||
<BitOffs>16</BitOffs>
|
||||
<Flags>
|
||||
<Access>ro</Access>
|
||||
</Flags>
|
||||
</SubItem>
|
||||
</DataType>
|
||||
<DataType>
|
||||
<Name>DT1A03</Name>
|
||||
<BitSize>48</BitSize>
|
||||
<SubItem>
|
||||
<SubIdx>0</SubIdx>
|
||||
<Name>Max SubIndex</Name>
|
||||
<Type>USINT</Type>
|
||||
<BitSize>8</BitSize>
|
||||
<BitOffs>0</BitOffs>
|
||||
<Flags>
|
||||
<Access>ro</Access>
|
||||
</Flags>
|
||||
</SubItem>
|
||||
<SubItem>
|
||||
<SubIdx>1</SubIdx>
|
||||
<Name>IndexByte</Name>
|
||||
<Type>UDINT</Type>
|
||||
<BitSize>32</BitSize>
|
||||
<BitOffs>16</BitOffs>
|
||||
<Flags>
|
||||
<Access>ro</Access>
|
||||
</Flags>
|
||||
</SubItem>
|
||||
</DataType>
|
||||
<DataType>
|
||||
<Name>DT1A04</Name>
|
||||
<BitSize>48</BitSize>
|
||||
<SubItem>
|
||||
<SubIdx>0</SubIdx>
|
||||
<Name>Max SubIndex</Name>
|
||||
<Type>USINT</Type>
|
||||
<BitSize>8</BitSize>
|
||||
<BitOffs>0</BitOffs>
|
||||
<Flags>
|
||||
<Access>ro</Access>
|
||||
</Flags>
|
||||
</SubItem>
|
||||
<SubItem>
|
||||
<SubIdx>1</SubIdx>
|
||||
<Name>IndexStatus</Name>
|
||||
<Type>UDINT</Type>
|
||||
<BitSize>32</BitSize>
|
||||
<BitOffs>16</BitOffs>
|
||||
<Flags>
|
||||
<Access>ro</Access>
|
||||
</Flags>
|
||||
</SubItem>
|
||||
</DataType>
|
||||
<DataType>
|
||||
<Name>DT1C00ARR</Name>
|
||||
<BaseType>USINT</BaseType>
|
||||
<BitSize>32</BitSize>
|
||||
<ArrayInfo>
|
||||
<LBound>1</LBound>
|
||||
<Elements>4</Elements>
|
||||
</ArrayInfo>
|
||||
</DataType>
|
||||
<DataType>
|
||||
<Name>DT1C00</Name>
|
||||
<BitSize>48</BitSize>
|
||||
<SubItem>
|
||||
<SubIdx>0</SubIdx>
|
||||
<Name>Max SubIndex</Name>
|
||||
<Type>USINT</Type>
|
||||
<BitSize>8</BitSize>
|
||||
<BitOffs>0</BitOffs>
|
||||
<Flags>
|
||||
<Access>ro</Access>
|
||||
</Flags>
|
||||
</SubItem>
|
||||
<SubItem>
|
||||
<Name>Elements</Name>
|
||||
<Type>DT1C00ARR</Type>
|
||||
<BitSize>32</BitSize>
|
||||
<BitOffs>16</BitOffs>
|
||||
<Flags>
|
||||
<Access>ro</Access>
|
||||
</Flags>
|
||||
</SubItem>
|
||||
</DataType>
|
||||
<DataType>
|
||||
<Name>DT1C12ARR</Name>
|
||||
<BaseType>UINT</BaseType>
|
||||
<BitSize>32</BitSize>
|
||||
<ArrayInfo>
|
||||
<LBound>1</LBound>
|
||||
<Elements>2</Elements>
|
||||
</ArrayInfo>
|
||||
</DataType>
|
||||
<DataType>
|
||||
<Name>DT1C12</Name>
|
||||
<BitSize>48</BitSize>
|
||||
<SubItem>
|
||||
<SubIdx>0</SubIdx>
|
||||
<Name>Max SubIndex</Name>
|
||||
<Type>USINT</Type>
|
||||
<BitSize>8</BitSize>
|
||||
<BitOffs>0</BitOffs>
|
||||
<Flags>
|
||||
<Access>ro</Access>
|
||||
</Flags>
|
||||
</SubItem>
|
||||
<SubItem>
|
||||
<Name>Elements</Name>
|
||||
<Type>DT1C12ARR</Type>
|
||||
<BitSize>32</BitSize>
|
||||
<BitOffs>16</BitOffs>
|
||||
<Flags>
|
||||
<Access>ro</Access>
|
||||
</Flags>
|
||||
</SubItem>
|
||||
</DataType>
|
||||
<DataType>
|
||||
<Name>DT1C13ARR</Name>
|
||||
<BaseType>UINT</BaseType>
|
||||
<BitSize>80</BitSize>
|
||||
<ArrayInfo>
|
||||
<LBound>1</LBound>
|
||||
<Elements>5</Elements>
|
||||
</ArrayInfo>
|
||||
</DataType>
|
||||
<DataType>
|
||||
<Name>DT1C13</Name>
|
||||
<BitSize>96</BitSize>
|
||||
<SubItem>
|
||||
<SubIdx>0</SubIdx>
|
||||
<Name>Max SubIndex</Name>
|
||||
<Type>USINT</Type>
|
||||
<BitSize>8</BitSize>
|
||||
<BitOffs>0</BitOffs>
|
||||
<Flags>
|
||||
<Access>ro</Access>
|
||||
</Flags>
|
||||
</SubItem>
|
||||
<SubItem>
|
||||
<Name>Elements</Name>
|
||||
<Type>DT1C13ARR</Type>
|
||||
<BitSize>80</BitSize>
|
||||
<BitOffs>16</BitOffs>
|
||||
<Flags>
|
||||
<Access>ro</Access>
|
||||
</Flags>
|
||||
</SubItem>
|
||||
</DataType>
|
||||
<DataType>
|
||||
<Name>UDINT</Name>
|
||||
<BitSize>32</BitSize>
|
||||
</DataType>
|
||||
<DataType>
|
||||
<Name>STRING(26)</Name>
|
||||
<BitSize>208</BitSize>
|
||||
</DataType>
|
||||
<DataType>
|
||||
<Name>STRING(5)</Name>
|
||||
<BitSize>40</BitSize>
|
||||
</DataType>
|
||||
<DataType>
|
||||
<Name>USINT</Name>
|
||||
<BitSize>8</BitSize>
|
||||
</DataType>
|
||||
<DataType>
|
||||
<Name>UINT</Name>
|
||||
<BitSize>16</BitSize>
|
||||
</DataType>
|
||||
<DataType>
|
||||
<Name>REAL</Name>
|
||||
<BitSize>32</BitSize>
|
||||
</DataType>
|
||||
<DataType>
|
||||
<Name>DINT</Name>
|
||||
<BitSize>32</BitSize>
|
||||
</DataType>
|
||||
</DataTypes>
|
||||
<Objects>
|
||||
<Object>
|
||||
<Index>#x1000</Index>
|
||||
<Name>Device Type</Name>
|
||||
<Type>UDINT</Type>
|
||||
<BitSize>32</BitSize>
|
||||
<Info>
|
||||
<DefaultValue>5001</DefaultValue>
|
||||
</Info>
|
||||
<Flags>
|
||||
<Access>ro</Access>
|
||||
<Category>m</Category>
|
||||
</Flags>
|
||||
</Object>
|
||||
<Object>
|
||||
<Index>#x1008</Index>
|
||||
<Name>Device Name</Name>
|
||||
<Type>STRING(26)</Type>
|
||||
<BitSize>208</BitSize>
|
||||
<Info>
|
||||
<DefaultString>MetalMusings EaserCAT 2000</DefaultString>
|
||||
</Info>
|
||||
<Flags>
|
||||
<Access>ro</Access>
|
||||
</Flags>
|
||||
</Object>
|
||||
<Object>
|
||||
<Index>#x1009</Index>
|
||||
<Name>Hardware Version</Name>
|
||||
<Type>STRING(5)</Type>
|
||||
<BitSize>40</BitSize>
|
||||
<Info>
|
||||
<DefaultString>0.0.1</DefaultString>
|
||||
</Info>
|
||||
<Flags>
|
||||
<Access>ro</Access>
|
||||
<Category>o</Category>
|
||||
</Flags>
|
||||
</Object>
|
||||
<Object>
|
||||
<Index>#x100A</Index>
|
||||
<Name>Software Version</Name>
|
||||
<Type>STRING(5)</Type>
|
||||
<BitSize>40</BitSize>
|
||||
<Info>
|
||||
<DefaultString>0.0.1</DefaultString>
|
||||
</Info>
|
||||
<Flags>
|
||||
<Access>ro</Access>
|
||||
</Flags>
|
||||
</Object>
|
||||
<Object>
|
||||
<Index>#x1018</Index>
|
||||
<Name>Identity Object</Name>
|
||||
<Type>DT1018</Type>
|
||||
<BitSize>144</BitSize>
|
||||
<Info>
|
||||
<SubItem>
|
||||
<Name>Max SubIndex</Name>
|
||||
<Info>
|
||||
<DefaultValue>4</DefaultValue>
|
||||
</Info>
|
||||
</SubItem>
|
||||
<SubItem>
|
||||
<Name>Vendor ID</Name>
|
||||
<Info>
|
||||
<DefaultValue>2730</DefaultValue>
|
||||
</Info>
|
||||
</SubItem>
|
||||
<SubItem>
|
||||
<Name>Product Code</Name>
|
||||
<Info>
|
||||
<DefaultValue>12303564</DefaultValue>
|
||||
</Info>
|
||||
</SubItem>
|
||||
<SubItem>
|
||||
<Name>Revision Number</Name>
|
||||
<Info>
|
||||
<DefaultValue>2</DefaultValue>
|
||||
</Info>
|
||||
</SubItem>
|
||||
<SubItem>
|
||||
<Name>Serial Number</Name>
|
||||
<Info>
|
||||
<DefaultValue>1</DefaultValue>
|
||||
</Info>
|
||||
</SubItem>
|
||||
</Info>
|
||||
<Flags>
|
||||
<Access>ro</Access>
|
||||
</Flags>
|
||||
</Object>
|
||||
<Object>
|
||||
<Index>#x1600</Index>
|
||||
<Name>EncPosScale</Name>
|
||||
<Type>DT1600</Type>
|
||||
<BitSize>48</BitSize>
|
||||
<Info>
|
||||
<SubItem>
|
||||
<Name>Max SubIndex</Name>
|
||||
<Info>
|
||||
<DefaultValue>1</DefaultValue>
|
||||
</Info>
|
||||
</SubItem>
|
||||
<SubItem>
|
||||
<Name>EncPosScale</Name>
|
||||
<Info>
|
||||
<DefaultValue>#x70000020</DefaultValue>
|
||||
</Info>
|
||||
</SubItem>
|
||||
</Info>
|
||||
<Flags>
|
||||
<Access>ro</Access>
|
||||
</Flags>
|
||||
</Object>
|
||||
<Object>
|
||||
<Index>#x1601</Index>
|
||||
<Name>IndexLatchEnable</Name>
|
||||
<Type>DT1601</Type>
|
||||
<BitSize>48</BitSize>
|
||||
<Info>
|
||||
<SubItem>
|
||||
<Name>Max SubIndex</Name>
|
||||
<Info>
|
||||
<DefaultValue>1</DefaultValue>
|
||||
</Info>
|
||||
</SubItem>
|
||||
<SubItem>
|
||||
<Name>IndexLatchEnable</Name>
|
||||
<Info>
|
||||
<DefaultValue>#x70010020</DefaultValue>
|
||||
</Info>
|
||||
</SubItem>
|
||||
</Info>
|
||||
<Flags>
|
||||
<Access>ro</Access>
|
||||
</Flags>
|
||||
</Object>
|
||||
<Object>
|
||||
<Index>#x1A00</Index>
|
||||
<Name>EncPos</Name>
|
||||
<Type>DT1A00</Type>
|
||||
<BitSize>48</BitSize>
|
||||
<Info>
|
||||
<SubItem>
|
||||
<Name>Max SubIndex</Name>
|
||||
<Info>
|
||||
<DefaultValue>1</DefaultValue>
|
||||
</Info>
|
||||
</SubItem>
|
||||
<SubItem>
|
||||
<Name>EncPos</Name>
|
||||
<Info>
|
||||
<DefaultValue>#x60000020</DefaultValue>
|
||||
</Info>
|
||||
</SubItem>
|
||||
</Info>
|
||||
<Flags>
|
||||
<Access>ro</Access>
|
||||
</Flags>
|
||||
</Object>
|
||||
<Object>
|
||||
<Index>#x1A01</Index>
|
||||
<Name>EncFrequency</Name>
|
||||
<Type>DT1A01</Type>
|
||||
<BitSize>48</BitSize>
|
||||
<Info>
|
||||
<SubItem>
|
||||
<Name>Max SubIndex</Name>
|
||||
<Info>
|
||||
<DefaultValue>1</DefaultValue>
|
||||
</Info>
|
||||
</SubItem>
|
||||
<SubItem>
|
||||
<Name>EncFrequency</Name>
|
||||
<Info>
|
||||
<DefaultValue>#x60010020</DefaultValue>
|
||||
</Info>
|
||||
</SubItem>
|
||||
</Info>
|
||||
<Flags>
|
||||
<Access>ro</Access>
|
||||
</Flags>
|
||||
</Object>
|
||||
<Object>
|
||||
<Index>#x1A02</Index>
|
||||
<Name>DiffT</Name>
|
||||
<Type>DT1A02</Type>
|
||||
<BitSize>48</BitSize>
|
||||
<Info>
|
||||
<SubItem>
|
||||
<Name>Max SubIndex</Name>
|
||||
<Info>
|
||||
<DefaultValue>1</DefaultValue>
|
||||
</Info>
|
||||
</SubItem>
|
||||
<SubItem>
|
||||
<Name>DiffT</Name>
|
||||
<Info>
|
||||
<DefaultValue>#x60020020</DefaultValue>
|
||||
</Info>
|
||||
</SubItem>
|
||||
</Info>
|
||||
<Flags>
|
||||
<Access>ro</Access>
|
||||
</Flags>
|
||||
</Object>
|
||||
<Object>
|
||||
<Index>#x1A03</Index>
|
||||
<Name>IndexByte</Name>
|
||||
<Type>DT1A03</Type>
|
||||
<BitSize>48</BitSize>
|
||||
<Info>
|
||||
<SubItem>
|
||||
<Name>Max SubIndex</Name>
|
||||
<Info>
|
||||
<DefaultValue>1</DefaultValue>
|
||||
</Info>
|
||||
</SubItem>
|
||||
<SubItem>
|
||||
<Name>IndexByte</Name>
|
||||
<Info>
|
||||
<DefaultValue>#x60030020</DefaultValue>
|
||||
</Info>
|
||||
</SubItem>
|
||||
</Info>
|
||||
<Flags>
|
||||
<Access>ro</Access>
|
||||
</Flags>
|
||||
</Object>
|
||||
<Object>
|
||||
<Index>#x1A04</Index>
|
||||
<Name>IndexStatus</Name>
|
||||
<Type>DT1A04</Type>
|
||||
<BitSize>48</BitSize>
|
||||
<Info>
|
||||
<SubItem>
|
||||
<Name>Max SubIndex</Name>
|
||||
<Info>
|
||||
<DefaultValue>1</DefaultValue>
|
||||
</Info>
|
||||
</SubItem>
|
||||
<SubItem>
|
||||
<Name>IndexStatus</Name>
|
||||
<Info>
|
||||
<DefaultValue>#x60040020</DefaultValue>
|
||||
</Info>
|
||||
</SubItem>
|
||||
</Info>
|
||||
<Flags>
|
||||
<Access>ro</Access>
|
||||
</Flags>
|
||||
</Object>
|
||||
<Object>
|
||||
<Index>#x1C00</Index>
|
||||
<Name>Sync Manager Communication Type</Name>
|
||||
<Type>DT1C00</Type>
|
||||
<BitSize>48</BitSize>
|
||||
<Info>
|
||||
<SubItem>
|
||||
<Name>Max SubIndex</Name>
|
||||
<Info>
|
||||
<DefaultValue>4</DefaultValue>
|
||||
</Info>
|
||||
</SubItem>
|
||||
<SubItem>
|
||||
<Name>Communications Type SM0</Name>
|
||||
<Info>
|
||||
<DefaultValue>1</DefaultValue>
|
||||
</Info>
|
||||
</SubItem>
|
||||
<SubItem>
|
||||
<Name>Communications Type SM1</Name>
|
||||
<Info>
|
||||
<DefaultValue>2</DefaultValue>
|
||||
</Info>
|
||||
</SubItem>
|
||||
<SubItem>
|
||||
<Name>Communications Type SM2</Name>
|
||||
<Info>
|
||||
<DefaultValue>3</DefaultValue>
|
||||
</Info>
|
||||
</SubItem>
|
||||
<SubItem>
|
||||
<Name>Communications Type SM3</Name>
|
||||
<Info>
|
||||
<DefaultValue>4</DefaultValue>
|
||||
</Info>
|
||||
</SubItem>
|
||||
</Info>
|
||||
<Flags>
|
||||
<Access>ro</Access>
|
||||
</Flags>
|
||||
</Object>
|
||||
<Object>
|
||||
<Index>#x1C12</Index>
|
||||
<Name>Sync Manager 2 PDO Assignment</Name>
|
||||
<Type>DT1C12</Type>
|
||||
<BitSize>48</BitSize>
|
||||
<Info>
|
||||
<SubItem>
|
||||
<Name>Max SubIndex</Name>
|
||||
<Info>
|
||||
<DefaultValue>2</DefaultValue>
|
||||
</Info>
|
||||
</SubItem>
|
||||
<SubItem>
|
||||
<Name>PDO Mapping</Name>
|
||||
<Info>
|
||||
<DefaultValue>#x1600</DefaultValue>
|
||||
</Info>
|
||||
</SubItem>
|
||||
<SubItem>
|
||||
<Name>PDO Mapping</Name>
|
||||
<Info>
|
||||
<DefaultValue>#x1601</DefaultValue>
|
||||
</Info>
|
||||
</SubItem>
|
||||
</Info>
|
||||
<Flags>
|
||||
<Access>ro</Access>
|
||||
</Flags>
|
||||
</Object>
|
||||
<Object>
|
||||
<Index>#x1C13</Index>
|
||||
<Name>Sync Manager 3 PDO Assignment</Name>
|
||||
<Type>DT1C13</Type>
|
||||
<BitSize>96</BitSize>
|
||||
<Info>
|
||||
<SubItem>
|
||||
<Name>Max SubIndex</Name>
|
||||
<Info>
|
||||
<DefaultValue>5</DefaultValue>
|
||||
</Info>
|
||||
</SubItem>
|
||||
<SubItem>
|
||||
<Name>PDO Mapping</Name>
|
||||
<Info>
|
||||
<DefaultValue>#x1A00</DefaultValue>
|
||||
</Info>
|
||||
</SubItem>
|
||||
<SubItem>
|
||||
<Name>PDO Mapping</Name>
|
||||
<Info>
|
||||
<DefaultValue>#x1A01</DefaultValue>
|
||||
</Info>
|
||||
</SubItem>
|
||||
<SubItem>
|
||||
<Name>PDO Mapping</Name>
|
||||
<Info>
|
||||
<DefaultValue>#x1A02</DefaultValue>
|
||||
</Info>
|
||||
</SubItem>
|
||||
<SubItem>
|
||||
<Name>PDO Mapping</Name>
|
||||
<Info>
|
||||
<DefaultValue>#x1A03</DefaultValue>
|
||||
</Info>
|
||||
</SubItem>
|
||||
<SubItem>
|
||||
<Name>PDO Mapping</Name>
|
||||
<Info>
|
||||
<DefaultValue>#x1A04</DefaultValue>
|
||||
</Info>
|
||||
</SubItem>
|
||||
</Info>
|
||||
<Flags>
|
||||
<Access>ro</Access>
|
||||
</Flags>
|
||||
</Object>
|
||||
<Object>
|
||||
<Index>#x6000</Index>
|
||||
<Name>EncPos</Name>
|
||||
<Type>REAL</Type>
|
||||
<BitSize>32</BitSize>
|
||||
<Info>
|
||||
<DefaultValue>0</DefaultValue>
|
||||
</Info>
|
||||
<Flags>
|
||||
<Access>ro</Access>
|
||||
<PdoMapping>T</PdoMapping>
|
||||
</Flags>
|
||||
</Object>
|
||||
<Object>
|
||||
<Index>#x6001</Index>
|
||||
<Name>EncFrequency</Name>
|
||||
<Type>REAL</Type>
|
||||
<BitSize>32</BitSize>
|
||||
<Info>
|
||||
<DefaultValue>0</DefaultValue>
|
||||
</Info>
|
||||
<Flags>
|
||||
<Access>ro</Access>
|
||||
<PdoMapping>T</PdoMapping>
|
||||
</Flags>
|
||||
</Object>
|
||||
<Object>
|
||||
<Index>#x6002</Index>
|
||||
<Name>DiffT</Name>
|
||||
<Type>UDINT</Type>
|
||||
<BitSize>32</BitSize>
|
||||
<Info>
|
||||
<DefaultValue>0</DefaultValue>
|
||||
</Info>
|
||||
<Flags>
|
||||
<Access>ro</Access>
|
||||
<PdoMapping>T</PdoMapping>
|
||||
</Flags>
|
||||
</Object>
|
||||
<Object>
|
||||
<Index>#x6003</Index>
|
||||
<Name>IndexByte</Name>
|
||||
<Type>UDINT</Type>
|
||||
<BitSize>32</BitSize>
|
||||
<Info>
|
||||
<DefaultValue>0</DefaultValue>
|
||||
</Info>
|
||||
<Flags>
|
||||
<Access>ro</Access>
|
||||
<PdoMapping>T</PdoMapping>
|
||||
</Flags>
|
||||
</Object>
|
||||
<Object>
|
||||
<Index>#x6004</Index>
|
||||
<Name>IndexStatus</Name>
|
||||
<Type>UDINT</Type>
|
||||
<BitSize>32</BitSize>
|
||||
<Info>
|
||||
<DefaultValue>0</DefaultValue>
|
||||
</Info>
|
||||
<Flags>
|
||||
<Access>ro</Access>
|
||||
<PdoMapping>T</PdoMapping>
|
||||
</Flags>
|
||||
</Object>
|
||||
<Object>
|
||||
<Index>#x7000</Index>
|
||||
<Name>EncPosScale</Name>
|
||||
<Type>DINT</Type>
|
||||
<BitSize>32</BitSize>
|
||||
<Info>
|
||||
<DefaultValue>0</DefaultValue>
|
||||
</Info>
|
||||
<Flags>
|
||||
<Access>ro</Access>
|
||||
<PdoMapping>R</PdoMapping>
|
||||
</Flags>
|
||||
</Object>
|
||||
<Object>
|
||||
<Index>#x7001</Index>
|
||||
<Name>IndexLatchEnable</Name>
|
||||
<Type>UDINT</Type>
|
||||
<BitSize>32</BitSize>
|
||||
<Info>
|
||||
<DefaultValue>0</DefaultValue>
|
||||
</Info>
|
||||
<Flags>
|
||||
<Access>ro</Access>
|
||||
<PdoMapping>R</PdoMapping>
|
||||
</Flags>
|
||||
</Object>
|
||||
</Objects>
|
||||
</Dictionary>
|
||||
</Profile>
|
||||
<Fmmu>Outputs</Fmmu>
|
||||
<Fmmu>Inputs</Fmmu>
|
||||
<Fmmu>MBoxState</Fmmu>
|
||||
<Sm DefaultSize="512" StartAddress="#x1000" ControlByte="#x26" Enable="1">MBoxOut</Sm>
|
||||
<Sm DefaultSize="512" StartAddress="#x1200" ControlByte="#x22" Enable="1">MBoxIn</Sm>
|
||||
<Sm StartAddress="#x1600" ControlByte="#x24" Enable="1">Outputs</Sm>
|
||||
<Sm StartAddress="#x1A00" ControlByte="#x20" Enable="1">Inputs</Sm>
|
||||
<RxPdo Fixed="true" Mandatory="true" Sm="2">
|
||||
<Index>#x1600</Index>
|
||||
<Name>EncPosScale</Name>
|
||||
<Entry>
|
||||
<Index>#x7000</Index>
|
||||
<SubIndex>#x0</SubIndex>
|
||||
<BitLen>32</BitLen>
|
||||
<Name>EncPosScale</Name>
|
||||
<DataType>DINT</DataType>
|
||||
</Entry>
|
||||
</RxPdo>
|
||||
<RxPdo Fixed="true" Mandatory="true" Sm="2">
|
||||
<Index>#x1601</Index>
|
||||
<Name>IndexLatchEnable</Name>
|
||||
<Entry>
|
||||
<Index>#x7001</Index>
|
||||
<SubIndex>#x0</SubIndex>
|
||||
<BitLen>32</BitLen>
|
||||
<Name>IndexLatchEnable</Name>
|
||||
<DataType>UDINT</DataType>
|
||||
</Entry>
|
||||
</RxPdo>
|
||||
<TxPdo Fixed="true" Mandatory="true" Sm="3">
|
||||
<Index>#x1A00</Index>
|
||||
<Name>EncPos</Name>
|
||||
<Entry>
|
||||
<Index>#x6000</Index>
|
||||
<SubIndex>#x0</SubIndex>
|
||||
<BitLen>32</BitLen>
|
||||
<Name>EncPos</Name>
|
||||
<DataType>REAL</DataType>
|
||||
</Entry>
|
||||
</TxPdo>
|
||||
<TxPdo Fixed="true" Mandatory="true" Sm="3">
|
||||
<Index>#x1A01</Index>
|
||||
<Name>EncFrequency</Name>
|
||||
<Entry>
|
||||
<Index>#x6001</Index>
|
||||
<SubIndex>#x0</SubIndex>
|
||||
<BitLen>32</BitLen>
|
||||
<Name>EncFrequency</Name>
|
||||
<DataType>REAL</DataType>
|
||||
</Entry>
|
||||
</TxPdo>
|
||||
<TxPdo Fixed="true" Mandatory="true" Sm="3">
|
||||
<Index>#x1A02</Index>
|
||||
<Name>DiffT</Name>
|
||||
<Entry>
|
||||
<Index>#x6002</Index>
|
||||
<SubIndex>#x0</SubIndex>
|
||||
<BitLen>32</BitLen>
|
||||
<Name>DiffT</Name>
|
||||
<DataType>UDINT</DataType>
|
||||
</Entry>
|
||||
</TxPdo>
|
||||
<TxPdo Fixed="true" Mandatory="true" Sm="3">
|
||||
<Index>#x1A03</Index>
|
||||
<Name>IndexByte</Name>
|
||||
<Entry>
|
||||
<Index>#x6003</Index>
|
||||
<SubIndex>#x0</SubIndex>
|
||||
<BitLen>32</BitLen>
|
||||
<Name>IndexByte</Name>
|
||||
<DataType>UDINT</DataType>
|
||||
</Entry>
|
||||
</TxPdo>
|
||||
<TxPdo Fixed="true" Mandatory="true" Sm="3">
|
||||
<Index>#x1A04</Index>
|
||||
<Name>IndexStatus</Name>
|
||||
<Entry>
|
||||
<Index>#x6004</Index>
|
||||
<SubIndex>#x0</SubIndex>
|
||||
<BitLen>32</BitLen>
|
||||
<Name>IndexStatus</Name>
|
||||
<DataType>UDINT</DataType>
|
||||
</Entry>
|
||||
</TxPdo>
|
||||
<Mailbox DataLinkLayer="true">
|
||||
<CoE SdoInfo="true" PdoAssign="false" PdoConfig="false" PdoUpload="true" CompleteAccess="false" />
|
||||
</Mailbox>
|
||||
<Dc>
|
||||
<OpMode>
|
||||
<Name>SM-Synchron</Name>
|
||||
<Desc>SM-Synchron</Desc>
|
||||
<AssignActivate>#x000</AssignActivate>
|
||||
</OpMode>
|
||||
<OpMode>
|
||||
<Name>DC</Name>
|
||||
<Desc>DC-Synchron</Desc>
|
||||
<AssignActivate>#x300</AssignActivate>
|
||||
</OpMode>
|
||||
</Dc>
|
||||
<Eeprom>
|
||||
<ByteSize>2048</ByteSize>
|
||||
<ConfigData>80060344640000</ConfigData>
|
||||
</Eeprom>
|
||||
</Device>
|
||||
</Devices>
|
||||
</Descriptions>
|
||||
</EtherCATInfo>
|
||||
88
Pcb-1-lan9252/Firmware/lib/soes/cc.h
Executable file
88
Pcb-1-lan9252/Firmware/lib/soes/cc.h
Executable file
@@ -0,0 +1,88 @@
|
||||
/*
|
||||
* Licensed under the GNU General Public License version 2 with exceptions. See
|
||||
* LICENSE file in the project root for full license information
|
||||
*/
|
||||
|
||||
#ifndef CC_H
|
||||
#define CC_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include <sys/param.h>
|
||||
#ifdef __linux__
|
||||
#include <endian.h>
|
||||
#else
|
||||
#include <machine/endian.h>
|
||||
#endif
|
||||
|
||||
#ifndef MIN
|
||||
#define MIN(a,b) (((a)<(b))?(a):(b))
|
||||
#endif
|
||||
|
||||
#ifndef MAX
|
||||
#define MAX(a,b) (((a)>(b))?(a):(b))
|
||||
#endif
|
||||
|
||||
#define CC_PACKED_BEGIN
|
||||
#define CC_PACKED_END
|
||||
#define CC_PACKED __attribute__((packed))
|
||||
|
||||
#ifdef __rtk__
|
||||
#define CC_ASSERT(exp) ASSERT (exp)
|
||||
#else
|
||||
#define CC_ASSERT(exp) assert (exp)
|
||||
#endif
|
||||
#define CC_STATIC_ASSERT(exp) _Static_assert (exp, "")
|
||||
|
||||
#define CC_DEPRECATED __attribute__((deprecated))
|
||||
|
||||
#define CC_SWAP32(x) __builtin_bswap32 (x)
|
||||
#define CC_SWAP16(x) __builtin_bswap16 (x)
|
||||
|
||||
#define CC_ATOMIC_SET(var,val) __atomic_store_n(&var,val,__ATOMIC_SEQ_CST)
|
||||
#define CC_ATOMIC_GET(var) __atomic_load_n(&var,__ATOMIC_SEQ_CST)
|
||||
#define CC_ATOMIC_ADD(var,val) __atomic_add_fetch(&var,val,__ATOMIC_SEQ_CST)
|
||||
#define CC_ATOMIC_SUB(var,val) __atomic_sub_fetch(&var,val,__ATOMIC_SEQ_CST)
|
||||
#define CC_ATOMIC_AND(var,val) __atomic_and_fetch(&var,val,__ATOMIC_SEQ_CST)
|
||||
#define CC_ATOMIC_OR(var,val) __atomic_or_fetch(&var,val,__ATOMIC_SEQ_CST)
|
||||
|
||||
#if BYTE_ORDER == BIG_ENDIAN
|
||||
#define htoes(x) CC_SWAP16 (x)
|
||||
#define htoel(x) CC_SWAP32 (x)
|
||||
#else
|
||||
#define htoes(x) (x)
|
||||
#define htoel(x) (x)
|
||||
#endif
|
||||
|
||||
#define etohs(x) htoes (x)
|
||||
#define etohl(x) htoel (x)
|
||||
|
||||
#if BYTE_ORDER == LITTLE_ENDIAN
|
||||
#define EC_LITTLE_ENDIAN
|
||||
#else
|
||||
#define EC_BIG_ENDIAN
|
||||
#endif
|
||||
|
||||
#ifdef ESC_DEBUG
|
||||
#ifdef __rtk__
|
||||
#include <rprint.h>
|
||||
#define DPRINT(...) rprintp ("soes: "__VA_ARGS__)
|
||||
#else
|
||||
#include <stdio.h>
|
||||
#define DPRINT(...) printf ("soes: "__VA_ARGS__)
|
||||
#endif
|
||||
#else
|
||||
#define DPRINT(...)
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* CC_H */
|
||||
BIN
Pcb-1-lan9252/Firmware/lib/soes/doc/images/esi_pdo.png
Executable file
BIN
Pcb-1-lan9252/Firmware/lib/soes/doc/images/esi_pdo.png
Executable file
Binary file not shown.
|
After Width: | Height: | Size: 48 KiB |
BIN
Pcb-1-lan9252/Firmware/lib/soes/doc/images/sii_pdo.png
Executable file
BIN
Pcb-1-lan9252/Firmware/lib/soes/doc/images/sii_pdo.png
Executable file
Binary file not shown.
|
After Width: | Height: | Size: 58 KiB |
50
Pcb-1-lan9252/Firmware/lib/soes/doc/soes.dox
Executable file
50
Pcb-1-lan9252/Firmware/lib/soes/doc/soes.dox
Executable file
@@ -0,0 +1,50 @@
|
||||
/**
|
||||
* \mainpage Simple Open EtherCAT Slave or SOES
|
||||
*
|
||||
* \section start Tutorial
|
||||
* For a tutorial on SOES See tutorial.txt
|
||||
*
|
||||
* \section overview Overview
|
||||
* SOES is an EtherCAT slave stack written in c. Its purpose is to learn and
|
||||
* to use. All users are invited to study the source to get an understanding
|
||||
* how an EtherCAT slave function
|
||||
*
|
||||
* Features as of 1.0.0 :
|
||||
* - Address offset based HAL for easy ESC read/write access via any interface
|
||||
* - Mailbox with data link layer
|
||||
* - CoE
|
||||
* - Object dictionary
|
||||
* - SDO read and write for all sizes including segmented transfers
|
||||
* - Easy portable C-code suited for embedded applications
|
||||
* - Fixed PDO mapping
|
||||
* - FoE with bootstrap template
|
||||
* - Support for Little and Big endian targets.
|
||||
* - Polling for interrupts
|
||||
*
|
||||
* \section legal Legal notice
|
||||
* SOES Simple Open EtherCAT Slave \n
|
||||
* Copyright (C) 2007-2013 Arthur Ketels \n
|
||||
* Copyright (C) 2012-2013 rt-labs \n
|
||||
*
|
||||
* SOES is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License version 2 as published by the Free
|
||||
* Software Foundation.
|
||||
*
|
||||
* SOES is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
* WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* for more details.
|
||||
*
|
||||
* As a special exception, if other files instantiate templates or use macros
|
||||
* or inline functions from this file, or you compile this file and link it
|
||||
* with other works to produce a work based on this file, this file does not
|
||||
* by itself cause the resulting work to be covered by the GNU General Public
|
||||
* License. However the source code for this file must still be made available
|
||||
* in accordance with section (3) of the GNU General Public License.
|
||||
*
|
||||
* This exception does not invalidate any other reasons why a work based on
|
||||
* this file might be covered by the GNU General Public License.
|
||||
*
|
||||
* The EtherCAT Technology, the trade name and logo "EtherCAT" are the intellectual
|
||||
* property of, and protected by Beckhoff Automation GmbH.
|
||||
*/
|
||||
476
Pcb-1-lan9252/Firmware/lib/soes/doc/tutorial.txt
Executable file
476
Pcb-1-lan9252/Firmware/lib/soes/doc/tutorial.txt
Executable file
@@ -0,0 +1,476 @@
|
||||
/** \file
|
||||
|
||||
\section general General
|
||||
|
||||
The SOES is a library that provides the Micro Controller user application with
|
||||
the means to access the EtherCAT fieldbus communication environment:
|
||||
- EtherCAT State Machine
|
||||
- Mailbox Interfaces
|
||||
- Protocols
|
||||
- CoE
|
||||
- FoE + bootstrap template
|
||||
|
||||
Support for mailbox and protocols are typical examples when you need a slave
|
||||
stack to control the Application Layer of EtherCAT. The PDI used for such
|
||||
applications is either SPI or some Micro Controller Interface
|
||||
|
||||
The following sections show some basic examples on how to get the SOES up
|
||||
and running, as well as a lightweight example on howto design your slave.
|
||||
Since all code is local to the application or global variables, it is possible
|
||||
to tweak and optimize when possible.
|
||||
|
||||
Our target Application:
|
||||
- Inputs 40bit
|
||||
- One button 8bit
|
||||
- One encoder value 32bit
|
||||
- Outputs 8bit
|
||||
- LED 8bit
|
||||
- Parameters
|
||||
- Encoder settings
|
||||
- Slave commands
|
||||
- Reset counter
|
||||
|
||||
Now to translate and implement on top of SOES.
|
||||
|
||||
First look on the start up code. This example shows how to add a
|
||||
main function that will be called by startup code. In this example
|
||||
main's only purpose is to spawn two new tasks. One that executes
|
||||
SOES and one that control the ERROR LED. Some ESCs provided a pin
|
||||
for the RUN LED, some even for the ERROR LED, if it don't you can
|
||||
control them from the slave Micro Controller. We'll focus on the "soes" task.
|
||||
|
||||
\code
|
||||
|
||||
int main (void)
|
||||
{
|
||||
rprintp ("SOES (Simple Open EtherCAT Slave)\nsoes test\n");
|
||||
|
||||
/* task_spawn ("led_run", led_error, 15, 512, NULL); /
|
||||
task_spawn ("led_error", led_error, 15, 512, NULL);
|
||||
task_spawn ("soes", soes, 9, 1024, NULL);
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
\endcode
|
||||
|
||||
\section configuration Configuration
|
||||
The function soes is our EtherCAT slave device and can be split in 3 parts.
|
||||
Hardware Init, Software Init and Application loop. We will start with the
|
||||
Hardware Init.
|
||||
|
||||
- Hardware Init
|
||||
- esc_reset, special function used for ESC reset if no Physical
|
||||
EEPROM used. This is local to the Application not part of the generic
|
||||
ESC handling.
|
||||
- ESC_init, initialise SPI communication or similar
|
||||
- Wait for ESC is started, waiting for SPI to be up and running,
|
||||
we'll query the ESC register DL status if EEPROM loaded OK and PDI
|
||||
operational, eg. SPI OK.
|
||||
|
||||
\code
|
||||
|
||||
void soes (void *arg)
|
||||
{
|
||||
TXPDOsize = SM3_sml = sizeTXPDO ();
|
||||
RXPDOsize = SM2_sml = sizeRXPDO ();
|
||||
|
||||
esc_reset ();
|
||||
ESC_init ((void *)spi_name);
|
||||
|
||||
task_delay (tick_from_ms (200));
|
||||
|
||||
// wait until ESC is started up
|
||||
while ((ESCvar.DLstatus & 0x0001) == 0)
|
||||
{
|
||||
ESC_read (ESCREG_DLSTATUS, (void *) &ESCvar.DLstatus,
|
||||
sizeof (ESCvar.DLstatus));
|
||||
ESCvar.DLstatus = etohs (ESCvar.DLstatus);
|
||||
}
|
||||
|
||||
// reset ESC to init state
|
||||
ESC_ALstatus (ESCinit);
|
||||
...
|
||||
}
|
||||
|
||||
\endcode
|
||||
|
||||
- Software Init
|
||||
- Reset the slave into Init state by writing AL Status register.
|
||||
- Clear Errors by writing AL Status Code register.
|
||||
- Stop the Application Layer, basically we disable the SyncManagers
|
||||
that implicitly block the data exchange.
|
||||
|
||||
\code
|
||||
|
||||
void soes (void *arg)
|
||||
{
|
||||
...
|
||||
while ((ESCvar.DLstatus & 0x0001) == 0)
|
||||
{
|
||||
ESC_read (ESCREG_DLSTATUS, (void *) &ESCvar.DLstatus,
|
||||
sizeof (ESCvar.DLstatus));
|
||||
ESCvar.DLstatus = etohs (ESCvar.DLstatus);
|
||||
}
|
||||
|
||||
// reset ESC to init state
|
||||
ESC_ALstatus (ESCinit);
|
||||
ESC_ALerror (ALERR_NONE);
|
||||
ESC_stopmbx ();
|
||||
ESC_stopinput ();
|
||||
ESC_stopoutput ();
|
||||
|
||||
// application run loop
|
||||
while (1)
|
||||
...
|
||||
}
|
||||
\endcode
|
||||
|
||||
- Application loop
|
||||
- ALevent handling, ALevent hold information on changes in ALControl or
|
||||
SyncManagers. ALControl for state changes and SyncManagers for changes written
|
||||
by EtherCAT in local memory mapped to active SyncManagers
|
||||
- ESC_state for state handling, such as state step up or down with correct
|
||||
error and acknowledge response.
|
||||
- Mailbox handler, generic support of mailboxes used by all Application Layer
|
||||
protocols.
|
||||
- On mailbox actions we'll also check if we need to use a specific protocol
|
||||
handler to handle the incoming or outgoing Mailbox data.
|
||||
|
||||
Up until the now we're using the SOES protocol stack without any application specific
|
||||
calls. Next up we'll look at the application Code, here named DIG_process ().
|
||||
|
||||
\code
|
||||
|
||||
void soes (void *arg)
|
||||
{
|
||||
...
|
||||
// application run loop
|
||||
while (1)
|
||||
{
|
||||
if((ESCvar.ALstatus & 0x0f) == ESCinit)
|
||||
{
|
||||
txpdomap = DEFAULTTXPDOMAP;
|
||||
rxpdomap = DEFAULTRXPDOMAP;
|
||||
txpdoitems = DEFAULTTXPDOITEMS;
|
||||
rxpdoitems = DEFAULTTXPDOITEMS;
|
||||
}
|
||||
ESC_read (ESCREG_LOCALTIME, (void *) &ESCvar.Time, sizeof (ESCvar.Time));
|
||||
ESCvar.Time = etohl (ESCvar.Time);
|
||||
|
||||
ESC_state ();
|
||||
if (ESC_mbxprocess ())
|
||||
{
|
||||
ESC_coeprocess ();
|
||||
ESC_foeprocess ();
|
||||
ESC_xoeprocess ();
|
||||
}
|
||||
DIG_process ();
|
||||
};
|
||||
}
|
||||
|
||||
\endcode
|
||||
|
||||
\section application Application
|
||||
The function DIG_process is the User part of the application and could be joined
|
||||
by more cyclic User functions for executing other parts of the application.
|
||||
The example code can be split in 2 parts
|
||||
- Outputs
|
||||
- Start by evaluating if we're in a state supporting update of outputs, eg.
|
||||
Operational state.
|
||||
- If we're in OP we can read the current PDO data in the 3-buffer SyncManager
|
||||
mapped to the output SM, the default is SyncManager2, we read the ESC RAM address
|
||||
of SM2 and store it at the local address of the local variable Wb.LED.
|
||||
We'll read RXPDOsize bytes to trigger a complete SyncManager read.
|
||||
- After local variables have been refreshed we basically write the local
|
||||
PDO variables to the User application, ex. a GPIO.
|
||||
- Basically this is the API of the SOES toward the User Application.
|
||||
- This function also include a watchdog mechanism, if triggered it will
|
||||
shutdown the outputs and trigger a state changes to safe operational.
|
||||
AlError is updated with cause of error to inform the Master.
|
||||
|
||||
\code
|
||||
|
||||
void RXPDO_update (void)
|
||||
{
|
||||
ESC_read (SM2_sma, &Wb.LED, RXPDOsize);
|
||||
}
|
||||
|
||||
void DIG_process (void)
|
||||
{
|
||||
if (App.state & APPSTATE_OUTPUT)
|
||||
{
|
||||
if (ESCvar.ALevent & ESCREG_ALEVENT_SM2) // SM2 trigger ?
|
||||
{
|
||||
RXPDO_update ();
|
||||
reset_wd ();
|
||||
gpio_set(GPIO_LED, Wb.LED & BIT(0));
|
||||
|
||||
}
|
||||
if (!wd_cnt)
|
||||
{
|
||||
ESC_stopoutput ();
|
||||
// watchdog, invalid outputs
|
||||
ESC_ALerror (ALERR_WATCHDOG);
|
||||
// goto safe-op with error bit set
|
||||
ESC_ALstatus (ESCsafeop | ESCerror);
|
||||
wd_trigger = 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
reset_wd ();
|
||||
}
|
||||
...
|
||||
}
|
||||
|
||||
\endcode
|
||||
|
||||
- Inputs
|
||||
- Is handled a bit simpler than outputs but in reverse order, the slave will
|
||||
continue update the inputs in state Safe Operational.
|
||||
- Here we first read User application data from ex. GPIO and then write to
|
||||
local PDO variables.
|
||||
- After the local variables have been refreshed we write those to the current
|
||||
PDO data 3-buffer SyncManager mapped to the input SM, the default is SyncManager3.
|
||||
This way we update the ESC RAM address with User Application data accessed by
|
||||
the EtherCAT master.
|
||||
|
||||
\code
|
||||
|
||||
void TXPDO_update (void)
|
||||
{
|
||||
ESC_write (SM3_sma, &Rb.button, TXPDOsize);
|
||||
}
|
||||
|
||||
void DIG_process (void)
|
||||
{
|
||||
...
|
||||
Rb.button = gpio_get(GPIO_WAKEUP);
|
||||
Cb.reset_counter++;
|
||||
Rb.encoder = Cb.reset_counter;
|
||||
|
||||
TXPDO_update ();
|
||||
}
|
||||
|
||||
\endcode
|
||||
|
||||
\section ApplicationdataProcessdata ApplicationdataProcessdata
|
||||
To run application data through EtherCAT processdata we need to describe for
|
||||
the fieldbus what data we have and will read/write. For this we have 3 objects,
|
||||
the ESI file, SII-EEPROM and CoE Object Dictionary. The first 2 are mandatory
|
||||
and the third is a very convenient way of describing complex slaves.
|
||||
|
||||
Our strategy is to keep the ESI file and the SII-EEPROM as thin as possible to
|
||||
avoid duplication of data that need to be maintained. Both will hold the bare
|
||||
minimum of mandatory + optional data to pass CTT. Optional data will be
|
||||
included to tell EtherCAT that detailed information can be retrieved via CoE
|
||||
from the OD stored in the slave it self.
|
||||
|
||||
\section SII-EEPROM SII-EEPROM
|
||||
Snapshot from SII information matrix from EtherCAT communication slides.
|
||||
|
||||
\image html sii_pdo.png "Our target slave is Fixed PDO and OD"
|
||||
\image latex sii_pdo.png "Our target slave is Fixed PDO and OD" width=15cm
|
||||
|
||||
|
||||
\section ESI-file ESI-file
|
||||
Snapshot from ESI tree from EtherCAT communication slides.
|
||||
|
||||
\image html esi_pdo.png "mandatory and optional ESI data"
|
||||
\image latex esi_pdo.png "mandatory and optional ESI data" width=15cm
|
||||
|
||||
To briefly give a hint what are describe in the ESI and SII we're listing
|
||||
a set of included elements marked M for mandatory and O for optional.
|
||||
|
||||
\code
|
||||
- Vendor (M) , Describes the identity.
|
||||
- Id (M), Hex, EtherCAT Vendor ID, OD 1018.01
|
||||
- Name (M), NameType, Expedient vendor name
|
||||
- Descriptions (M), Describes the EtherCAT device(s) using elements.
|
||||
- Groups (M), Similar devices can be assigned to one group.
|
||||
- Group (M), One group groups similar devices with slightly different features
|
||||
- Type (M), A reference handle corresponding to the GroupType value in Description:Devices:Device:Group
|
||||
- Name (M), Name for this group show by a configuration tool
|
||||
- Devices (M), Element devices may describe one or several devices with their EtherCAT features such as SyncManagers, FMMUs and Dictionaries
|
||||
- Device (O), Holds all information about the device like syncmanagers and FMMU, object dictionary, data types and the PDO mapping and assign description
|
||||
- Device ATT: Physics (M),string, Physics at individual ports
|
||||
- Type (M), Device identity
|
||||
- Type ATT:ProductCode="#x98123467"
|
||||
- Type ATT:RevisionNo="#x00000001"
|
||||
- Name (M), Detailed name of device shown by a configuration tool (not used for identification)
|
||||
- GroupType (M), Reference to a group (described in element Groups) to which this device should be assigned to. Name of the handle used in element Groups:Group:Type
|
||||
- Fmmu (O), String to describe function, Outputs -> RxPDO, Inputs -> TxPDO , MBoxState -> FMMU is used to poll Input Mailbox
|
||||
- Sm (O), Description of SyncManager including start address and direction.
|
||||
- MBoxOut Mailbox Data Master -> Slave
|
||||
- MBoxIn Mailbox Data Slave -> Master
|
||||
- Outputs Process Data Master -> Slave
|
||||
- Inputs Process Data Slave -> master
|
||||
- Sm ATT:DefaultSize="128" , Size
|
||||
- Sm ATT:StartAddress="#x1000" , Start address
|
||||
- Sm ATT:ControlByte="#x26" , Settings , Bit [1][0] = 10, Operation mode Mailbox, 00 Buffered 3.
|
||||
- Sm ATT:Enable="1", Enabled
|
||||
- Mailbox (O), Description of available mailbox protocols
|
||||
- Mailbox ATT: DataLinkLayer="true", Support of Mailbox Data Link Layer is mandatory.
|
||||
- CoE (O), Device support CoE
|
||||
- CoE (O) ATT: SdoInfo="true" , SDO Information Service
|
||||
- CoE (O) ATT: CompleteAccess="false" , SDO complete access not supported
|
||||
- CoE (O) ATT: PdoUpload="true", PDO description uploaded from the slave's object dictionary and SyncManager length calculated based on the same
|
||||
- Dc (O), describes synchronization modes supported by the device.
|
||||
- OpMode (O), Definition of supported operation modes
|
||||
- Name (M), Internal Handle of operation mode
|
||||
- Desc (O(M)), description of operation mode, recommended, Free Run (no sync), SM Synchronous, DC Synchronous
|
||||
- AssignActive (M), Value of Latch and Sync Control registers
|
||||
- Eeprom (O, use is mandatory)
|
||||
- Data (M)
|
||||
Or
|
||||
- ByteSize (M), Byte Size of connected EEPROM device
|
||||
- ConfigData (M), First 7 words of EEPROM, Configuration Areas
|
||||
- BootStrap (O), Start address and length of mailboxes for BootStrap
|
||||
\endcode
|
||||
|
||||
So to describe the application we use CoE and Object Dictionary. The mapping between
|
||||
Object Dictionary and the User Application are done via local variables defined as
|
||||
user types. The Object Dictionary itself is stored in a matrix where all
|
||||
the indexes are listed. Every index then have a submatrix with its subindex.
|
||||
|
||||
\section ObjectDictionary ObjectDictionary
|
||||
The Object Dictionary used as example follow the CANopen DS301 ranges.
|
||||
|
||||
- 0x0000 - 0x0FFF, Data Type Area
|
||||
- 0x1000 - 0x1FFF, Communication Area
|
||||
- 0x2000 - 0x5FFF, Manufacture specific area
|
||||
- 0x6000 - 0x6FFF, Input area
|
||||
- 0x7000 - 0x7FFF, Output area
|
||||
- 0x8000 - 0x8FFF, Configuration area
|
||||
- 0x9000 - 0x9FFF, Information area
|
||||
- 0xA000 - 0xAFFF, Diagnosis Area
|
||||
- 0xB000 - 0xBFFF, Service Transfer Area
|
||||
- 0xC000 - 0xEFFF, Reserved Area
|
||||
- 0xF000 - 0xFFFF, Device Area
|
||||
|
||||
RxPDO , 0x1600 - 0x17FF
|
||||
TxPDO , 0x1A00 - 0x1BFF
|
||||
|
||||
Example, on how the the OD index are linked.
|
||||
Top index, SyncManagers Communication Types. In index 0 the 0x04 indicates we have 4
|
||||
SyncManagers defined. Every SyncManager is assigned a type, in index 1-4, we have standard
|
||||
settings SM0 = 1, SM1 = 2, SM2 = 3, SM3 = 4 from ETG 1000.6, 5.6.7.4.
|
||||
- 0, Unused
|
||||
- 1, MailBox Receive, master to slave
|
||||
- 2, MailBox Send, slave to master
|
||||
- 3, Processdata output, master to slave
|
||||
- 4, Processdata input, slave to master
|
||||
|
||||
\code
|
||||
objectlist.h
|
||||
FLASHSTORE _objectlist SDOobjects[] =
|
||||
...
|
||||
{0x1C00, OTYPE_ARRAY, 4, 0, &acName1C00[0], &SDO1C00[0]},
|
||||
|
||||
FLASHSTORE _objd SDO1C00[] =
|
||||
{ {0x00, DTYPE_UNSIGNED8, 8, ATYPE_R, &acNameNOE[0], 0x04, nil},
|
||||
{0x01, DTYPE_UNSIGNED8, 8, ATYPE_R, &acName1C00_01[0], 0x01, nil},
|
||||
{0x02, DTYPE_UNSIGNED8, 8, ATYPE_R, &acName1C00_02[0], 0x02, nil},
|
||||
{0x03, DTYPE_UNSIGNED8, 8, ATYPE_R, &acName1C00_03[0], 0x03, nil},
|
||||
{0x04, DTYPE_UNSIGNED8, 8, ATYPE_R, &acName1C00_04[0], 0x04, nil}
|
||||
|
||||
\endcode
|
||||
|
||||
SyncManagers channels 0-31 are listed in SDO1C10-SDO1C2F. If we look
|
||||
at SyncManager channel 2, we see.
|
||||
|
||||
- Type 3, Processdata output, master to slave
|
||||
|
||||
It got one RxPDO index 0x1600 connected, and the submatrix for 0x1600 link
|
||||
one PDO object index 0x7000 subindex 1. The output object 0x70000108 give
|
||||
you the index 0x7000, subindex 1 and PDO object length 1(byte).
|
||||
|
||||
\code
|
||||
objectlist.h
|
||||
FLASHSTORE _objd SDO1C12[] =
|
||||
{ {0x00, DTYPE_UNSIGNED8, 8, ATYPE_R, &acNameNOE[0], 0x01, nil},
|
||||
{0x01, DTYPE_UNSIGNED16, 16, ATYPE_R, &acNameMO[0], 0x1600, nil}
|
||||
};
|
||||
|
||||
FLASHSTORE _objd SDO1600[] =
|
||||
{ {0x00, DTYPE_UNSIGNED8, 8, ATYPE_R, &acNameNOE[0], 0x01, nil},
|
||||
{0x01, DTYPE_UNSIGNED32, 32, ATYPE_R, &acNameMO[0], 0x70000108, nil}
|
||||
};
|
||||
|
||||
\endcode
|
||||
|
||||
At PDO level we make the connection between the local application and
|
||||
the object dictionary. For all subindex in the PDO the last element
|
||||
is the address to the local variable.
|
||||
|
||||
\code
|
||||
|
||||
objectlist.h
|
||||
FLASHSTORE _objd SDO7000[] =
|
||||
{ {0x00, DTYPE_UNSIGNED8, 8, ATYPE_R, &acNameNOE[0], 0x01, nil},
|
||||
{0x01, DTYPE_UNSIGNED8, 8, ATYPE_RW, &acName7000_01[0], 0, &(Wb.LED)}
|
||||
};
|
||||
|
||||
utypes.h
|
||||
typedef struct
|
||||
{
|
||||
uint8 LED;
|
||||
} _Wbuffer;
|
||||
|
||||
\endcode
|
||||
|
||||
Beside SyncManager to PDO mapping we also have mandatory data as
|
||||
|
||||
0x1000 Device Type
|
||||
0x1018 Object Identity
|
||||
0x10C0 SyncManager Communication Type, as we used as top index when
|
||||
figuring out our PDOs in the Object Dictionary.
|
||||
|
||||
For a complete description of the object dictionary you can get guidance
|
||||
by the ETG1000.6 EcatAlProtocols
|
||||
|
||||
A useful feature is the Asynchronous use of SDO parameters. In the example
|
||||
we have Parameter set holding an encoder scale value, just for show we also
|
||||
have a read only mirror value of the encoder scale. Parameters defined as a
|
||||
RW SDO parameter and can be written/read by SDO Download or Upload. In
|
||||
addition there is a ESC_objecthandler Hook on SDO Download where you can
|
||||
add additional logic, ex. we execute the mirror of the encoder scale value
|
||||
by assigning the encoder scale value to the mirror.
|
||||
|
||||
\code
|
||||
|
||||
objectlist.h
|
||||
FLASHSTORE _objd SDO7100[] =
|
||||
{ {0x00, DTYPE_UNSIGNED8, 8, ATYPE_R, &acNameNOE[0], 0x02, nil},
|
||||
{0x01, DTYPE_UNSIGNED32, 32, ATYPE_RW, &acName7100_01[0], 0, &(encoder_scale)},
|
||||
{0x02, DTYPE_UNSIGNED32, 32, ATYPE_R, &acName7100_02[0], 0, &(encoder_scale_mirror)}
|
||||
};
|
||||
|
||||
soes.c
|
||||
void ESC_objecthandler (uint16 index, uint8 subindex)
|
||||
{
|
||||
switch (index)
|
||||
{
|
||||
...
|
||||
case 0x7100:
|
||||
{
|
||||
switch (subindex)
|
||||
{
|
||||
case 0x01:
|
||||
{
|
||||
encoder_scale_mirror = encoder_scale;
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
...
|
||||
}
|
||||
|
||||
\endcode
|
||||
This tutorial is just one way of doing it.
|
||||
Enjoy and happy coding!
|
||||
|
||||
Andreas Karlsson, rt-labs AB, www.rt-labs.com
|
||||
*/
|
||||
42
Pcb-1-lan9252/Firmware/lib/soes/ecat_options.h
Executable file
42
Pcb-1-lan9252/Firmware/lib/soes/ecat_options.h
Executable file
@@ -0,0 +1,42 @@
|
||||
#ifndef __ECAT_OPTIONS_H__
|
||||
#define __ECAT_OPTIONS_H__
|
||||
|
||||
#define USE_FOE 0
|
||||
#define USE_EOE 0
|
||||
|
||||
#define MBXSIZE 512
|
||||
#define MBXSIZEBOOT 512
|
||||
#define MBXBUFFERS 3
|
||||
|
||||
#define MBX0_sma 0x1000
|
||||
#define MBX0_sml MBXSIZE
|
||||
#define MBX0_sme MBX0_sma+MBX0_sml-1
|
||||
#define MBX0_smc 0x26
|
||||
#define MBX1_sma MBX0_sma+MBX0_sml
|
||||
#define MBX1_sml MBXSIZE
|
||||
#define MBX1_sme MBX1_sma+MBX1_sml-1
|
||||
#define MBX1_smc 0x22
|
||||
|
||||
#define MBX0_sma_b 0x1000
|
||||
#define MBX0_sml_b MBXSIZEBOOT
|
||||
#define MBX0_sme_b MBX0_sma_b+MBX0_sml_b-1
|
||||
#define MBX0_smc_b 0x26
|
||||
#define MBX1_sma_b MBX0_sma_b+MBX0_sml_b
|
||||
#define MBX1_sml_b MBXSIZEBOOT
|
||||
#define MBX1_sme_b MBX1_sma_b+MBX1_sml_b-1
|
||||
#define MBX1_smc_b 0x22
|
||||
|
||||
#define SM2_sma 0x1600
|
||||
#define SM2_smc 0x24
|
||||
#define SM2_act 1
|
||||
#define SM3_sma 0x1A00
|
||||
#define SM3_smc 0x20
|
||||
#define SM3_act 1
|
||||
|
||||
#define MAX_MAPPINGS_SM2 2
|
||||
#define MAX_MAPPINGS_SM3 5
|
||||
|
||||
#define MAX_RXPDO_SIZE 512
|
||||
#define MAX_TXPDO_SIZE 512
|
||||
|
||||
#endif /* __ECAT_OPTIONS_H__ */
|
||||
385
Pcb-1-lan9252/Firmware/lib/soes/ecat_slv.c
Executable file
385
Pcb-1-lan9252/Firmware/lib/soes/ecat_slv.c
Executable file
@@ -0,0 +1,385 @@
|
||||
/*
|
||||
* Licensed under the GNU General Public License version 2 with exceptions. See
|
||||
* LICENSE file in the project root for full license information
|
||||
*/
|
||||
#include <stddef.h>
|
||||
#include "esc.h"
|
||||
#include "esc_coe.h"
|
||||
#include "esc_foe.h"
|
||||
#include "esc_eoe.h"
|
||||
#include "ecat_slv.h"
|
||||
|
||||
#define IS_RXPDO(index) ((index) >= 0x1600 && (index) < 0x1800)
|
||||
#define IS_TXPDO(index) ((index) >= 0x1A00 && (index) < 0x1C00)
|
||||
|
||||
/* Global variables used by the stack */
|
||||
uint8_t MBX[MBXBUFFERS * MAX(MBXSIZE,MBXSIZEBOOT)];
|
||||
_MBXcontrol MBXcontrol[MBXBUFFERS];
|
||||
_SMmap SMmap2[MAX_MAPPINGS_SM2];
|
||||
_SMmap SMmap3[MAX_MAPPINGS_SM3];
|
||||
_ESCvar ESCvar;
|
||||
|
||||
/* Private variables */
|
||||
static volatile int watchdog;
|
||||
|
||||
#if MAX_MAPPINGS_SM2 > 0
|
||||
static uint8_t rxpdo[MAX_RXPDO_SIZE] __attribute__((aligned (8)));
|
||||
#else
|
||||
extern uint8_t * rxpdo;
|
||||
#endif
|
||||
|
||||
#if MAX_MAPPINGS_SM3 > 0
|
||||
static uint8_t txpdo[MAX_TXPDO_SIZE] __attribute__((aligned (8)));
|
||||
#else
|
||||
extern uint8_t * txpdo;
|
||||
#endif
|
||||
|
||||
/** Function to pre-qualify the incoming SDO download.
|
||||
*
|
||||
* @param[in] index = index of SDO download request to check
|
||||
* @param[in] sub-index = sub-index of SDO download request to check
|
||||
* @return SDO abort code, or 0 on success
|
||||
*/
|
||||
uint32_t ESC_download_pre_objecthandler (uint16_t index,
|
||||
uint8_t subindex,
|
||||
void * data,
|
||||
size_t size,
|
||||
uint16_t flags)
|
||||
{
|
||||
if (IS_RXPDO (index) ||
|
||||
IS_TXPDO (index) ||
|
||||
index == RX_PDO_OBJIDX ||
|
||||
index == TX_PDO_OBJIDX)
|
||||
{
|
||||
uint8_t minSub = ((flags & COMPLETE_ACCESS_FLAG) == 0) ? 0 : 1;
|
||||
if (subindex > minSub && COE_maxSub (index) != 0)
|
||||
{
|
||||
return ABORT_SUBINDEX0_NOT_ZERO;
|
||||
}
|
||||
}
|
||||
|
||||
if (ESCvar.pre_object_download_hook)
|
||||
{
|
||||
return (ESCvar.pre_object_download_hook) (index,
|
||||
subindex,
|
||||
data,
|
||||
size,
|
||||
flags);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/** Hook called from the slave stack SDO Download handler to act on
|
||||
* user specified Index and Sub-index.
|
||||
*
|
||||
* @param[in] index = index of SDO download request to handle
|
||||
* @param[in] sub-index = sub-index of SDO download request to handle
|
||||
* @return SDO abort code, or 0 on success
|
||||
*/
|
||||
uint32_t ESC_download_post_objecthandler (uint16_t index, uint8_t subindex, uint16_t flags)
|
||||
{
|
||||
if (ESCvar.post_object_download_hook != NULL)
|
||||
{
|
||||
return (ESCvar.post_object_download_hook)(index, subindex, flags);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/** Function to pre-qualify the incoming SDO upload.
|
||||
*
|
||||
* @param[in] index = index of SDO upload request to handle
|
||||
* @param[in] sub-index = sub-index of SDO upload request to handle
|
||||
* @return SDO abort code, or 0 on success
|
||||
*/
|
||||
uint32_t ESC_upload_pre_objecthandler (uint16_t index,
|
||||
uint8_t subindex,
|
||||
void * data,
|
||||
size_t size,
|
||||
uint16_t flags)
|
||||
{
|
||||
if (ESCvar.pre_object_upload_hook != NULL)
|
||||
{
|
||||
return (ESCvar.pre_object_upload_hook) (index,
|
||||
subindex,
|
||||
data,
|
||||
size,
|
||||
flags);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/** Hook called from the slave stack SDO Upload handler to act on
|
||||
* user specified Index and Sub-index.
|
||||
*
|
||||
* @param[in] index = index of SDO upload request to handle
|
||||
* @param[in] sub-index = sub-index of SDO upload request to handle
|
||||
* @return SDO abort code, or 0 on success
|
||||
*/
|
||||
uint32_t ESC_upload_post_objecthandler (uint16_t index, uint8_t subindex, uint16_t flags)
|
||||
{
|
||||
if (ESCvar.post_object_upload_hook != NULL)
|
||||
{
|
||||
return (ESCvar.post_object_upload_hook)(index, subindex, flags);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/** Hook called from the slave stack ESC_stopoutputs to act on state changes
|
||||
* forcing us to stop outputs. Here we can set them to a safe state.
|
||||
*/
|
||||
void APP_safeoutput (void)
|
||||
{
|
||||
DPRINT ("APP_safeoutput\n");
|
||||
|
||||
if(ESCvar.safeoutput_override != NULL)
|
||||
{
|
||||
(ESCvar.safeoutput_override)();
|
||||
}
|
||||
}
|
||||
|
||||
/** Write local process data to Sync Manager 3, Master Inputs.
|
||||
*/
|
||||
void TXPDO_update (void)
|
||||
{
|
||||
if(ESCvar.txpdo_override != NULL)
|
||||
{
|
||||
(ESCvar.txpdo_override)();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (MAX_MAPPINGS_SM3 > 0)
|
||||
{
|
||||
COE_pdoPack (txpdo, ESCvar.sm3mappings, SMmap3);
|
||||
}
|
||||
ESC_write (ESC_SM3_sma, txpdo, ESCvar.ESC_SM3_sml);
|
||||
}
|
||||
}
|
||||
|
||||
/** Read Sync Manager 2 to local process data, Master Outputs.
|
||||
*/
|
||||
void RXPDO_update (void)
|
||||
{
|
||||
if(ESCvar.rxpdo_override != NULL)
|
||||
{
|
||||
(ESCvar.rxpdo_override)();
|
||||
}
|
||||
else
|
||||
{
|
||||
ESC_read (ESC_SM2_sma, rxpdo, ESCvar.ESC_SM2_sml);
|
||||
if (MAX_MAPPINGS_SM2 > 0)
|
||||
{
|
||||
COE_pdoUnpack (rxpdo, ESCvar.sm2mappings, SMmap2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Set the watchdog count value, don't have any affect when using
|
||||
* HW watchdog 0x4xx
|
||||
*
|
||||
* @param[in] watchdogcnt = new watchdog count value
|
||||
*/
|
||||
void APP_setwatchdog (int watchdogcnt)
|
||||
{
|
||||
CC_ATOMIC_SET(ESCvar.watchdogcnt, watchdogcnt);
|
||||
}
|
||||
|
||||
/* Function to update local I/O, call read ethercat outputs, call
|
||||
* write ethercat inputs. Implement watch-dog counter to count-out if we have
|
||||
* made state change affecting the App.state.
|
||||
*/
|
||||
void DIG_process (uint8_t flags)
|
||||
{
|
||||
/* Handle watchdog */
|
||||
if((flags & DIG_PROCESS_WD_FLAG) > 0)
|
||||
{
|
||||
if (CC_ATOMIC_GET(watchdog) > 0)
|
||||
{
|
||||
CC_ATOMIC_SUB(watchdog, 1);
|
||||
}
|
||||
|
||||
if ((CC_ATOMIC_GET(watchdog) <= 0) &&
|
||||
((CC_ATOMIC_GET(ESCvar.App.state) & APPSTATE_OUTPUT) > 0))
|
||||
{
|
||||
DPRINT("DIG_process watchdog expired\n");
|
||||
ESC_ALstatusgotoerror((ESCsafeop | ESCerror), ALERR_WATCHDOG);
|
||||
}
|
||||
else if(((CC_ATOMIC_GET(ESCvar.App.state) & APPSTATE_OUTPUT) == 0))
|
||||
{
|
||||
CC_ATOMIC_SET(watchdog, ESCvar.watchdogcnt);
|
||||
}
|
||||
}
|
||||
|
||||
/* Handle Outputs */
|
||||
if ((flags & DIG_PROCESS_OUTPUTS_FLAG) > 0)
|
||||
{
|
||||
if(((CC_ATOMIC_GET(ESCvar.App.state) & APPSTATE_OUTPUT) > 0) &&
|
||||
(ESCvar.ALevent & ESCREG_ALEVENT_SM2))
|
||||
{
|
||||
RXPDO_update();
|
||||
CC_ATOMIC_SET(watchdog, ESCvar.watchdogcnt);
|
||||
/* Set outputs */
|
||||
cb_set_outputs();
|
||||
}
|
||||
else if (ESCvar.ALevent & ESCREG_ALEVENT_SM2)
|
||||
{
|
||||
RXPDO_update();
|
||||
}
|
||||
}
|
||||
|
||||
/* Call application */
|
||||
if ((flags & DIG_PROCESS_APP_HOOK_FLAG) > 0)
|
||||
{
|
||||
/* Call application callback if set */
|
||||
if (ESCvar.application_hook != NULL)
|
||||
{
|
||||
(ESCvar.application_hook)();
|
||||
}
|
||||
}
|
||||
|
||||
/* Handle Inputs */
|
||||
if ((flags & DIG_PROCESS_INPUTS_FLAG) > 0)
|
||||
{
|
||||
if(CC_ATOMIC_GET(ESCvar.App.state) > 0)
|
||||
{
|
||||
/* Update inputs */
|
||||
cb_get_inputs();
|
||||
TXPDO_update();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Handler for SM change, SM0/1, AL CONTROL and EEPROM events, the application
|
||||
* control what interrupts that should be served and re-activated with
|
||||
* event mask argument
|
||||
*/
|
||||
void ecat_slv_worker (uint32_t event_mask)
|
||||
{
|
||||
do
|
||||
{
|
||||
/* Check the state machine */
|
||||
ESC_state();
|
||||
/* Check the SM activation event */
|
||||
ESC_sm_act_event();
|
||||
|
||||
/* Check mailboxes */
|
||||
while ((ESC_mbxprocess() > 0) || (ESCvar.txcue > 0))
|
||||
{
|
||||
ESC_coeprocess();
|
||||
#if USE_FOE
|
||||
ESC_foeprocess();
|
||||
#endif
|
||||
#if USE_EOE
|
||||
ESC_eoeprocess();
|
||||
#endif
|
||||
ESC_xoeprocess();
|
||||
}
|
||||
#if USE_EOE
|
||||
ESC_eoeprocess_tx();
|
||||
#endif
|
||||
/* Call emulated eeprom handler if set */
|
||||
if (ESCvar.esc_hw_eep_handler != NULL)
|
||||
{
|
||||
(ESCvar.esc_hw_eep_handler)();
|
||||
}
|
||||
|
||||
CC_ATOMIC_SET(ESCvar.ALevent, ESC_ALeventread());
|
||||
|
||||
}while(ESCvar.ALevent & event_mask);
|
||||
|
||||
ESC_ALeventmaskwrite(ESC_ALeventmaskread() | event_mask);
|
||||
}
|
||||
|
||||
/*
|
||||
* Polling function. It should be called periodically for an application
|
||||
* when only SM2/DC interrupt is active.
|
||||
* Read and handle events for the EtherCAT state, status, mailbox and eeprom.
|
||||
*/
|
||||
void ecat_slv_poll (void)
|
||||
{
|
||||
/* Read local time from ESC*/
|
||||
ESC_read (ESCREG_LOCALTIME, (void *) &ESCvar.Time, sizeof (ESCvar.Time));
|
||||
ESCvar.Time = etohl (ESCvar.Time);
|
||||
|
||||
/* Check the state machine */
|
||||
ESC_state();
|
||||
/* Check the SM activation event */
|
||||
ESC_sm_act_event();
|
||||
|
||||
/* Check mailboxes */
|
||||
if (ESC_mbxprocess())
|
||||
{
|
||||
ESC_coeprocess();
|
||||
#if USE_FOE
|
||||
ESC_foeprocess();
|
||||
#endif
|
||||
#if USE_EOE
|
||||
ESC_eoeprocess();
|
||||
#endif
|
||||
ESC_xoeprocess();
|
||||
}
|
||||
#if USE_EOE
|
||||
ESC_eoeprocess_tx();
|
||||
#endif
|
||||
|
||||
/* Call emulated eeprom handler if set */
|
||||
if (ESCvar.esc_hw_eep_handler != NULL)
|
||||
{
|
||||
(ESCvar.esc_hw_eep_handler)();
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Poll all events in a free-run application
|
||||
*/
|
||||
void ecat_slv (void)
|
||||
{
|
||||
ecat_slv_poll();
|
||||
DIG_process(DIG_PROCESS_WD_FLAG | DIG_PROCESS_OUTPUTS_FLAG |
|
||||
DIG_PROCESS_APP_HOOK_FLAG | DIG_PROCESS_INPUTS_FLAG);
|
||||
}
|
||||
|
||||
/*
|
||||
* Initialize the slave stack.
|
||||
*/
|
||||
void ecat_slv_init (esc_cfg_t * config)
|
||||
{
|
||||
/* Init watchdog */
|
||||
watchdog = config->watchdog_cnt;
|
||||
|
||||
/* Call stack configuration */
|
||||
ESC_config (config);
|
||||
/* Call HW init */
|
||||
ESC_init (config);
|
||||
|
||||
/* wait until ESC is started up */
|
||||
while ((ESCvar.DLstatus & 0x0001) == 0)
|
||||
{
|
||||
ESC_read (ESCREG_DLSTATUS, (void *) &ESCvar.DLstatus,
|
||||
sizeof (ESCvar.DLstatus));
|
||||
ESCvar.DLstatus = etohs (ESCvar.DLstatus);
|
||||
}
|
||||
|
||||
#if USE_FOE
|
||||
/* Init FoE */
|
||||
FOE_init ();
|
||||
#endif
|
||||
|
||||
#if USE_EOE
|
||||
/* Init EoE */
|
||||
EOE_init ();
|
||||
#endif
|
||||
|
||||
/* reset ESC to init state */
|
||||
ESC_ALstatus (ESCinit);
|
||||
ESC_ALerror (ALERR_NONE);
|
||||
ESC_stopmbx ();
|
||||
ESC_stopinput ();
|
||||
ESC_stopoutput ();
|
||||
/* Init Object Dictionary default values */
|
||||
COE_initDefaultValues ();
|
||||
}
|
||||
69
Pcb-1-lan9252/Firmware/lib/soes/ecat_slv.h
Executable file
69
Pcb-1-lan9252/Firmware/lib/soes/ecat_slv.h
Executable file
@@ -0,0 +1,69 @@
|
||||
/*
|
||||
* Licensed under the GNU General Public License version 2 with exceptions. See
|
||||
* LICENSE file in the project root for full license information
|
||||
*/
|
||||
|
||||
#ifndef __ECAT_SLV_H__
|
||||
#define __ECAT_SLV_H__
|
||||
|
||||
#include "ecat_options.h"
|
||||
#include "esc.h"
|
||||
|
||||
/**
|
||||
* This function is called when to get input values
|
||||
*/
|
||||
void cb_get_inputs();
|
||||
|
||||
/**
|
||||
* This function is called when to set outputs values
|
||||
*/
|
||||
void cb_set_outputs();
|
||||
|
||||
/** Set the watchdog count value
|
||||
*
|
||||
* @param[in] watchdogcnt = new watchdog count value
|
||||
*/
|
||||
void APP_setwatchdog (int watchdogcnt);
|
||||
|
||||
#define DIG_PROCESS_INPUTS_FLAG 0x01
|
||||
#define DIG_PROCESS_OUTPUTS_FLAG 0x02
|
||||
#define DIG_PROCESS_WD_FLAG 0x04
|
||||
#define DIG_PROCESS_APP_HOOK_FLAG 0x08
|
||||
/** Implements the watch-dog counter to count if we should make a state change
|
||||
* due to missing incoming SM2 events. Updates local I/O and run the application
|
||||
* in the following order, call read EtherCAT outputs, execute user provided
|
||||
* application hook and call write EtherCAT inputs.
|
||||
*
|
||||
* @param[in] flags = User input what to execute
|
||||
*/
|
||||
void DIG_process (uint8_t flags);
|
||||
|
||||
/**
|
||||
* Handler for SM change, SM0/1, AL CONTROL and EEPROM events, the application
|
||||
* control what interrupts that should be served and re-activated with
|
||||
* event mask argument
|
||||
*
|
||||
* @param[in] event_mask = Event mask for interrupts to serve and re-activate
|
||||
* after served
|
||||
*/
|
||||
void ecat_slv_worker (uint32_t event_mask);
|
||||
|
||||
/**
|
||||
* Poll SM0/1, EEPROM and AL CONTROL events in a SM/DC synchronization
|
||||
* application
|
||||
*/
|
||||
void ecat_slv_poll (void);
|
||||
|
||||
/**
|
||||
* Poll all events in a free-run application
|
||||
*/
|
||||
void ecat_slv (void);
|
||||
|
||||
/**
|
||||
* Initialize the slave stack
|
||||
*
|
||||
* @param[in] config = User input how to configure the stack
|
||||
*/
|
||||
void ecat_slv_init (esc_cfg_t * config);
|
||||
|
||||
#endif /* __ECAT_SLV_H__ */
|
||||
BIN
Pcb-1-lan9252/Firmware/lib/soes/eeprom.bin
Executable file
BIN
Pcb-1-lan9252/Firmware/lib/soes/eeprom.bin
Executable file
Binary file not shown.
65
Pcb-1-lan9252/Firmware/lib/soes/eeprom.hex
Executable file
65
Pcb-1-lan9252/Firmware/lib/soes/eeprom.hex
Executable file
@@ -0,0 +1,65 @@
|
||||
:2000000080060344640000000000000000001400AA0A0000CCBCBB000200000001000000A1
|
||||
:20002000000000000000000000000000000000000010000200120002040000000000000096
|
||||
:200040000000000000000000000000000000000000000000000000000000000000000000A0
|
||||
:20006000000000000000000000000000000000000000000000000000000000000F00010070
|
||||
:200080000A002000040C4561736572434154323030300E4D616368696E65436F6E74726F64
|
||||
:2000A0006C06494D474342591A4D6574616C4D7573696E67732045617365724341542032E6
|
||||
:2000C000303030001E00100002030104001300000000000000000000110000000000000034
|
||||
:2000E000000000000000000028000200010203002900100000100002260001010012000249
|
||||
:20010000220001020016000024000103001A000020000104FFFFFFFFFFFFFFFFFFFFFFFF49
|
||||
:20012000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFDF
|
||||
:20014000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFBF
|
||||
:20016000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF9F
|
||||
:20018000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF7F
|
||||
:2001A000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5F
|
||||
:2001C000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF3F
|
||||
:2001E000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF1F
|
||||
:20020000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE
|
||||
:20022000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFDE
|
||||
:20024000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFBE
|
||||
:20026000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF9E
|
||||
:20028000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF7E
|
||||
:2002A000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5E
|
||||
:2002C000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF3E
|
||||
:2002E000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF1E
|
||||
:20030000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFD
|
||||
:20032000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFDD
|
||||
:20034000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFBD
|
||||
:20036000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF9D
|
||||
:20038000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF7D
|
||||
:2003A000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D
|
||||
:2003C000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF3D
|
||||
:2003E000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF1D
|
||||
:20040000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFC
|
||||
:20042000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFDC
|
||||
:20044000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFBC
|
||||
:20046000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF9C
|
||||
:20048000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF7C
|
||||
:2004A000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5C
|
||||
:2004C000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF3C
|
||||
:2004E000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF1C
|
||||
:20050000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFB
|
||||
:20052000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFDB
|
||||
:20054000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFBB
|
||||
:20056000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF9B
|
||||
:20058000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF7B
|
||||
:2005A000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5B
|
||||
:2005C000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF3B
|
||||
:2005E000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF1B
|
||||
:20060000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFA
|
||||
:20062000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFDA
|
||||
:20064000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFBA
|
||||
:20066000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF9A
|
||||
:20068000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF7A
|
||||
:2006A000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5A
|
||||
:2006C000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF3A
|
||||
:2006E000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF1A
|
||||
:20070000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF9
|
||||
:20072000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFD9
|
||||
:20074000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFB9
|
||||
:20076000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF99
|
||||
:20078000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF79
|
||||
:2007A000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF59
|
||||
:2007C000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF39
|
||||
:2007E000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF19
|
||||
:00000001FF
|
||||
1179
Pcb-1-lan9252/Firmware/lib/soes/esc.c
Executable file
1179
Pcb-1-lan9252/Firmware/lib/soes/esc.c
Executable file
File diff suppressed because it is too large
Load Diff
769
Pcb-1-lan9252/Firmware/lib/soes/esc.h
Executable file
769
Pcb-1-lan9252/Firmware/lib/soes/esc.h
Executable file
@@ -0,0 +1,769 @@
|
||||
/*
|
||||
* Licensed under the GNU General Public License version 2 with exceptions. See
|
||||
* LICENSE file in the project root for full license information
|
||||
*/
|
||||
|
||||
/** \file
|
||||
* \brief
|
||||
* Headerfile for esc.h
|
||||
*/
|
||||
|
||||
#ifndef __esc__
|
||||
#define __esc__
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <cc.h>
|
||||
#include <esc_coe.h>
|
||||
#include "ecat_options.h"
|
||||
|
||||
#define ESCREG_ADDRESS 0x0010
|
||||
#define ESCREG_DLSTATUS 0x0110
|
||||
#define ESCREG_ALCONTROL 0x0120
|
||||
#define ESCREG_ALSTATUS 0x0130
|
||||
#define ESCREG_ALERROR 0x0134
|
||||
#define ESCREG_ALEVENTMASK 0x0204
|
||||
#define ESCREG_ALEVENT 0x0220
|
||||
#define ESCREG_ALEVENT_SM_MASK 0x0310
|
||||
#define ESCREG_ALEVENT_SMCHANGE 0x0010
|
||||
#define ESCREG_ALEVENT_CONTROL 0x0001
|
||||
#define ESCREG_ALEVENT_DC_LATCH 0x0002
|
||||
#define ESCREG_ALEVENT_DC_SYNC0 0x0004
|
||||
#define ESCREG_ALEVENT_DC_SYNC1 0x0008
|
||||
#define ESCREG_ALEVENT_EEP 0x0020
|
||||
#define ESCREG_ALEVENT_WD 0x0040
|
||||
#define ESCREG_ALEVENT_SM0 0x0100
|
||||
#define ESCREG_ALEVENT_SM1 0x0200
|
||||
#define ESCREG_ALEVENT_SM2 0x0400
|
||||
#define ESCREG_ALEVENT_SM3 0x0800
|
||||
#define ESCREG_WDSTATUS 0x0440
|
||||
#define ESCREG_EECONTSTAT 0x0502
|
||||
#define ESCREG_EEDATA 0x0508
|
||||
#define ESCREG_SM0 0x0800
|
||||
#define ESCREG_SM0STATUS (ESCREG_SM0 + 5)
|
||||
#define ESCREG_SM0ACTIVATE (ESCREG_SM0 + 6)
|
||||
#define ESCREG_SM0PDI (ESCREG_SM0 + 7)
|
||||
#define ESCREG_SM1 (ESCREG_SM0 + 0x08)
|
||||
#define ESCREG_SM2 (ESCREG_SM0 + 0x10)
|
||||
#define ESCREG_SM3 (ESCREG_SM0 + 0x18)
|
||||
#define ESCREG_LOCALTIME 0x0910
|
||||
#define ESCREG_LOCALTIME_OFFSET 0x0920
|
||||
#define ESCREG_SYNC_ACT 0x0981
|
||||
#define ESCREG_SYNC_ACT_ACTIVATED 0x01
|
||||
#define ESCREG_SYNC_SYNC0_EN 0x02
|
||||
#define ESCREG_SYNC_SYNC1_EN 0x04
|
||||
#define ESCREG_SYNC_AUTO_ACTIVATED 0x08
|
||||
#define ESCREG_SYNC0_CYCLE_TIME 0x09A0
|
||||
#define ESCREG_SYNC1_CYCLE_TIME 0x09A4
|
||||
#define ESCREG_SMENABLE_BIT 0x01
|
||||
#define ESCREG_AL_STATEMASK 0x001f
|
||||
#define ESCREG_AL_ALLBUTINITMASK 0x0e
|
||||
#define ESCREG_AL_ERRACKMASK 0x0f
|
||||
|
||||
#define SYNCTYPE_SUPPORT_FREERUN 0x01
|
||||
#define SYNCTYPE_SUPPORT_SYNCHRON 0x02
|
||||
#define SYNCTYPE_SUPPORT_DCSYNC0 0x04
|
||||
#define SYNCTYPE_SUPPORT_DCSYNC1 0x08
|
||||
#define SYNCTYPE_SUPPORT_SUBCYCLE 0x10
|
||||
|
||||
#define ESCinit 0x01
|
||||
#define ESCpreop 0x02
|
||||
#define ESCboot 0x03
|
||||
#define ESCsafeop 0x04
|
||||
#define ESCop 0x08
|
||||
#define ESCerror 0x10
|
||||
|
||||
#define INIT_TO_INIT 0x11
|
||||
#define INIT_TO_PREOP 0x21
|
||||
#define INIT_TO_BOOT 0x31
|
||||
#define INIT_TO_SAFEOP 0x41
|
||||
#define INIT_TO_OP 0x81
|
||||
#define PREOP_TO_INIT 0x12
|
||||
#define PREOP_TO_PREOP 0x22
|
||||
#define PREOP_TO_BOOT 0x32
|
||||
#define PREOP_TO_SAFEOP 0x42
|
||||
#define PREOP_TO_OP 0x82
|
||||
#define BOOT_TO_INIT 0x13
|
||||
#define BOOT_TO_PREOP 0x23
|
||||
#define BOOT_TO_BOOT 0x33
|
||||
#define BOOT_TO_SAFEOP 0x43
|
||||
#define BOOT_TO_OP 0x83
|
||||
#define SAFEOP_TO_INIT 0x14
|
||||
#define SAFEOP_TO_PREOP 0x24
|
||||
#define SAFEOP_TO_BOOT 0x34
|
||||
#define SAFEOP_TO_SAFEOP 0x44
|
||||
#define SAFEOP_TO_OP 0x84
|
||||
#define OP_TO_INIT 0x18
|
||||
#define OP_TO_PREOP 0x28
|
||||
#define OP_TO_BOOT 0x38
|
||||
#define OP_TO_SAFEOP 0x48
|
||||
#define OP_TO_OP 0x88
|
||||
|
||||
#define ALERR_NONE 0x0000
|
||||
#define ALERR_UNSPECIFIEDERROR 0x0001
|
||||
#define ALERR_NOMEMORY 0x0002
|
||||
#define ALERR_INVALIDSTATECHANGE 0x0011
|
||||
#define ALERR_UNKNOWNSTATE 0x0012
|
||||
#define ALERR_BOOTNOTSUPPORTED 0x0013
|
||||
#define ALERR_NOVALIDFIRMWARE 0x0014
|
||||
#define ALERR_INVALIDBOOTMBXCONFIG 0x0015
|
||||
#define ALERR_INVALIDMBXCONFIG 0x0016
|
||||
#define ALERR_INVALIDSMCONFIG 0x0017
|
||||
#define ALERR_NOVALIDINPUTS 0x0018
|
||||
#define ALERR_NOVALIDOUTPUTS 0x0019
|
||||
#define ALERR_SYNCERROR 0x001A
|
||||
#define ALERR_WATCHDOG 0x001B
|
||||
#define ALERR_INVALIDSYNCMANAGERTYP 0x001C
|
||||
#define ALERR_INVALIDOUTPUTSM 0x001D
|
||||
#define ALERR_INVALIDINPUTSM 0x001E
|
||||
#define ALERR_INVALIDWDTCFG 0x001F
|
||||
#define ALERR_SLAVENEEDSCOLDSTART 0x0020
|
||||
#define ALERR_SLAVENEEDSINIT 0x0021
|
||||
#define ALERR_SLAVENEEDSPREOP 0x0022
|
||||
#define ALERR_SLAVENEEDSSAFEOP 0x0023
|
||||
#define ALERR_INVALIDINPUTMAPPING 0x0024
|
||||
#define ALERR_INVALIDOUTPUTMAPPING 0x0025
|
||||
#define ALERR_INCONSISTENTSETTINGS 0x0026
|
||||
#define ALERR_FREERUNNOTSUPPORTED 0x0027
|
||||
#define ALERR_SYNCNOTSUPPORTED 0x0028
|
||||
#define ALERR_FREERUNNEEDS3BUFFMODE 0x0029
|
||||
#define ALERR_BACKGROUNDWATCHDOG 0x002A
|
||||
#define ALERR_NOVALIDINPUTSOUTPUTS 0x002B
|
||||
#define ALERR_FATALSYNCERROR 0x002C
|
||||
#define ALERR_NOSYNCERROR 0x002D
|
||||
#define ALERR_INVALIDINPUTFMMUCFG 0x002E
|
||||
#define ALERR_DCINVALIDSYNCCFG 0x0030
|
||||
#define ALERR_INVALIDDCLATCHCFG 0x0031
|
||||
#define ALERR_PLLERROR 0x0032
|
||||
#define ALERR_DCSYNCIOERROR 0x0033
|
||||
#define ALERR_DCSYNCTIMEOUT 0x0034
|
||||
#define ALERR_DCSYNCCYCLETIME 0x0035
|
||||
#define ALERR_DCSYNC0CYCLETIME 0x0036
|
||||
#define ALERR_DCSYNC1CYCLETIME 0x0037
|
||||
#define ALERR_MBXAOE 0x0041
|
||||
#define ALERR_MBXEOE 0x0042
|
||||
#define ALERR_MBXCOE 0x0043
|
||||
#define ALERR_MBXFOE 0x0044
|
||||
#define ALERR_MBXSOE 0x0045
|
||||
#define ALERR_MBXVOE 0x004F
|
||||
#define ALERR_EEPROMNOACCESS 0x0050
|
||||
#define ALERR_EEPROMERROR 0x0051
|
||||
#define ALERR_SLAVERESTARTEDLOCALLY 0x0060
|
||||
#define ALERR_DEVICEIDVALUEUPDATED 0x0061
|
||||
#define ALERR_APPLCTRLAVAILABLE 0x00f0
|
||||
#define ALERR_UNKNOWN 0xffff
|
||||
|
||||
#define MBXERR_SYNTAX 0x0001
|
||||
#define MBXERR_UNSUPPORTEDPROTOCOL 0x0002
|
||||
#define MBXERR_INVALIDCHANNEL 0x0003
|
||||
#define MBXERR_SERVICENOTSUPPORTED 0x0004
|
||||
#define MBXERR_INVALIDHEADER 0x0005
|
||||
#define MBXERR_SIZETOOSHORT 0x0006
|
||||
#define MBXERR_NOMOREMEMORY 0x0007
|
||||
#define MBXERR_INVALIDSIZE 0x0008
|
||||
|
||||
#define ABORT_NOTOGGLE 0x05030000
|
||||
#define ABORT_TRANSFER_TIMEOUT 0x05040000
|
||||
#define ABORT_UNKNOWN 0x05040001
|
||||
#define ABORT_INVALID_BLOCK_SIZE 0x05040002
|
||||
#define ABORT_INVALID_SEQUENCE_NUMBER 0x05040003
|
||||
#define ABORT_BLOCK_CRC_ERROR 0x05040004
|
||||
#define ABORT_OUT_OF_MEMORY 0x05040005
|
||||
#define ABORT_UNSUPPORTED 0x06010000
|
||||
#define ABORT_WRITEONLY 0x06010001
|
||||
#define ABORT_READONLY 0x06010002
|
||||
#define ABORT_SUBINDEX0_NOT_ZERO 0x06010003
|
||||
#define ABORT_CA_NOT_SUPPORTED 0x06010004
|
||||
#define ABORT_EXCEEDS_MBOX_SIZE 0x06010005
|
||||
#define ABORT_SDO_DOWNLOAD_BLOCKED 0x06010006
|
||||
#define ABORT_NOOBJECT 0x06020000
|
||||
#define ABORT_MAPPING_OBJECT_ERROR 0x06040041
|
||||
#define ABORT_MAPPING_LENGTH_ERROR 0x06040042
|
||||
#define ABORT_GENERAL_PARAMETER_ERROR 0x06040043
|
||||
#define ABORT_GENERAL_DEVICE_ERROR 0x06040047
|
||||
#define ABORT_HARDWARE_ERROR 0x06060000
|
||||
#define ABORT_TYPEMISMATCH 0x06070010
|
||||
#define ABORT_DATATYPE_TOO_HIGH 0x06070012
|
||||
#define ABORT_DATATYPE_TOO_LOW 0x06070013
|
||||
#define ABORT_NOSUBINDEX 0x06090011
|
||||
#define ABORT_VALUE_EXCEEDED 0x06090030
|
||||
#define ABORT_VALUE_TOO_HIGH 0x06090031
|
||||
#define ABORT_VALUE_TOO_LOW 0x06090032
|
||||
#define ABORT_MODULE_LIST_MISMATCH 0x06090033
|
||||
#define ABORT_MAX_VAL_LESS_THAN_MIN_VAL 0x06090036
|
||||
#define ABORT_RESOURCE_NOT_AVAILABLE 0x060A0023
|
||||
#define ABORT_GENERALERROR 0x08000000
|
||||
#define ABORT_DATA_STORE_ERROR 0x08000020
|
||||
#define ABORT_DATA_STORE_LOCAL_ERROR 0x08000021
|
||||
#define ABORT_NOTINTHISSTATE 0x08000022
|
||||
#define ABORT_OBJECT_DICTIONARY_ERROR 0x08000023
|
||||
#define ABORT_NO_DATA_AVAILABLE 0x08000024
|
||||
|
||||
#define MBXstate_idle 0x00
|
||||
#define MBXstate_inclaim 0x01
|
||||
#define MBXstate_outclaim 0x02
|
||||
#define MBXstate_outreq 0x03
|
||||
#define MBXstate_outpost 0x04
|
||||
#define MBXstate_backup 0x05
|
||||
#define MBXstate_again 0x06
|
||||
|
||||
#define COE_DEFAULTLENGTH 0x0a
|
||||
#define COE_HEADERSIZE 0x0a
|
||||
#define COE_SEGMENTHEADERSIZE 0x03
|
||||
#define COE_SDOREQUEST 0x02
|
||||
#define COE_SDORESPONSE 0x03
|
||||
#define COE_SDOINFORMATION 0x08
|
||||
#define COE_COMMAND_SDOABORT 0x80
|
||||
#define COE_COMMAND_UPLOADREQUEST 0x40
|
||||
#define COE_COMMAND_UPLOADRESPONSE 0x40
|
||||
#define COE_COMMAND_UPLOADSEGMENT 0x00
|
||||
#define COE_COMMAND_UPLOADSEGREQ 0x60
|
||||
#define COE_COMMAND_DOWNLOADREQUEST 0x20
|
||||
#define COE_COMMAND_DOWNLOADRESPONSE 0x60
|
||||
#define COE_COMMAND_DOWNLOADSEGREQ 0x00
|
||||
#define COE_COMMAND_DOWNLOADSEGRESP 0x20
|
||||
#define COE_COMMAND_LASTSEGMENTBIT 0x01
|
||||
#define COE_SIZE_INDICATOR 0x01
|
||||
#define COE_EXPEDITED_INDICATOR 0x02
|
||||
#define COE_COMPLETEACCESS 0x10
|
||||
#define COE_TOGGLEBIT 0x10
|
||||
#define COE_INFOERROR 0x07
|
||||
#define COE_GETODLISTRESPONSE 0x02
|
||||
#define COE_GETODRESPONSE 0x04
|
||||
#define COE_ENTRYDESCRIPTIONRESPONSE 0x06
|
||||
#define COE_VALUEINFO_ACCESS 0x01
|
||||
#define COE_VALUEINFO_OBJECT 0x02
|
||||
#define COE_VALUEINFO_MAPPABLE 0x04
|
||||
#define COE_VALUEINFO_TYPE 0x08
|
||||
#define COE_VALUEINFO_DEFAULT 0x10
|
||||
#define COE_VALUEINFO_MINIMUM 0x20
|
||||
#define COE_VALUEINFO_MAXIMUM 0x40
|
||||
#define COE_MINIMUM_LENGTH 8
|
||||
|
||||
#define MBXERR 0x00
|
||||
#define MBXAOE 0x01
|
||||
#define MBXEOE 0x02
|
||||
#define MBXCOE 0x03
|
||||
#define MBXFOE 0x04
|
||||
#define MBXODL 0x10
|
||||
#define MBXOD 0x20
|
||||
#define MBXED 0x30
|
||||
#define MBXSEU 0x40
|
||||
#define MBXSED 0x50
|
||||
|
||||
#define SMRESULT_ERRSM0 0x01
|
||||
#define SMRESULT_ERRSM1 0x02
|
||||
#define SMRESULT_ERRSM2 0x04
|
||||
#define SMRESULT_ERRSM3 0x08
|
||||
|
||||
#define FOE_ERR_NOTDEFINED 0x8000
|
||||
#define FOE_ERR_NOTFOUND 0x8001
|
||||
#define FOE_ERR_ACCESS 0x8002
|
||||
#define FOE_ERR_DISKFULL 0x8003
|
||||
#define FOE_ERR_ILLEGAL 0x8004
|
||||
#define FOE_ERR_PACKETNO 0x8005
|
||||
#define FOE_ERR_EXISTS 0x8006
|
||||
#define FOE_ERR_NOUSER 0x8007
|
||||
#define FOE_ERR_BOOTSTRAPONLY 0x8008
|
||||
#define FOE_ERR_NOTINBOOTSTRAP 0x8009
|
||||
#define FOE_ERR_NORIGHTS 0x800A
|
||||
#define FOE_ERR_PROGERROR 0x800B
|
||||
#define FOE_ERR_CHECKSUM 0x800C
|
||||
|
||||
#define FOE_OP_RRQ 1
|
||||
#define FOE_OP_WRQ 2
|
||||
#define FOE_OP_DATA 3
|
||||
#define FOE_OP_ACK 4
|
||||
#define FOE_OP_ERR 5
|
||||
#define FOE_OP_BUSY 6
|
||||
|
||||
#define FOE_READY 0
|
||||
#define FOE_WAIT_FOR_ACK 1
|
||||
#define FOE_WAIT_FOR_FINAL_ACK 2
|
||||
#define FOE_WAIT_FOR_DATA 3
|
||||
|
||||
#define EOE_RESULT_SUCCESS 0x0000
|
||||
#define EOE_RESULT_UNSPECIFIED_ERROR 0x0001
|
||||
#define EOE_RESULT_UNSUPPORTED_FRAME_TYPE 0x0002
|
||||
#define EOE_RESULT_NO_IP_SUPPORT 0x0201
|
||||
#define EOE_RESULT_NO_DHCP_SUPPORT 0x0202
|
||||
#define EOE_RESULT_NO_FILTER_SUPPORT 0x0401
|
||||
|
||||
#define APPSTATE_IDLE 0x00
|
||||
#define APPSTATE_INPUT 0x01
|
||||
#define APPSTATE_OUTPUT 0x02
|
||||
|
||||
#define PREALLOC_FACTOR 3
|
||||
#define PREALLOC_BUFFER_SIZE (PREALLOC_FACTOR * MBXSIZE)
|
||||
|
||||
typedef struct sm_cfg
|
||||
{
|
||||
uint16_t cfg_sma;
|
||||
uint16_t cfg_sml;
|
||||
uint16_t cfg_sme;
|
||||
uint8_t cfg_smc;
|
||||
uint8_t cfg_smact;
|
||||
}sm_cfg_t;
|
||||
|
||||
typedef struct esc_cfg
|
||||
{
|
||||
void * user_arg;
|
||||
int use_interrupt;
|
||||
int watchdog_cnt;
|
||||
bool skip_default_initialization;
|
||||
void (*set_defaults_hook) (void);
|
||||
void (*pre_state_change_hook) (uint8_t * as, uint8_t * an);
|
||||
void (*post_state_change_hook) (uint8_t * as, uint8_t * an);
|
||||
void (*application_hook) (void);
|
||||
void (*safeoutput_override) (void);
|
||||
uint32_t (*pre_object_download_hook) (uint16_t index,
|
||||
uint8_t subindex,
|
||||
void * data,
|
||||
size_t size,
|
||||
uint16_t flags);
|
||||
uint32_t (*post_object_download_hook) (uint16_t index,
|
||||
uint8_t subindex,
|
||||
uint16_t flags);
|
||||
uint32_t (*pre_object_upload_hook) (uint16_t index,
|
||||
uint8_t subindex,
|
||||
void * data,
|
||||
size_t size,
|
||||
uint16_t flags);
|
||||
uint32_t (*post_object_upload_hook) (uint16_t index,
|
||||
uint8_t subindex,
|
||||
uint16_t flags);
|
||||
void (*rxpdo_override) (void);
|
||||
void (*txpdo_override) (void);
|
||||
void (*esc_hw_interrupt_enable) (uint32_t mask);
|
||||
void (*esc_hw_interrupt_disable) (uint32_t mask);
|
||||
void (*esc_hw_eep_handler) (void);
|
||||
uint16_t (*esc_check_dc_handler) (void);
|
||||
} esc_cfg_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint8_t state;
|
||||
} _App;
|
||||
|
||||
// Attention! this struct is always little-endian
|
||||
CC_PACKED_BEGIN
|
||||
typedef struct CC_PACKED
|
||||
{
|
||||
uint16_t PSA;
|
||||
uint16_t Length;
|
||||
|
||||
#if defined(EC_LITTLE_ENDIAN)
|
||||
uint8_t Mode:2;
|
||||
uint8_t Direction:2;
|
||||
uint8_t IntECAT:1;
|
||||
uint8_t IntPDI:1;
|
||||
uint8_t WTE:1;
|
||||
uint8_t R1:1;
|
||||
|
||||
uint8_t IntW:1;
|
||||
uint8_t IntR:1;
|
||||
uint8_t R2:1;
|
||||
uint8_t MBXstat:1;
|
||||
uint8_t BUFstat:2;
|
||||
uint8_t R3:2;
|
||||
|
||||
uint8_t ECsm:1;
|
||||
uint8_t ECrep:1;
|
||||
uint8_t ECr4:4;
|
||||
uint8_t EClatchEC:1;
|
||||
uint8_t EClatchPDI:1;
|
||||
|
||||
uint8_t PDIsm:1;
|
||||
uint8_t PDIrep:1;
|
||||
uint8_t PDIr5:6;
|
||||
#endif
|
||||
|
||||
#if defined(EC_BIG_ENDIAN)
|
||||
uint8_t R1:1;
|
||||
uint8_t WTE:1;
|
||||
uint8_t IntPDI:1;
|
||||
uint8_t IntECAT:1;
|
||||
uint8_t Direction:2;
|
||||
uint8_t Mode:2;
|
||||
|
||||
uint8_t R3:2;
|
||||
uint8_t BUFstat:2;
|
||||
uint8_t MBXstat:1;
|
||||
uint8_t R2:1;
|
||||
uint8_t IntR:1;
|
||||
uint8_t IntW:1;
|
||||
|
||||
uint8_t EClatchPDI:1;
|
||||
uint8_t EClatchEC:1;
|
||||
uint8_t ECr4:4;
|
||||
uint8_t ECrep:1;
|
||||
uint8_t ECsm:1;
|
||||
|
||||
uint8_t PDIr5:6;
|
||||
uint8_t PDIrep:1;
|
||||
uint8_t PDIsm:1;
|
||||
#endif
|
||||
} _ESCsm;
|
||||
CC_PACKED_END
|
||||
|
||||
/* Attention! this struct is always little-endian */
|
||||
CC_PACKED_BEGIN
|
||||
typedef struct CC_PACKED
|
||||
{
|
||||
uint16_t PSA;
|
||||
uint16_t Length;
|
||||
uint8_t Command;
|
||||
uint8_t Status;
|
||||
uint8_t ActESC;
|
||||
uint8_t ActPDI;
|
||||
} _ESCsm2;
|
||||
CC_PACKED_END
|
||||
|
||||
CC_PACKED_BEGIN
|
||||
typedef struct CC_PACKED
|
||||
{
|
||||
uint16_t PSA;
|
||||
uint16_t Length;
|
||||
uint8_t Command;
|
||||
} _ESCsmCompact;
|
||||
CC_PACKED_END
|
||||
|
||||
typedef struct
|
||||
{
|
||||
/* Configuration input is saved so the user variable may go out-of-scope */
|
||||
int use_interrupt;
|
||||
sm_cfg_t mb[2];
|
||||
sm_cfg_t mbboot[2];
|
||||
bool skip_default_initialization;
|
||||
void (*set_defaults_hook) (void);
|
||||
void (*pre_state_change_hook) (uint8_t * as, uint8_t * an);
|
||||
void (*post_state_change_hook) (uint8_t * as, uint8_t * an);
|
||||
void (*application_hook) (void);
|
||||
void (*safeoutput_override) (void);
|
||||
uint32_t (*pre_object_download_hook) (uint16_t index,
|
||||
uint8_t subindex,
|
||||
void * data,
|
||||
size_t size,
|
||||
uint16_t flags);
|
||||
uint32_t (*post_object_download_hook) (uint16_t index,
|
||||
uint8_t subindex,
|
||||
uint16_t flags);
|
||||
uint32_t (*pre_object_upload_hook) (uint16_t index,
|
||||
uint8_t subindex,
|
||||
void * data,
|
||||
size_t size,
|
||||
uint16_t flags);
|
||||
uint32_t (*post_object_upload_hook) (uint16_t index,
|
||||
uint8_t subindex,
|
||||
uint16_t flags);
|
||||
void (*rxpdo_override) (void);
|
||||
void (*txpdo_override) (void);
|
||||
void (*esc_hw_interrupt_enable) (uint32_t mask);
|
||||
void (*esc_hw_interrupt_disable) (uint32_t mask);
|
||||
void (*esc_hw_eep_handler) (void);
|
||||
uint16_t (*esc_check_dc_handler) (void);
|
||||
uint8_t MBXrun;
|
||||
size_t activembxsize;
|
||||
sm_cfg_t * activemb0;
|
||||
sm_cfg_t * activemb1;
|
||||
uint16_t ESC_SM2_sml;
|
||||
uint16_t ESC_SM3_sml;
|
||||
uint8_t dcsync;
|
||||
uint16_t synccounterlimit;
|
||||
uint16_t ALstatus;
|
||||
uint16_t ALcontrol;
|
||||
uint16_t ALerror;
|
||||
uint16_t DLstatus;
|
||||
uint16_t address;
|
||||
uint8_t mbxcnt;
|
||||
uint8_t mbxincnt;
|
||||
uint8_t mbxoutpost;
|
||||
uint8_t mbxbackup;
|
||||
uint8_t xoe;
|
||||
uint8_t txcue;
|
||||
uint8_t mbxfree;
|
||||
uint8_t segmented;
|
||||
void *data;
|
||||
uint16_t entries;
|
||||
uint16_t frags;
|
||||
uint16_t fragsleft;
|
||||
uint16_t index;
|
||||
uint8_t subindex;
|
||||
uint16_t flags;
|
||||
|
||||
uint8_t toggle;
|
||||
|
||||
int sm2mappings;
|
||||
int sm3mappings;
|
||||
|
||||
uint8_t SMtestresult;
|
||||
uint32_t PrevTime;
|
||||
_ESCsm SM[4];
|
||||
/* Volatile since it may be read from ISR */
|
||||
volatile int watchdogcnt;
|
||||
volatile uint32_t Time;
|
||||
volatile uint16_t ALevent;
|
||||
volatile int8_t synccounter;
|
||||
volatile _App App;
|
||||
uint8_t mbxdata[PREALLOC_BUFFER_SIZE];
|
||||
} _ESCvar;
|
||||
|
||||
CC_PACKED_BEGIN
|
||||
typedef struct CC_PACKED
|
||||
{
|
||||
uint16_t length;
|
||||
uint16_t address;
|
||||
|
||||
#if defined(EC_LITTLE_ENDIAN)
|
||||
uint8_t channel:6;
|
||||
uint8_t priority:2;
|
||||
|
||||
uint8_t mbxtype:4;
|
||||
uint8_t mbxcnt:4;
|
||||
#endif
|
||||
|
||||
#if defined(EC_BIG_ENDIAN)
|
||||
uint8_t priority:2;
|
||||
uint8_t channel:6;
|
||||
|
||||
uint8_t mbxcnt:4;
|
||||
uint8_t mbxtype:4;
|
||||
#endif
|
||||
} _MBXh;
|
||||
CC_PACKED_END
|
||||
|
||||
CC_PACKED_BEGIN
|
||||
typedef struct CC_PACKED
|
||||
{
|
||||
_MBXh header;
|
||||
uint8_t b[0];
|
||||
} _MBX;
|
||||
CC_PACKED_END
|
||||
|
||||
CC_PACKED_BEGIN
|
||||
typedef struct CC_PACKED
|
||||
{
|
||||
uint16_t numberservice;
|
||||
} _COEh;
|
||||
CC_PACKED_END
|
||||
|
||||
CC_PACKED_BEGIN
|
||||
typedef struct CC_PACKED
|
||||
{
|
||||
#if defined(EC_LITTLE_ENDIAN)
|
||||
uint8_t opcode:7;
|
||||
uint8_t incomplete:1;
|
||||
#endif
|
||||
|
||||
#if defined(EC_BIG_ENDIAN)
|
||||
uint8_t incomplete:1;
|
||||
uint8_t opcode:7;
|
||||
#endif
|
||||
|
||||
uint8_t reserved;
|
||||
uint16_t fragmentsleft;
|
||||
} _INFOh;
|
||||
CC_PACKED_END
|
||||
|
||||
CC_PACKED_BEGIN
|
||||
typedef struct CC_PACKED
|
||||
{
|
||||
_MBXh mbxheader;
|
||||
uint16_t type;
|
||||
uint16_t detail;
|
||||
} _MBXerr;
|
||||
CC_PACKED_END
|
||||
|
||||
CC_PACKED_BEGIN
|
||||
typedef struct CC_PACKED
|
||||
{
|
||||
_MBXh mbxheader;
|
||||
_COEh coeheader;
|
||||
uint8_t command;
|
||||
uint16_t index;
|
||||
uint8_t subindex;
|
||||
uint32_t size;
|
||||
} _COEsdo;
|
||||
CC_PACKED_END
|
||||
|
||||
CC_PACKED_BEGIN
|
||||
typedef struct CC_PACKED
|
||||
{
|
||||
_MBXh mbxheader;
|
||||
_COEh coeheader;
|
||||
_INFOh infoheader;
|
||||
uint16_t index;
|
||||
uint16_t datatype;
|
||||
uint8_t maxsub;
|
||||
uint8_t objectcode;
|
||||
char name;
|
||||
} _COEobjdesc;
|
||||
CC_PACKED_END
|
||||
|
||||
CC_PACKED_BEGIN
|
||||
typedef struct CC_PACKED
|
||||
{
|
||||
_MBXh mbxheader;
|
||||
_COEh coeheader;
|
||||
_INFOh infoheader;
|
||||
uint16_t index;
|
||||
uint8_t subindex;
|
||||
uint8_t valueinfo;
|
||||
uint16_t datatype;
|
||||
uint16_t bitlength;
|
||||
uint16_t access;
|
||||
char name;
|
||||
} _COEentdesc;
|
||||
CC_PACKED_END
|
||||
|
||||
CC_PACKED_BEGIN
|
||||
typedef struct CC_PACKED
|
||||
{
|
||||
uint8_t opcode;
|
||||
uint8_t reserved;
|
||||
union
|
||||
{
|
||||
uint32_t password;
|
||||
uint32_t packetnumber;
|
||||
uint32_t errorcode;
|
||||
};
|
||||
} _FOEh;
|
||||
CC_PACKED_END
|
||||
|
||||
CC_PACKED_BEGIN
|
||||
typedef struct CC_PACKED
|
||||
{
|
||||
_MBXh mbxheader;
|
||||
_FOEh foeheader;
|
||||
union
|
||||
{
|
||||
char filename[0];
|
||||
uint8_t data[0];
|
||||
char errortext[0];
|
||||
};
|
||||
} _FOE;
|
||||
CC_PACKED_END
|
||||
|
||||
CC_PACKED_BEGIN
|
||||
typedef struct CC_PACKED
|
||||
{
|
||||
uint16_t frameinfo1;
|
||||
union
|
||||
{
|
||||
uint16_t frameinfo2;
|
||||
uint16_t result;
|
||||
};
|
||||
} _EOEh;
|
||||
CC_PACKED_END
|
||||
|
||||
CC_PACKED_BEGIN
|
||||
typedef struct CC_PACKED
|
||||
{
|
||||
_MBXh mbxheader;
|
||||
_EOEh eoeheader;
|
||||
uint8_t data[0];
|
||||
} _EOE;
|
||||
CC_PACKED_END
|
||||
|
||||
/* state definition in mailbox
|
||||
* 0 : idle
|
||||
* 1 : claimed for inbox
|
||||
* 2 : claimed for outbox
|
||||
* 3 : request post outbox
|
||||
* 4 : outbox posted not send
|
||||
* 5 : backup outbox
|
||||
* 6 : mailbox needs to be transmitted again
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
uint8_t state;
|
||||
} _MBXcontrol;
|
||||
|
||||
/* Stack reference to application configuration of the ESC */
|
||||
#define ESC_MBXSIZE (ESCvar.activembxsize)
|
||||
#define ESC_MBX0_sma (ESCvar.activemb0->cfg_sma)
|
||||
#define ESC_MBX0_sml (ESCvar.activemb0->cfg_sml)
|
||||
#define ESC_MBX0_sme (ESCvar.activemb0->cfg_sme)
|
||||
#define ESC_MBX0_smc (ESCvar.activemb0->cfg_smc)
|
||||
#define ESC_MBX1_sma (ESCvar.activemb1->cfg_sma)
|
||||
#define ESC_MBX1_sml (ESCvar.activemb1->cfg_sml)
|
||||
#define ESC_MBX1_sme (ESCvar.activemb1->cfg_sme)
|
||||
#define ESC_MBX1_smc (ESCvar.activemb1->cfg_smc)
|
||||
#define ESC_MBXBUFFERS (MBXBUFFERS)
|
||||
#define ESC_SM2_sma (SM2_sma)
|
||||
#define ESC_SM2_smc (SM2_smc)
|
||||
#define ESC_SM2_act (SM2_act)
|
||||
#define ESC_SM3_sma (SM3_sma)
|
||||
#define ESC_SM3_smc (SM3_smc)
|
||||
#define ESC_SM3_act (SM3_act)
|
||||
|
||||
#define ESC_MBXHSIZE sizeof(_MBXh)
|
||||
#define ESC_MBXDSIZE (ESC_MBXSIZE - ESC_MBXHSIZE)
|
||||
#define ESC_FOEHSIZE sizeof(_FOEh)
|
||||
#define ESC_FOE_DATA_SIZE (ESC_MBXSIZE - (ESC_MBXHSIZE +ESC_FOEHSIZE))
|
||||
#define ESC_EOEHSIZE sizeof(_EOEh)
|
||||
#define ESC_EOE_DATA_SIZE (ESC_MBXSIZE - (ESC_MBXHSIZE +ESC_EOEHSIZE))
|
||||
|
||||
void ESC_config (esc_cfg_t * cfg);
|
||||
void ESC_ALerror (uint16_t errornumber);
|
||||
void ESC_ALeventwrite (uint32_t event);
|
||||
uint32_t ESC_ALeventread (void);
|
||||
void ESC_ALeventmaskwrite (uint32_t mask);
|
||||
uint32_t ESC_ALeventmaskread (void);
|
||||
void ESC_ALstatus (uint8_t status);
|
||||
void ESC_ALstatusgotoerror (uint8_t status, uint16_t errornumber);
|
||||
void ESC_SMstatus (uint8_t n);
|
||||
uint8_t ESC_WDstatus (void);
|
||||
uint8_t ESC_claimbuffer (void);
|
||||
uint8_t ESC_startmbx (uint8_t state);
|
||||
void ESC_stopmbx (void);
|
||||
void MBX_error (uint16_t error);
|
||||
uint8_t ESC_mbxprocess (void);
|
||||
void ESC_xoeprocess (void);
|
||||
uint8_t ESC_startinput (uint8_t state);
|
||||
void ESC_stopinput (void);
|
||||
uint8_t ESC_startoutput (uint8_t state);
|
||||
void ESC_stopoutput (void);
|
||||
void ESC_state (void);
|
||||
void ESC_sm_act_event (void);
|
||||
|
||||
/* From hardware file */
|
||||
void ESC_read (uint16_t address, void *buf, uint16_t len);
|
||||
void ESC_write (uint16_t address, void *buf, uint16_t len);
|
||||
void ESC_init (const esc_cfg_t * cfg);
|
||||
void ESC_reset (void);
|
||||
|
||||
/* From application */
|
||||
extern void APP_safeoutput ();
|
||||
extern _ESCvar ESCvar;
|
||||
extern _MBXcontrol MBXcontrol[];
|
||||
extern uint8_t MBX[];
|
||||
extern _SMmap SMmap2[];
|
||||
extern _SMmap SMmap3[];
|
||||
|
||||
/* ATOMIC operations are used when running interrupt driven */
|
||||
#ifndef CC_ATOMIC_SET
|
||||
#define CC_ATOMIC_SET(var,val) (var = val)
|
||||
#endif
|
||||
|
||||
#ifndef CC_ATOMIC_GET
|
||||
#define CC_ATOMIC_GET(var) (var)
|
||||
#endif
|
||||
|
||||
#ifndef CC_ATOMIC_ADD
|
||||
#define CC_ATOMIC_ADD(var,val) (var += val)
|
||||
#endif
|
||||
|
||||
#ifndef CC_ATOMIC_SUB
|
||||
#define CC_ATOMIC_SUB(var,val) (var -= val)
|
||||
#endif
|
||||
|
||||
#ifndef CC_ATOMIC_AND
|
||||
#define CC_ATOMIC_AND(var,val) (var &= val)
|
||||
#endif
|
||||
|
||||
#ifndef CC_ATOMIC_OR
|
||||
#define CC_ATOMIC_OR(var,val) (var |= val)
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
||||
1783
Pcb-1-lan9252/Firmware/lib/soes/esc_coe.c
Executable file
1783
Pcb-1-lan9252/Firmware/lib/soes/esc_coe.c
Executable file
File diff suppressed because it is too large
Load Diff
135
Pcb-1-lan9252/Firmware/lib/soes/esc_coe.h
Executable file
135
Pcb-1-lan9252/Firmware/lib/soes/esc_coe.h
Executable file
@@ -0,0 +1,135 @@
|
||||
/*
|
||||
* Licensed under the GNU General Public License version 2 with exceptions. See
|
||||
* LICENSE file in the project root for full license information
|
||||
*/
|
||||
|
||||
/** \file
|
||||
* \brief
|
||||
* Headerfile for esc_coe.c
|
||||
*/
|
||||
|
||||
#ifndef __esc_coe__
|
||||
#define __esc_coe__
|
||||
|
||||
#include <cc.h>
|
||||
|
||||
CC_PACKED_BEGIN
|
||||
typedef struct CC_PACKED
|
||||
{
|
||||
uint16_t subindex;
|
||||
uint16_t datatype;
|
||||
uint16_t bitlength;
|
||||
uint16_t flags;
|
||||
const char *name;
|
||||
uint32_t value;
|
||||
void *data;
|
||||
} _objd;
|
||||
CC_PACKED_END
|
||||
|
||||
CC_PACKED_BEGIN
|
||||
typedef struct CC_PACKED
|
||||
{
|
||||
uint16_t index;
|
||||
uint16_t objtype;
|
||||
uint8_t maxsub;
|
||||
uint8_t pad1;
|
||||
const char *name;
|
||||
const _objd *objdesc;
|
||||
} _objectlist;
|
||||
CC_PACKED_END
|
||||
|
||||
typedef struct
|
||||
{
|
||||
const _objd * obj;
|
||||
uint16_t offset;
|
||||
} _SMmap;
|
||||
|
||||
#define OBJH_READ 0
|
||||
#define OBJH_WRITE 1
|
||||
|
||||
#define OTYPE_DOMAIN 0x0002
|
||||
#define OTYPE_DEFTYPE 0x0005
|
||||
#define OTYPE_DEFSTRUCT 0x0006
|
||||
#define OTYPE_VAR 0x0007
|
||||
#define OTYPE_ARRAY 0x0008
|
||||
#define OTYPE_RECORD 0x0009
|
||||
|
||||
#define DTYPE_BOOLEAN 0x0001
|
||||
#define DTYPE_INTEGER8 0x0002
|
||||
#define DTYPE_INTEGER16 0x0003
|
||||
#define DTYPE_INTEGER32 0x0004
|
||||
#define DTYPE_UNSIGNED8 0x0005
|
||||
#define DTYPE_UNSIGNED16 0x0006
|
||||
#define DTYPE_UNSIGNED32 0x0007
|
||||
#define DTYPE_REAL32 0x0008
|
||||
#define DTYPE_VISIBLE_STRING 0x0009
|
||||
#define DTYPE_OCTET_STRING 0x000A
|
||||
#define DTYPE_UNICODE_STRING 0x000B
|
||||
#define DTYPE_INTEGER24 0x0010
|
||||
#define DTYPE_UNSIGNED24 0x0016
|
||||
#define DTYPE_INTEGER64 0x0015
|
||||
#define DTYPE_UNSIGNED64 0x001B
|
||||
#define DTYPE_REAL64 0x0011
|
||||
#define DTYPE_PDO_MAPPING 0x0021
|
||||
#define DTYPE_IDENTITY 0x0023
|
||||
#define DTYPE_BITARR8 0x002D
|
||||
#define DTYPE_BITARR16 0x002E
|
||||
#define DTYPE_BITARR32 0x002F
|
||||
#define DTYPE_BIT1 0x0030
|
||||
#define DTYPE_BIT2 0x0031
|
||||
#define DTYPE_BIT3 0x0032
|
||||
#define DTYPE_BIT4 0x0033
|
||||
#define DTYPE_BIT5 0x0034
|
||||
#define DTYPE_BIT6 0x0035
|
||||
#define DTYPE_BIT7 0x0036
|
||||
#define DTYPE_BIT8 0x0037
|
||||
#define DTYPE_ARRAY_OF_INT 0x0260
|
||||
#define DTYPE_ARRAY_OF_SINT 0x0261
|
||||
#define DTYPE_ARRAY_OF_DINT 0x0262
|
||||
#define DTYPE_ARRAY_OF_UDINT 0x0263
|
||||
|
||||
#define ATYPE_Rpre 0x01
|
||||
#define ATYPE_Rsafe 0x02
|
||||
#define ATYPE_Rop 0x04
|
||||
#define ATYPE_Wpre 0x08
|
||||
#define ATYPE_Wsafe 0x10
|
||||
#define ATYPE_Wop 0x20
|
||||
#define ATYPE_RXPDO 0x40
|
||||
#define ATYPE_TXPDO 0x80
|
||||
|
||||
#define ATYPE_RO (ATYPE_Rpre | ATYPE_Rsafe | ATYPE_Rop)
|
||||
#define ATYPE_WO (ATYPE_Wpre | ATYPE_Wsafe | ATYPE_Wop)
|
||||
#define ATYPE_RW (ATYPE_RO | ATYPE_WO)
|
||||
#define ATYPE_RWpre (ATYPE_Wpre | ATYPE_RO)
|
||||
|
||||
#define TX_PDO_OBJIDX 0x1c13
|
||||
#define RX_PDO_OBJIDX 0x1c12
|
||||
|
||||
#define COMPLETE_ACCESS_FLAG (1 << 15)
|
||||
|
||||
void ESC_coeprocess (void);
|
||||
int16_t SDO_findsubindex (int16_t nidx, uint8_t subindex);
|
||||
int32_t SDO_findobject (uint16_t index);
|
||||
uint16_t sizeOfPDO (uint16_t index, int * nmappings, _SMmap * sm, int max_mappings);
|
||||
void SDO_abort (uint16_t index, uint8_t subindex, uint32_t abortcode);
|
||||
void COE_initDefaultValues (void);
|
||||
|
||||
void COE_pdoPack (uint8_t * buffer, int nmappings, _SMmap * sm);
|
||||
void COE_pdoUnpack (uint8_t * buffer, int nmappings, _SMmap * sm);
|
||||
uint8_t COE_maxSub (uint16_t index);
|
||||
|
||||
extern uint32_t ESC_download_post_objecthandler (uint16_t index, uint8_t subindex, uint16_t flags);
|
||||
extern uint32_t ESC_download_pre_objecthandler (uint16_t index,
|
||||
uint8_t subindex,
|
||||
void * data,
|
||||
size_t size,
|
||||
uint16_t flags);
|
||||
extern uint32_t ESC_upload_pre_objecthandler (uint16_t index,
|
||||
uint8_t subindex,
|
||||
void * data,
|
||||
size_t size,
|
||||
uint16_t flags);
|
||||
extern uint32_t ESC_upload_post_objecthandler (uint16_t index, uint8_t subindex, uint16_t flags);
|
||||
extern const _objectlist SDOobjects[];
|
||||
|
||||
#endif
|
||||
80
Pcb-1-lan9252/Firmware/lib/soes/esc_eep.c
Executable file
80
Pcb-1-lan9252/Firmware/lib/soes/esc_eep.c
Executable file
@@ -0,0 +1,80 @@
|
||||
/*
|
||||
* Licensed under the GNU General Public License version 2 with exceptions. See
|
||||
* LICENSE file in the project root for full license information
|
||||
*/
|
||||
|
||||
/** \file
|
||||
* \brief
|
||||
* ESI EEPROM emulator module.
|
||||
*/
|
||||
|
||||
#include "cc.h"
|
||||
#include "esc.h"
|
||||
#include "esc_eep.h"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
static uint8_t eep_buf[8];
|
||||
|
||||
/** EPP periodic task of ESC side EEPROM emulation.
|
||||
*
|
||||
*/
|
||||
void EEP_process (void)
|
||||
{
|
||||
eep_stat_t stat;
|
||||
|
||||
/* check for eeprom event */
|
||||
if ((ESCvar.ALevent & ESCREG_ALEVENT_EEP) == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
while (1) {
|
||||
/* read eeprom status */
|
||||
ESC_read (ESCREG_EECONTSTAT, &stat, sizeof (eep_stat_t));
|
||||
stat.contstat.reg = etohs(stat.contstat.reg);
|
||||
stat.addr = etohl(stat.addr);
|
||||
|
||||
/* check busy flag, exit if job finished */
|
||||
if (!stat.contstat.bits.busy) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* clear error bits */
|
||||
stat.contstat.bits.csumErr = 0;
|
||||
stat.contstat.bits.eeLoading = 0;
|
||||
stat.contstat.bits.ackErr = 0;
|
||||
stat.contstat.bits.wrErr = 0;
|
||||
|
||||
/* process commands */
|
||||
switch (stat.contstat.bits.cmdReg) {
|
||||
case EEP_CMD_IDLE:
|
||||
break;
|
||||
|
||||
case EEP_CMD_READ:
|
||||
case EEP_CMD_RELOAD:
|
||||
/* handle read request */
|
||||
if (EEP_read (stat.addr * sizeof(uint16_t), eep_buf, EEP_READ_SIZE) != 0) {
|
||||
stat.contstat.bits.ackErr = 1;
|
||||
} else {
|
||||
ESC_write (ESCREG_EEDATA, eep_buf, EEP_READ_SIZE);
|
||||
}
|
||||
break;
|
||||
|
||||
case EEP_CMD_WRITE:
|
||||
/* handle write request */
|
||||
ESC_read (ESCREG_EEDATA, eep_buf, EEP_WRITE_SIZE);
|
||||
if (EEP_write (stat.addr * sizeof(uint16_t), eep_buf, EEP_WRITE_SIZE) != 0) {
|
||||
stat.contstat.bits.ackErr = 1;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
stat.contstat.bits.ackErr = 1;
|
||||
}
|
||||
|
||||
/* acknowledge command */
|
||||
stat.contstat.reg = htoes(stat.contstat.reg);
|
||||
ESC_write (ESCREG_EECONTSTAT, &stat.contstat.reg, sizeof(uint16_t));
|
||||
}
|
||||
}
|
||||
|
||||
77
Pcb-1-lan9252/Firmware/lib/soes/esc_eep.h
Executable file
77
Pcb-1-lan9252/Firmware/lib/soes/esc_eep.h
Executable file
@@ -0,0 +1,77 @@
|
||||
/*
|
||||
* Licensed under the GNU General Public License version 2 with exceptions. See
|
||||
* LICENSE file in the project root for full license information
|
||||
*/
|
||||
|
||||
/** \file
|
||||
* \brief
|
||||
* Headerfile for esc_eep.c
|
||||
*/
|
||||
|
||||
#ifndef __esc_eep__
|
||||
#define __esc_eep__
|
||||
|
||||
#include <cc.h>
|
||||
#include "esc.h"
|
||||
|
||||
/* EEPROM commands */
|
||||
#define EEP_CMD_IDLE 0x0
|
||||
#define EEP_CMD_READ 0x1
|
||||
#define EEP_CMD_WRITE 0x2
|
||||
#define EEP_CMD_RELOAD 0x3
|
||||
|
||||
/* read/write size */
|
||||
#define EEP_READ_SIZE 8
|
||||
#define EEP_WRITE_SIZE 2
|
||||
|
||||
/* CONSTAT register content */
|
||||
typedef struct CC_PACKED
|
||||
{
|
||||
union {
|
||||
uint16_t reg;
|
||||
struct {
|
||||
uint8_t wrEnable:1;
|
||||
uint8_t reserved:4;
|
||||
uint8_t eeEmulated:1;
|
||||
uint8_t eightByteRead:1;
|
||||
uint8_t twoByteAddr:1;
|
||||
|
||||
uint8_t cmdReg:3;
|
||||
uint8_t csumErr:1;
|
||||
uint8_t eeLoading:1;
|
||||
uint8_t ackErr:1;
|
||||
uint8_t wrErr:1;
|
||||
uint8_t busy:1;
|
||||
} bits;
|
||||
} contstat;
|
||||
|
||||
uint32_t addr;
|
||||
} eep_stat_t;
|
||||
|
||||
/**
|
||||
* ECAT EEPROM configuration area data structure
|
||||
*/
|
||||
typedef union eep_config
|
||||
{
|
||||
struct
|
||||
{
|
||||
uint16_t pdi_control;
|
||||
uint16_t pdi_configuration;
|
||||
uint16_t sync_impulse_len;
|
||||
uint16_t pdi_configuration2;
|
||||
uint16_t configured_station_alias;
|
||||
uint8_t reserved[4];
|
||||
uint16_t checksum;
|
||||
};
|
||||
uint32_t dword[4]; /**< Four 32 bit double word equivalent to 8 16 bit configuration area word. */
|
||||
}eep_config_t;
|
||||
|
||||
/* periodic task */
|
||||
void EEP_process (void);
|
||||
|
||||
/* From hardware file */
|
||||
void EEP_init (void);
|
||||
int8_t EEP_read (uint32_t addr, uint8_t *data, uint16_t size);
|
||||
int8_t EEP_write (uint32_t addr, uint8_t *data, uint16_t size);
|
||||
|
||||
#endif
|
||||
1066
Pcb-1-lan9252/Firmware/lib/soes/esc_eoe.c
Executable file
1066
Pcb-1-lan9252/Firmware/lib/soes/esc_eoe.c
Executable file
File diff suppressed because it is too large
Load Diff
68
Pcb-1-lan9252/Firmware/lib/soes/esc_eoe.h
Executable file
68
Pcb-1-lan9252/Firmware/lib/soes/esc_eoe.h
Executable file
@@ -0,0 +1,68 @@
|
||||
/*
|
||||
* Licensed under the GNU General Public License version 2 with exceptions. See
|
||||
* LICENSE file in the project root for full license information
|
||||
*/
|
||||
|
||||
/** \file
|
||||
* \brief
|
||||
* Headerfile for esc_eoe.c
|
||||
*/
|
||||
|
||||
#ifndef __esc_eoe__
|
||||
#define __esc_eoe__
|
||||
|
||||
#include <cc.h>
|
||||
|
||||
typedef struct eoe_pbuf
|
||||
{
|
||||
/** Pointer to frame buffer type used by a TCP/IP stack. (Not mandatory) */
|
||||
void * pbuf;
|
||||
/** Pointer to frame buffer to send or read from */
|
||||
uint8_t * payload;
|
||||
/** Length of data in frame buffer */
|
||||
size_t len;
|
||||
} eoe_pbuf_t;
|
||||
|
||||
typedef struct eoe_cfg
|
||||
{
|
||||
/** Callback function to get a frame buffer for storage of received frame */
|
||||
void (*get_buffer) (eoe_pbuf_t * ebuf);
|
||||
/** Callback function to free a frame buffer */
|
||||
void (*free_buffer) (eoe_pbuf_t * ebuf);
|
||||
/** Callback function to read local settings and update EtherCAT variables
|
||||
* to be delivered to the EtherCAT Master
|
||||
*/
|
||||
int (*load_eth_settings) (void);
|
||||
/** Callback function to read settings provided by the EtherCAT master
|
||||
* and store to local settings.
|
||||
*/
|
||||
int (*store_ethernet_settings) (void);
|
||||
/** Callback to frame receive function in TCP(IP stack,
|
||||
* caller should free the buffer
|
||||
* */
|
||||
void (*handle_recv_buffer) (uint8_t port, eoe_pbuf_t * ebuf);
|
||||
/** Callback to fetch a buffer to send */
|
||||
int (*fetch_send_buffer) (uint8_t port, eoe_pbuf_t * ebuf);
|
||||
/** Callback to notify the application fragment sent */
|
||||
void (*fragment_sent_event) (void);
|
||||
} eoe_cfg_t;
|
||||
|
||||
int EOE_ecat_get_mac (uint8_t port, uint8_t mac[]);
|
||||
int EOE_ecat_get_ip (uint8_t port, uint32_t * ip);
|
||||
int EOE_ecat_get_subnet (uint8_t port, uint32_t * subnet);
|
||||
int EOE_ecat_get_gateway (uint8_t port, uint32_t * default_gateway);
|
||||
int EOE_ecat_get_dns_ip (uint8_t port, uint32_t * dns_ip);
|
||||
int EOE_ecat_get_dns_name (uint8_t port, char * dns_name);
|
||||
int EOE_ecat_set_mac (uint8_t port, uint8_t mac[]);
|
||||
int EOE_ecat_set_ip (uint8_t port, uint32_t ip);
|
||||
int EOE_ecat_set_subnet (uint8_t port, uint32_t subnet);
|
||||
int EOE_ecat_set_gateway (uint8_t port, uint32_t default_gateway);
|
||||
int EOE_ecat_set_dns_ip (uint8_t port, uint32_t dns_ip);
|
||||
int EOE_ecat_set_dns_name (uint8_t port, char * dns_name);
|
||||
|
||||
void EOE_config (eoe_cfg_t * cfg);
|
||||
void EOE_init (void);
|
||||
void ESC_eoeprocess (void);
|
||||
void ESC_eoeprocess_tx (void);
|
||||
|
||||
#endif
|
||||
627
Pcb-1-lan9252/Firmware/lib/soes/esc_foe.c
Executable file
627
Pcb-1-lan9252/Firmware/lib/soes/esc_foe.c
Executable file
@@ -0,0 +1,627 @@
|
||||
/*
|
||||
* Licensed under the GNU General Public License version 2 with exceptions. See
|
||||
* LICENSE file in the project root for full license information
|
||||
*/
|
||||
|
||||
/** \file
|
||||
* \brief
|
||||
* File over EtherCAT (FoE) module.
|
||||
*/
|
||||
|
||||
|
||||
#include <cc.h>
|
||||
#include "esc.h"
|
||||
#include "esc_foe.h"
|
||||
#include <string.h>
|
||||
|
||||
/** \file
|
||||
* \brief
|
||||
* File over EtherCAT (FoE) module.
|
||||
*
|
||||
* FOE read / write and FOE service functions
|
||||
*/
|
||||
|
||||
//define if FOE_read should be supported
|
||||
//#define FOE_READ_SUPPORTED
|
||||
|
||||
/** Variable holding current filename read at FOE Open.
|
||||
*/
|
||||
static char foe_file_name[FOE_FN_MAX + 1];
|
||||
|
||||
|
||||
/** Main FoE configuration pointer data array. Structure is allocated and filled
|
||||
* by the application defining what preferences it requires.
|
||||
*/
|
||||
static foe_cfg_t * foe_cfg;
|
||||
/** Pointer to current file configuration item used by FoE.
|
||||
*/
|
||||
static foe_file_cfg_t * foe_file;
|
||||
/** Main FoE status data array. Structure gets filled with current status
|
||||
* variables during FoE usage.
|
||||
*/
|
||||
static _FOEvar FOEvar;
|
||||
|
||||
/** Validate a write or read request by checking filename and password.
|
||||
*
|
||||
* @param[in] name = Filename
|
||||
* @param[in] num_chars = Length of filename
|
||||
* @param[in] pass = Numeric variable of password
|
||||
* @param[in] op = Request op-code
|
||||
* @return 0= if we succeed, FOE_ERR_NOTFOUND something wrong with filename or
|
||||
* password
|
||||
*/
|
||||
static int FOE_fopen (char *name, uint8_t num_chars, uint32_t pass, uint8_t op)
|
||||
{
|
||||
uint32_t i;
|
||||
|
||||
/* Unpack the file name into characters we can look at. */
|
||||
if (num_chars > FOE_FN_MAX)
|
||||
{
|
||||
num_chars = FOE_FN_MAX;
|
||||
}
|
||||
|
||||
for (i = 0; i < num_chars; i++)
|
||||
{
|
||||
foe_file_name[i] = name[i];
|
||||
}
|
||||
foe_file_name[i] = '\0';
|
||||
|
||||
/* Figure out what file they're talking about. */
|
||||
for (i = 0; i < foe_cfg->n_files; i++)
|
||||
{
|
||||
if (0 == strncmp (foe_file_name, foe_cfg->files[i].name, num_chars))
|
||||
{
|
||||
if (pass != foe_cfg->files[i].filepass)
|
||||
{
|
||||
return FOE_ERR_NORIGHTS;
|
||||
}
|
||||
|
||||
if (op == FOE_OP_WRQ &&
|
||||
(foe_cfg->files[i].write_only_in_boot) &&
|
||||
(ESCvar.ALstatus != ESCboot))
|
||||
{
|
||||
return FOE_ERR_NOTINBOOTSTRAP;
|
||||
}
|
||||
|
||||
foe_file = &foe_cfg->files[i];
|
||||
foe_file->address_offset = 0;
|
||||
foe_file->total_size = 0;
|
||||
switch (op)
|
||||
{
|
||||
case FOE_OP_RRQ:
|
||||
{
|
||||
FOEvar.fposition = 0;
|
||||
FOEvar.fend = foe_cfg->files[i].max_data;
|
||||
return 0;
|
||||
}
|
||||
case FOE_OP_WRQ:
|
||||
{
|
||||
FOEvar.fposition = 0;
|
||||
FOEvar.fend = foe_cfg->files[i].max_data;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return FOE_ERR_NOTFOUND;
|
||||
}
|
||||
|
||||
#ifdef FOE_READ_SUPPORTED
|
||||
/** Function writing local data to mailbox buffer to be sent as next FoE frame.
|
||||
* It will try to fill the Mailbox buffer available if there is enough data
|
||||
* left to read.
|
||||
*
|
||||
* @param[in] data = pointer to buffer
|
||||
* @param[in] maxlength = max length of data possible to read, controlled by
|
||||
* Mailbox - FoE and Mailbox frame headers.
|
||||
|
||||
* @return Number of copied bytes.
|
||||
*/
|
||||
static uint16_t FOE_fread (uint8_t * data, uint16_t maxlength)
|
||||
{
|
||||
uint16_t ncopied = 0;
|
||||
|
||||
while (maxlength && (FOEvar.fend - FOEvar.fposition))
|
||||
{
|
||||
maxlength--;
|
||||
*(data++) = foe_cfg->fbuffer[FOEvar.fposition++];
|
||||
ncopied++;
|
||||
}
|
||||
|
||||
return ncopied;
|
||||
}
|
||||
#endif
|
||||
|
||||
/** Function reading mailbox buffer to local buffer to be handled by
|
||||
* application write hook. Ex. flash routine used by software update.
|
||||
* It will consume the buffer and call the write hook every time the configured
|
||||
* flush buffer limit is reached.
|
||||
*
|
||||
*
|
||||
* @param[in] data = Pointer to buffer
|
||||
* @param[in] length = Length of data to read
|
||||
|
||||
* @return Number of copied bytes.
|
||||
*/
|
||||
static uint16_t FOE_fwrite (uint8_t *data, uint16_t length)
|
||||
{
|
||||
uint16_t ncopied = 0;
|
||||
uint32_t failed = 0;
|
||||
|
||||
DPRINT("FOE_fwrite\n");
|
||||
FOEvar.fprevposition = FOEvar.fposition;
|
||||
while (length && (FOEvar.fend - FOEvar.fposition) && !failed)
|
||||
{
|
||||
length--;
|
||||
foe_cfg->fbuffer[FOEvar.fbufposition++] = *(data++);
|
||||
if(FOEvar.fbufposition >= foe_cfg->buffer_size)
|
||||
{
|
||||
failed = foe_file->write_function (foe_file, foe_cfg->fbuffer, FOEvar.fbufposition);
|
||||
FOEvar.fbufposition = 0;
|
||||
foe_file->address_offset += foe_cfg->buffer_size;
|
||||
}
|
||||
FOEvar.fposition++;
|
||||
ncopied++;
|
||||
}
|
||||
|
||||
foe_file->total_size += ncopied;
|
||||
|
||||
DPRINT("FOE_fwrite END with : %d\n",ncopied);
|
||||
return ncopied;
|
||||
}
|
||||
|
||||
|
||||
/** Function handling the final FOE_fwrite when we close up regardless
|
||||
* if we have filled the buffers or not.
|
||||
*
|
||||
* @return Number of copied bytes on success, 0= if failed.
|
||||
*/
|
||||
static uint32_t FOE_fclose (void)
|
||||
{
|
||||
uint32_t failed = 0;
|
||||
|
||||
DPRINT("FOE_fclose\n");
|
||||
|
||||
failed = foe_file->write_function (foe_file, foe_cfg->fbuffer, FOEvar.fbufposition);
|
||||
foe_file->address_offset += FOEvar.fbufposition;
|
||||
FOEvar.fbufposition = 0;
|
||||
|
||||
return failed;
|
||||
}
|
||||
|
||||
/** Initialize by clearing all current status variables.
|
||||
*
|
||||
*/
|
||||
void FOE_init ()
|
||||
{
|
||||
DPRINT("FOE_init\n");
|
||||
FOEvar.foepacket = 0;
|
||||
FOEvar.foestate = FOE_READY;
|
||||
FOEvar.fposition = 0;
|
||||
FOEvar.fprevposition = 0;
|
||||
FOEvar.fbufposition = 0;
|
||||
}
|
||||
|
||||
/** Function for sending an FOE abort frame.
|
||||
*
|
||||
* @param[in] code = abort code
|
||||
*/
|
||||
static void FOE_abort (uint32_t code)
|
||||
{
|
||||
_FOE *foembx;
|
||||
uint8_t mbxhandle;
|
||||
|
||||
if (code)
|
||||
{
|
||||
/* Send back an error packet. */
|
||||
mbxhandle = ESC_claimbuffer ();
|
||||
if (mbxhandle)
|
||||
{
|
||||
foembx = (_FOE *) &MBX[mbxhandle * ESC_MBXSIZE];
|
||||
foembx->mbxheader.length = htoes (ESC_FOEHSIZE); /* Don't bother with error text for now. */
|
||||
foembx->mbxheader.mbxtype = MBXFOE;
|
||||
foembx->foeheader.opcode = FOE_OP_ERR;
|
||||
foembx->foeheader.errorcode = htoel (code);
|
||||
MBXcontrol[mbxhandle].state = MBXstate_outreq;
|
||||
}
|
||||
/* Nothing we can do if we can't get an outbound mailbox. */
|
||||
}
|
||||
DPRINT("FOE_abort: 0x%X\n", code);
|
||||
FOE_init ();
|
||||
}
|
||||
|
||||
#ifdef FOE_READ_SUPPORTED
|
||||
/** Sends an FoE data frame, returning the number of data bytes
|
||||
* written or an error number.
|
||||
* Error numbers will be greater than FOE_DATA_SIZE.
|
||||
|
||||
* @param[in] data = pointer to buffer
|
||||
* @param[in] length = length of data to read
|
||||
|
||||
* @return Number of data bytes written or an error number. Error numbers
|
||||
* will be greater than FOE_DATA_SIZE.
|
||||
*/
|
||||
static int FOE_send_data_packet ()
|
||||
{
|
||||
_FOE *foembx;
|
||||
uint16_t data_len;
|
||||
uint8_t mbxhandle;
|
||||
|
||||
mbxhandle = ESC_claimbuffer ();
|
||||
if (mbxhandle)
|
||||
{
|
||||
foembx = (_FOE *) &MBX[mbxhandle * ESC_MBXSIZE];
|
||||
data_len = FOE_fread (foembx->data, ESC_FOE_DATA_SIZE);
|
||||
foembx->foeheader.opcode = FOE_OP_DATA;
|
||||
foembx->foeheader.packetnumber = htoel (FOEvar.foepacket);
|
||||
FOEvar.foepacket++;
|
||||
foembx->mbxheader.length = htoes (data_len + ESC_FOEHSIZE);
|
||||
foembx->mbxheader.mbxtype = MBXFOE;
|
||||
/* Mark the outbound mailbox as filled. */
|
||||
MBXcontrol[mbxhandle].state = MBXstate_outreq;
|
||||
return data_len;
|
||||
}
|
||||
else
|
||||
{
|
||||
return FOE_ERR_PROGERROR;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/** Sends an FoE ack data frame.
|
||||
|
||||
* @return 0= or error number.
|
||||
*/
|
||||
static int FOE_send_ack ()
|
||||
{
|
||||
_FOE *foembx;
|
||||
uint8_t mbxhandle;
|
||||
|
||||
mbxhandle = ESC_claimbuffer ();
|
||||
if (mbxhandle)
|
||||
{
|
||||
DPRINT("FOE_send_ack\n");
|
||||
foembx = (_FOE *) &MBX[mbxhandle * ESC_MBXSIZE];
|
||||
foembx->mbxheader.length = htoes (ESC_FOEHSIZE);
|
||||
foembx->mbxheader.mbxtype = MBXFOE;
|
||||
foembx->foeheader.opcode = FOE_OP_ACK;
|
||||
foembx->foeheader.packetnumber = htoel (FOEvar.foepacket);
|
||||
FOEvar.foepacket++;
|
||||
MBXcontrol[mbxhandle].state = MBXstate_outreq;
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
DPRINT("ERROR:FOE_send_ack\n");
|
||||
return FOE_ERR_PROGERROR;
|
||||
}
|
||||
}
|
||||
|
||||
/* Handlers for various FoE states. */
|
||||
|
||||
#ifdef FOE_READ_SUPPORTED
|
||||
/** FoE read request handler. Starts with Initialize, Open and Sending one frame.
|
||||
* When first frame have been sent we will send data from Ack.
|
||||
* On error we will send FOE Abort.
|
||||
*
|
||||
*/
|
||||
static void FOE_read ()
|
||||
{
|
||||
_FOE *foembx;
|
||||
uint32_t data_len;
|
||||
uint32_t password;
|
||||
int res;
|
||||
|
||||
if (FOEvar.foestate != FOE_READY)
|
||||
{
|
||||
FOE_abort (FOE_ERR_ILLEGAL);
|
||||
return;
|
||||
}
|
||||
|
||||
FOE_init ();
|
||||
foembx = (_FOE *) &MBX[0];
|
||||
/* Get the length of the file name in octets. */
|
||||
data_len = etohs (foembx->mbxheader.length) - ESC_FOEHSIZE;
|
||||
password = etohl (foembx->foeheader.password);
|
||||
|
||||
res = FOE_fopen (foembx->filename, data_len, password, FOE_OP_RRQ);
|
||||
if (res == 0)
|
||||
{
|
||||
FOEvar.foepacket = 1;
|
||||
/*
|
||||
* Attempt to send the packet
|
||||
*/
|
||||
res = FOE_send_data_packet ();
|
||||
if (res <= (int)ESC_FOE_DATA_SIZE)
|
||||
{
|
||||
FOEvar.foestate = FOE_WAIT_FOR_ACK;
|
||||
}
|
||||
else
|
||||
{
|
||||
FOE_abort (res);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
FOE_abort (res);
|
||||
}
|
||||
}
|
||||
|
||||
/** FoE data ack handler. Will continue sending next frame until finished.
|
||||
* On error we will send FOE Abort.
|
||||
*/
|
||||
static void FOE_ack ()
|
||||
{
|
||||
int res;
|
||||
|
||||
/* Make sure we're able to take this. */
|
||||
if (FOEvar.foestate == FOE_WAIT_FOR_FINAL_ACK)
|
||||
{
|
||||
/* Move us back to ready state. */
|
||||
FOE_init ();
|
||||
return;
|
||||
}
|
||||
else if (FOEvar.foestate != FOE_WAIT_FOR_ACK)
|
||||
{
|
||||
FOE_abort (FOE_ERR_ILLEGAL);
|
||||
return;
|
||||
}
|
||||
res = FOE_send_data_packet ();
|
||||
if (res < (int)ESC_FOE_DATA_SIZE)
|
||||
{
|
||||
FOEvar.foestate = FOE_WAIT_FOR_FINAL_ACK;
|
||||
}
|
||||
else if (res >= FOE_ERR_NOTDEFINED)
|
||||
{
|
||||
FOE_abort (FOE_ERR_PROGERROR);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/** FoE write request handler. Starts with Initialize, Open and Ack that we can/will
|
||||
* receive data. On error we will send FOE Abort.
|
||||
*
|
||||
*/
|
||||
static void FOE_write ()
|
||||
{
|
||||
_FOE *foembx;
|
||||
uint32_t data_len;
|
||||
uint32_t password;
|
||||
int res;
|
||||
|
||||
if (FOEvar.foestate != FOE_READY)
|
||||
{
|
||||
FOE_abort (FOE_ERR_ILLEGAL);
|
||||
return;
|
||||
}
|
||||
|
||||
FOE_init ();
|
||||
foembx = (_FOE *) &MBX[0];
|
||||
data_len = etohs (foembx->mbxheader.length) - ESC_FOEHSIZE;
|
||||
password = etohl (foembx->foeheader.password);
|
||||
|
||||
/* Get an address we can write the file to, if possible. */
|
||||
res = FOE_fopen (foembx->filename, data_len, password, FOE_OP_WRQ);
|
||||
DPRINT("%s %sOK, file \"%s\"\n", __func__, (res == 0) ? "" : "N", foe_file_name);
|
||||
if (res == 0)
|
||||
{
|
||||
res = FOE_send_ack ();
|
||||
if (res)
|
||||
{
|
||||
FOE_abort (res);
|
||||
}
|
||||
else
|
||||
{
|
||||
FOEvar.foestate = FOE_WAIT_FOR_DATA;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
FOE_abort (res);
|
||||
}
|
||||
}
|
||||
/** FoE data request handler. Validates and reads data until we're finished. Every
|
||||
* read frame followed by an Ack frame. On error we will send FOE Abort.
|
||||
*
|
||||
*/
|
||||
static void FOE_data ()
|
||||
{
|
||||
_FOE *foembx;
|
||||
uint32_t packet;
|
||||
uint16_t data_len, ncopied;
|
||||
int res;
|
||||
|
||||
if(FOEvar.foestate != FOE_WAIT_FOR_DATA)
|
||||
{
|
||||
FOE_abort(FOE_ERR_ILLEGAL);
|
||||
return;
|
||||
}
|
||||
|
||||
foembx = (_FOE*)&MBX[0];
|
||||
data_len = etohs(foembx->mbxheader.length) - ESC_FOEHSIZE;
|
||||
packet = etohl(foembx->foeheader.packetnumber);
|
||||
|
||||
if (packet != FOEvar.foepacket)
|
||||
{
|
||||
DPRINT("FOE_data packet error, packet: %d, foeheader.packet: %d\n",packet,FOEvar.foepacket);
|
||||
FOE_abort (FOE_ERR_PACKETNO);
|
||||
}
|
||||
else if (data_len == 0)
|
||||
{
|
||||
DPRINT("FOE_data completed\n");
|
||||
FOE_fclose ();
|
||||
res = FOE_send_ack ();
|
||||
FOE_init ();
|
||||
}
|
||||
else if (FOEvar.fposition + data_len > FOEvar.fend)
|
||||
{
|
||||
DPRINT("FOE_data disk full\n");
|
||||
FOE_abort (FOE_ERR_DISKFULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
ncopied = FOE_fwrite (foembx->data, data_len);
|
||||
if (!ncopied)
|
||||
{
|
||||
DPRINT("FOE_data no copied\n");
|
||||
FOE_abort (FOE_ERR_PROGERROR);
|
||||
}
|
||||
else if (data_len == ESC_FOE_DATA_SIZE)
|
||||
{
|
||||
DPRINT("FOE_data data_len == FOE_DATA_SIZE\n");
|
||||
if (ncopied != data_len)
|
||||
{
|
||||
DPRINT("FOE_data only %d of %d copied\n",ncopied, data_len);
|
||||
FOE_abort (FOE_ERR_PROGERROR);
|
||||
}
|
||||
res = FOE_send_ack ();
|
||||
if (res)
|
||||
{
|
||||
FOE_abort (res);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((ncopied != data_len) || FOE_fclose ())
|
||||
{
|
||||
DPRINT("FOE_fclose failed to write extra buffer\n");
|
||||
FOE_abort (FOE_ERR_PROGERROR);
|
||||
}
|
||||
else
|
||||
{
|
||||
DPRINT("FOE_data completed\n");
|
||||
res = FOE_send_ack ();
|
||||
FOE_init ();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef FOE_READ_SUPPORTED
|
||||
/** FoE read request busy handler. Send an Ack of last frame again. On error
|
||||
* we will send FOE Abort.
|
||||
*
|
||||
*/
|
||||
static void FOE_busy ()
|
||||
{
|
||||
/* Only valid if we're servicing a read request. */
|
||||
if (FOEvar.foestate != FOE_WAIT_FOR_ACK)
|
||||
{
|
||||
FOE_abort (FOE_ERR_ILLEGAL);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Send the last part again. */
|
||||
FOEvar.fposition = FOEvar.fprevposition;
|
||||
FOEvar.foepacket--;
|
||||
FOE_ack ();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/** FoE error requesthandler. Send an FOE Abort.
|
||||
*
|
||||
*/
|
||||
static void FOE_error ()
|
||||
{
|
||||
/* Master panic! abort the transfer. */
|
||||
FOE_abort (0);
|
||||
}
|
||||
|
||||
/** Function copying the application configuration variable
|
||||
* to the FoE module local pointer variable.
|
||||
*
|
||||
* @param[in] cfg = Pointer to by the Application static declared
|
||||
* configuration variable holding application specific details.
|
||||
*/
|
||||
void FOE_config (foe_cfg_t * cfg)
|
||||
{
|
||||
foe_cfg = cfg;
|
||||
}
|
||||
|
||||
/** Main FoE function checking the status on current mailbox buffers carrying
|
||||
* data, distributing the mailboxes to appropriate FOE functions depending
|
||||
* on requested opcode.
|
||||
* On Error an FoE Error or FoE Abort will be sent.
|
||||
*/
|
||||
void ESC_foeprocess (void)
|
||||
{
|
||||
_MBXh *mbh;
|
||||
_FOE *foembx;
|
||||
|
||||
if (ESCvar.MBXrun == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (!ESCvar.xoe && (MBXcontrol[0].state == MBXstate_inclaim))
|
||||
{
|
||||
mbh = (_MBXh *) &MBX[0];
|
||||
if (mbh->mbxtype == MBXFOE)
|
||||
{
|
||||
ESCvar.xoe = MBXFOE;
|
||||
}
|
||||
}
|
||||
if (ESCvar.xoe == MBXFOE)
|
||||
{
|
||||
foembx = (_FOE *) &MBX[0];
|
||||
/* Verify the size of the file data. */
|
||||
if (etohs (foembx->mbxheader.length) < ESC_FOEHSIZE)
|
||||
{
|
||||
FOE_abort (MBXERR_SIZETOOSHORT);
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (foembx->foeheader.opcode)
|
||||
{
|
||||
case FOE_OP_WRQ:
|
||||
{
|
||||
DPRINT("FOE_OP_WRQ\n");
|
||||
FOE_write ();
|
||||
break;
|
||||
}
|
||||
case FOE_OP_DATA:
|
||||
{
|
||||
DPRINT("FOE_OP_DATA\n");
|
||||
FOE_data ();
|
||||
break;
|
||||
}
|
||||
#ifdef FOE_READ_SUPPORTED
|
||||
case FOE_OP_RRQ:
|
||||
{
|
||||
DPRINT("FOE_OP_RRQ\n");
|
||||
FOE_read ();
|
||||
break;
|
||||
}
|
||||
case FOE_OP_ACK:
|
||||
{
|
||||
DPRINT("FOE_OP_ACK\n");
|
||||
FOE_ack ();
|
||||
break;
|
||||
}
|
||||
|
||||
case FOE_OP_BUSY:
|
||||
{
|
||||
DPRINT("FOE_OP_BUSY\n");
|
||||
FOE_busy ();
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
case FOE_OP_ERR:
|
||||
{
|
||||
DPRINT("FOE_OP_ERR\n");
|
||||
FOE_error ();
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
DPRINT("FOE_ERR_NOTDEFINED\n");
|
||||
FOE_abort (FOE_ERR_NOTDEFINED);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
MBXcontrol[0].state = MBXstate_idle;
|
||||
ESCvar.xoe = 0;
|
||||
}
|
||||
}
|
||||
77
Pcb-1-lan9252/Firmware/lib/soes/esc_foe.h
Executable file
77
Pcb-1-lan9252/Firmware/lib/soes/esc_foe.h
Executable file
@@ -0,0 +1,77 @@
|
||||
/*
|
||||
* Licensed under the GNU General Public License version 2 with exceptions. See
|
||||
* LICENSE file in the project root for full license information
|
||||
*/
|
||||
|
||||
/** \file
|
||||
* \brief
|
||||
* Headerfile for esc_foe.c
|
||||
*/
|
||||
|
||||
#ifndef __esc_foe__
|
||||
#define __esc_foe__
|
||||
|
||||
#include <cc.h>
|
||||
|
||||
/** Maximum number of characters allowed in a file name. */
|
||||
#define FOE_FN_MAX 31
|
||||
|
||||
typedef struct foe_file_cfg foe_file_cfg_t;
|
||||
struct foe_file_cfg
|
||||
{
|
||||
/** Name of file to receive from master */
|
||||
const char * name;
|
||||
/** Size of file,sizeof data we can recv */
|
||||
uint32_t max_data;
|
||||
/** Where to store the data initially */
|
||||
uint32_t dest_start_address;
|
||||
/** Current address during write of file */
|
||||
uint32_t address_offset;
|
||||
/** Calculated size of file received */
|
||||
uint32_t total_size;
|
||||
/** FoE password */
|
||||
uint32_t filepass;
|
||||
/** This file can be written only in BOOT state. Intended for FW files */
|
||||
uint8_t write_only_in_boot;
|
||||
/** for feature use */
|
||||
uint32_t padding:24;
|
||||
/** Pointer to application foe write function */
|
||||
uint32_t (*write_function) (foe_file_cfg_t * self, uint8_t * data, size_t length);
|
||||
};
|
||||
|
||||
typedef struct foe_cfg
|
||||
{
|
||||
/** Allocate static in caller func to fit buffer_size */
|
||||
uint8_t * fbuffer;
|
||||
/** Buffer size before we flush to destination */
|
||||
uint32_t buffer_size;
|
||||
/** Number of files used in firmware update */
|
||||
uint32_t n_files;
|
||||
/** Pointer to files configured to be used by FoE */
|
||||
foe_file_cfg_t * files;
|
||||
} foe_cfg_t;
|
||||
|
||||
typedef struct CC_PACKED
|
||||
{
|
||||
/** Current FoE state, ex. Waiting for ACK, Waiting for DATA */
|
||||
uint8_t foestate;
|
||||
/** Current file buffer position, evaluated against foe file buffer size
|
||||
* when to flush
|
||||
*/
|
||||
uint16_t fbufposition;
|
||||
/** Frame number in read or write sequence */
|
||||
uint32_t foepacket;
|
||||
/** Current position in file to be handled by FoE request */
|
||||
uint32_t fposition;
|
||||
/** Previous position in file to be handled by FoE request */
|
||||
uint32_t fprevposition;
|
||||
/** End position of allocated disk space for FoE requested file */
|
||||
uint32_t fend;
|
||||
} _FOEvar;
|
||||
|
||||
/* Initializes FoE state. */
|
||||
void FOE_config (foe_cfg_t * cfg);
|
||||
void FOE_init (void);
|
||||
void ESC_foeprocess (void);
|
||||
|
||||
#endif
|
||||
164
Pcb-1-lan9252/Firmware/lib/soes/esi.json
Executable file
164
Pcb-1-lan9252/Firmware/lib/soes/esi.json
Executable file
@@ -0,0 +1,164 @@
|
||||
{
|
||||
"form": {
|
||||
"VendorName": "MetalMusings",
|
||||
"VendorID": "0xaaa",
|
||||
"ProductCode": "0xbbbccc",
|
||||
"ProfileNo": "5001",
|
||||
"RevisionNumber": "0x002",
|
||||
"SerialNumber": "0x001",
|
||||
"HWversion": "0.0.1",
|
||||
"SWversion": "0.0.1",
|
||||
"EEPROMsize": "2048",
|
||||
"RxMailboxOffset": "0x1000",
|
||||
"TxMailboxOffset": "0x1200",
|
||||
"MailboxSize": "512",
|
||||
"SM2Offset": "0x1600",
|
||||
"SM3Offset": "0x1A00",
|
||||
"TextGroupType": "MachineControl",
|
||||
"TextGroupName5": "Incremental encoder",
|
||||
"ImageName": "IMGCBY",
|
||||
"TextDeviceType": "EaserCAT2000",
|
||||
"TextDeviceName": "MetalMusings EaserCAT 2000",
|
||||
"Port0Physical": "Y",
|
||||
"Port1Physical": "Y",
|
||||
"Port2Physical": " ",
|
||||
"Port3Physical": " ",
|
||||
"ESC": "LAN9252",
|
||||
"SPImode": "3",
|
||||
"CoeDetailsEnableSDO": "EnableSDO",
|
||||
"CoeDetailsEnableSDOInfo": "EnableSDOInfo",
|
||||
"CoeDetailsEnablePDOAssign": "EnablePDOAssign",
|
||||
"CoeDetailsEnablePDOConfiguration": "EnablePDOConfiguration",
|
||||
"CoeDetailsEnableUploadAtStartup": "EnableUploadAtStartup",
|
||||
"CoeDetailsEnableSDOCompleteAccess": "EnableSDOCompleteAccess"
|
||||
},
|
||||
"od": {
|
||||
"sdo": {
|
||||
"A": {
|
||||
"otype": "RECORD",
|
||||
"name": "Error Settings",
|
||||
"access": "RO",
|
||||
"items": [
|
||||
{
|
||||
"name": "Max SubIndex"
|
||||
},
|
||||
{
|
||||
"name": "New record subitem",
|
||||
"dtype": "UNSIGNED8"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"txpdo": {
|
||||
"6000": {
|
||||
"otype": "VAR",
|
||||
"name": "EncPos",
|
||||
"access": "RO",
|
||||
"pdo_mappings": [
|
||||
"txpdo"
|
||||
],
|
||||
"dtype": "REAL32",
|
||||
"value": "0",
|
||||
"data": "&Obj.EncPos"
|
||||
},
|
||||
"6001": {
|
||||
"otype": "VAR",
|
||||
"name": "EncFrequency",
|
||||
"access": "RO",
|
||||
"pdo_mappings": [
|
||||
"txpdo"
|
||||
],
|
||||
"dtype": "REAL32",
|
||||
"value": "0",
|
||||
"data": "&Obj.EncFrequency"
|
||||
},
|
||||
"6002": {
|
||||
"otype": "VAR",
|
||||
"name": "DiffT",
|
||||
"access": "RO",
|
||||
"pdo_mappings": [
|
||||
"txpdo"
|
||||
],
|
||||
"dtype": "UNSIGNED32",
|
||||
"value": "0",
|
||||
"data": "&Obj.DiffT"
|
||||
},
|
||||
"6003": {
|
||||
"otype": "VAR",
|
||||
"name": "IndexByte",
|
||||
"access": "RO",
|
||||
"pdo_mappings": [
|
||||
"txpdo"
|
||||
],
|
||||
"dtype": "UNSIGNED32",
|
||||
"value": "0",
|
||||
"data": "&Obj.IndexByte"
|
||||
},
|
||||
"6004": {
|
||||
"otype": "VAR",
|
||||
"name": "IndexStatus",
|
||||
"access": "RO",
|
||||
"pdo_mappings": [
|
||||
"txpdo"
|
||||
],
|
||||
"dtype": "UNSIGNED32",
|
||||
"value": "0",
|
||||
"data": "&Obj.IndexStatus"
|
||||
}
|
||||
},
|
||||
"rxpdo": {
|
||||
"7000": {
|
||||
"otype": "VAR",
|
||||
"name": "EncPosScale",
|
||||
"access": "RO",
|
||||
"pdo_mappings": [
|
||||
"rxpdo"
|
||||
],
|
||||
"dtype": "INTEGER32",
|
||||
"value": "0",
|
||||
"data": "&Obj.EncPosScale"
|
||||
},
|
||||
"7001": {
|
||||
"otype": "VAR",
|
||||
"name": "IndexLatchEnable",
|
||||
"access": "RO",
|
||||
"pdo_mappings": [
|
||||
"rxpdo"
|
||||
],
|
||||
"dtype": "UNSIGNED32",
|
||||
"value": "0",
|
||||
"data": "&Obj.IndexLatchEnable"
|
||||
},
|
||||
"60664": {
|
||||
"otype": "VAR",
|
||||
"name": "ActualPosition",
|
||||
"access": "RO",
|
||||
"pdo_mappings": [
|
||||
"rxpdo"
|
||||
],
|
||||
"dtype": "INTEGER32",
|
||||
"value": "0"
|
||||
}
|
||||
}
|
||||
},
|
||||
"dc": [
|
||||
{
|
||||
"Name": "SM-Synchron",
|
||||
"Description": "SM-Synchron",
|
||||
"AssignActivate": "#x000",
|
||||
"Sync0cycleTime": "0",
|
||||
"Sync0shiftTime": "0",
|
||||
"Sync1cycleTime": "0",
|
||||
"Sync1shiftTime": "0"
|
||||
},
|
||||
{
|
||||
"Name": "DC",
|
||||
"Description": "DC-Synchron",
|
||||
"AssignActivate": "#x300",
|
||||
"Sync0cycleTime": "0",
|
||||
"Sync0shiftTime": "0",
|
||||
"Sync1cycleTime": "0",
|
||||
"Sync1shiftTime": "0"
|
||||
}
|
||||
]
|
||||
}
|
||||
458
Pcb-1-lan9252/Firmware/lib/soes/hal/arduino-lan9252/esc_hw.c
Executable file
458
Pcb-1-lan9252/Firmware/lib/soes/hal/arduino-lan9252/esc_hw.c
Executable file
@@ -0,0 +1,458 @@
|
||||
/*
|
||||
* Licensed under the GNU General Public License version 2 with exceptions. See
|
||||
* LICENSE file in the project root for full license information
|
||||
*/
|
||||
|
||||
/** \file
|
||||
* \brief
|
||||
* ESC hardware layer functions for LAN9252.
|
||||
*
|
||||
* Function to read and write commands to the ESC. Used to read/write ESC
|
||||
* registers and memory.
|
||||
*/
|
||||
#include "esc.h"
|
||||
#include "spi.h"
|
||||
#include <string.h>
|
||||
|
||||
|
||||
#define O_RDWR 1
|
||||
|
||||
#define BIT(x) 1 << (x)
|
||||
|
||||
#define ESC_CMD_SERIAL_WRITE 0x02
|
||||
#define ESC_CMD_SERIAL_READ 0x03
|
||||
#define ESC_CMD_FAST_READ 0x0B
|
||||
#define ESC_CMD_RESET_SQI 0xFF
|
||||
|
||||
#define ESC_CMD_FAST_READ_DUMMY 1
|
||||
#define ESC_CMD_ADDR_INC BIT(6)
|
||||
|
||||
#define ESC_PRAM_RD_FIFO_REG 0x000
|
||||
#define ESC_PRAM_WR_FIFO_REG 0x020
|
||||
#define ESC_PRAM_RD_ADDR_LEN_REG 0x308
|
||||
#define ESC_PRAM_RD_CMD_REG 0x30C
|
||||
#define ESC_PRAM_WR_ADDR_LEN_REG 0x310
|
||||
#define ESC_PRAM_WR_CMD_REG 0x314
|
||||
|
||||
#define ESC_PRAM_CMD_BUSY BIT(31)
|
||||
#define ESC_PRAM_CMD_ABORT BIT(30)
|
||||
|
||||
#define ESC_PRAM_CMD_CNT(x) ((x >> 8) & 0x1F)
|
||||
#define ESC_PRAM_CMD_AVAIL BIT(0)
|
||||
|
||||
#define ESC_PRAM_SIZE(x) ((x) << 16)
|
||||
#define ESC_PRAM_ADDR(x) ((x) << 0)
|
||||
|
||||
#define ESC_CSR_DATA_REG 0x300
|
||||
#define ESC_CSR_CMD_REG 0x304
|
||||
|
||||
#define ESC_CSR_CMD_BUSY BIT(31)
|
||||
#define ESC_CSR_CMD_READ (BIT(31) | BIT(30))
|
||||
#define ESC_CSR_CMD_WRITE BIT(31)
|
||||
#define ESC_CSR_CMD_SIZE(x) (x << 16)
|
||||
|
||||
#define ESC_RESET_CTRL_REG 0x1F8
|
||||
#define ESC_RESET_CTRL_RST BIT(6)
|
||||
#define ESC_DIGITAL_RST 0x00000001
|
||||
|
||||
#define ESC_ID_REV_REG 0x050
|
||||
#define LAN9252_ID_REV 0x9252
|
||||
|
||||
#define ESC_IRQ_CFG_REG 0x054
|
||||
#define ESC_INT_EN_REG 0x05C
|
||||
#define ESC_BYTE_TEST_REG 0x064
|
||||
#define ESC_TEST_VALUE 0x87654321
|
||||
|
||||
#define ESC_HW_CFG_REG 0x074
|
||||
#define ESC_READY BIT(27)
|
||||
|
||||
|
||||
static int lan9252 = -1;
|
||||
|
||||
/* lan9252 singel write */
|
||||
static void lan9252_write_32 (uint16_t address, uint32_t val)
|
||||
{
|
||||
uint8_t data[7];
|
||||
|
||||
data[0] = ESC_CMD_SERIAL_WRITE;
|
||||
data[1] = ((address >> 8) & 0xFF);
|
||||
data[2] = (address & 0xFF);
|
||||
data[3] = (val & 0xFF);
|
||||
data[4] = ((val >> 8) & 0xFF);
|
||||
data[5] = ((val >> 16) & 0xFF);
|
||||
data[6] = ((val >> 24) & 0xFF);
|
||||
|
||||
/* Select device. */
|
||||
spi_select (lan9252);
|
||||
/* Write data */
|
||||
write (lan9252, data, sizeof(data));
|
||||
/* Un-select device. */
|
||||
spi_unselect (lan9252);
|
||||
}
|
||||
|
||||
/* lan9252 single read */
|
||||
static uint32_t lan9252_read_32 (uint32_t address)
|
||||
{
|
||||
uint8_t data[4];
|
||||
uint8_t result[4];
|
||||
|
||||
data[0] = ESC_CMD_FAST_READ;
|
||||
data[1] = ((address >> 8) & 0xFF);
|
||||
data[2] = (address & 0xFF);
|
||||
data[3] = ESC_CMD_FAST_READ_DUMMY;
|
||||
|
||||
/* Select device. */
|
||||
spi_select (lan9252);
|
||||
/* Read data */
|
||||
write (lan9252, data, sizeof(data));
|
||||
read (lan9252, result, sizeof(result));
|
||||
/* Un-select device. */
|
||||
spi_unselect (lan9252);
|
||||
|
||||
return ((result[3] << 24) |
|
||||
(result[2] << 16) |
|
||||
(result[1] << 8) |
|
||||
result[0]);
|
||||
}
|
||||
|
||||
/* ESC read CSR function */
|
||||
static void ESC_read_csr (uint16_t address, void *buf, uint16_t len)
|
||||
{
|
||||
uint32_t value;
|
||||
|
||||
value = (ESC_CSR_CMD_READ | ESC_CSR_CMD_SIZE(len) | address);
|
||||
lan9252_write_32(ESC_CSR_CMD_REG, value);
|
||||
|
||||
do
|
||||
{
|
||||
value = lan9252_read_32(ESC_CSR_CMD_REG);
|
||||
} while(value & ESC_CSR_CMD_BUSY);
|
||||
|
||||
value = lan9252_read_32(ESC_CSR_DATA_REG);
|
||||
memcpy(buf, (uint8_t *)&value, len);
|
||||
}
|
||||
|
||||
/* ESC write CSR function */
|
||||
static void ESC_write_csr (uint16_t address, void *buf, uint16_t len)
|
||||
{
|
||||
uint32_t value;
|
||||
|
||||
memcpy((uint8_t*)&value, buf,len);
|
||||
lan9252_write_32(ESC_CSR_DATA_REG, value);
|
||||
value = (ESC_CSR_CMD_WRITE | ESC_CSR_CMD_SIZE(len) | address);
|
||||
lan9252_write_32(ESC_CSR_CMD_REG, value);
|
||||
|
||||
do
|
||||
{
|
||||
value = lan9252_read_32(ESC_CSR_CMD_REG);
|
||||
} while(value & ESC_CSR_CMD_BUSY);
|
||||
}
|
||||
|
||||
/* ESC read process data ram function */
|
||||
/*static*/ void ESC_read_pram (uint16_t address, void *buf, uint16_t len)
|
||||
{
|
||||
uint32_t value;
|
||||
uint8_t * temp_buf = (uint8_t *)buf;
|
||||
uint16_t byte_offset = 0;
|
||||
uint8_t fifo_cnt, first_byte_position, temp_len, data[4];
|
||||
|
||||
value = ESC_PRAM_CMD_ABORT;
|
||||
lan9252_write_32(ESC_PRAM_RD_CMD_REG, value);
|
||||
|
||||
do
|
||||
{
|
||||
value = lan9252_read_32(ESC_PRAM_RD_CMD_REG);
|
||||
}while(value & ESC_PRAM_CMD_BUSY);
|
||||
|
||||
value = ESC_PRAM_SIZE(len) | ESC_PRAM_ADDR(address);
|
||||
lan9252_write_32(ESC_PRAM_RD_ADDR_LEN_REG, value);
|
||||
|
||||
value = ESC_PRAM_CMD_BUSY;
|
||||
lan9252_write_32(ESC_PRAM_RD_CMD_REG, value);
|
||||
|
||||
do
|
||||
{
|
||||
value = lan9252_read_32(ESC_PRAM_RD_CMD_REG);
|
||||
}while((value & ESC_PRAM_CMD_AVAIL) == 0);
|
||||
|
||||
/* Fifo count */
|
||||
fifo_cnt = ESC_PRAM_CMD_CNT(value);
|
||||
|
||||
/* Read first value from FIFO */
|
||||
value = lan9252_read_32(ESC_PRAM_RD_FIFO_REG);
|
||||
fifo_cnt--;
|
||||
|
||||
/* Find out first byte position and adjust the copy from that
|
||||
* according to LAN9252 datasheet and MicroChip SDK code
|
||||
*/
|
||||
first_byte_position = (address & 0x03);
|
||||
temp_len = ((4 - first_byte_position) > len) ? len : (4 - first_byte_position);
|
||||
|
||||
memcpy(temp_buf ,((uint8_t *)&value + first_byte_position), temp_len);
|
||||
len -= temp_len;
|
||||
byte_offset += temp_len;
|
||||
|
||||
/* Select device. */
|
||||
spi_select (lan9252);
|
||||
/* Send command and address for fifo read */
|
||||
data[0] = ESC_CMD_FAST_READ;
|
||||
data[1] = ((ESC_PRAM_RD_FIFO_REG >> 8) & 0xFF);
|
||||
data[2] = (ESC_PRAM_RD_FIFO_REG & 0xFF);
|
||||
data[3] = ESC_CMD_FAST_READ_DUMMY;
|
||||
write (lan9252, data, sizeof(data));
|
||||
|
||||
/* Continue reading until we have read len */
|
||||
while(len > 0)
|
||||
{
|
||||
temp_len = (len > 4) ? 4: len;
|
||||
/* Always read 4 byte */
|
||||
read (lan9252, (temp_buf + byte_offset), sizeof(uint32_t));
|
||||
|
||||
fifo_cnt--;
|
||||
len -= temp_len;
|
||||
byte_offset += temp_len;
|
||||
}
|
||||
/* Un-select device. */
|
||||
spi_unselect (lan9252);
|
||||
}
|
||||
|
||||
/* ESC write process data ram function */
|
||||
/* static */ void ESC_write_pram (uint16_t address, void *buf, uint16_t len)
|
||||
{
|
||||
uint32_t value;
|
||||
uint8_t * temp_buf = (uint8_t *)buf;
|
||||
uint16_t byte_offset = 0;
|
||||
uint8_t fifo_cnt, first_byte_position, temp_len, data[3];
|
||||
|
||||
value = ESC_PRAM_CMD_ABORT;
|
||||
lan9252_write_32(ESC_PRAM_WR_CMD_REG, value);
|
||||
|
||||
do
|
||||
{
|
||||
value = lan9252_read_32(ESC_PRAM_WR_CMD_REG);
|
||||
}while(value & ESC_PRAM_CMD_BUSY);
|
||||
|
||||
value = ESC_PRAM_SIZE(len) | ESC_PRAM_ADDR(address);
|
||||
lan9252_write_32(ESC_PRAM_WR_ADDR_LEN_REG, value);
|
||||
|
||||
value = ESC_PRAM_CMD_BUSY;
|
||||
lan9252_write_32(ESC_PRAM_WR_CMD_REG, value);
|
||||
|
||||
do
|
||||
{
|
||||
value = lan9252_read_32(ESC_PRAM_WR_CMD_REG);
|
||||
}while((value & ESC_PRAM_CMD_AVAIL) == 0);
|
||||
|
||||
/* Fifo count */
|
||||
fifo_cnt = ESC_PRAM_CMD_CNT(value);
|
||||
|
||||
/* Find out first byte position and adjust the copy from that
|
||||
* according to LAN9252 datasheet
|
||||
*/
|
||||
first_byte_position = (address & 0x03);
|
||||
temp_len = ((4 - first_byte_position) > len) ? len : (4 - first_byte_position);
|
||||
|
||||
memcpy(((uint8_t *)&value + first_byte_position), temp_buf, temp_len);
|
||||
|
||||
/* Write first value from FIFO */
|
||||
lan9252_write_32(ESC_PRAM_WR_FIFO_REG, value);
|
||||
|
||||
len -= temp_len;
|
||||
byte_offset += temp_len;
|
||||
fifo_cnt--;
|
||||
|
||||
/* Select device. */
|
||||
spi_select (lan9252);
|
||||
/* Send command and address for incrementing write */
|
||||
data[0] = ESC_CMD_SERIAL_WRITE;
|
||||
data[1] = ((ESC_PRAM_WR_FIFO_REG >> 8) & 0xFF);
|
||||
data[2] = (ESC_PRAM_WR_FIFO_REG & 0xFF);
|
||||
write (lan9252, data, sizeof(data));
|
||||
|
||||
/* Continue reading until we have read len */
|
||||
while(len > 0)
|
||||
{
|
||||
temp_len = (len > 4) ? 4 : len;
|
||||
value = 0;
|
||||
memcpy((uint8_t *)&value, (temp_buf + byte_offset), temp_len);
|
||||
/* Always write 4 byte */
|
||||
write (lan9252, (uint8_t *)&value, sizeof(value));
|
||||
|
||||
fifo_cnt--;
|
||||
len -= temp_len;
|
||||
byte_offset += temp_len;
|
||||
}
|
||||
/* Un-select device. */
|
||||
spi_unselect (lan9252);
|
||||
}
|
||||
|
||||
|
||||
/** ESC read function used by the Slave stack.
|
||||
*
|
||||
* @param[in] address = address of ESC register to read
|
||||
* @param[out] buf = pointer to buffer to read in
|
||||
* @param[in] len = number of bytes to read
|
||||
*/
|
||||
void ESC_read (uint16_t address, void *buf, uint16_t len)
|
||||
{
|
||||
/* Select Read function depending on address, process data ram or not */
|
||||
if (address >= 0x1000)
|
||||
{
|
||||
ESC_read_pram(address, buf, len);
|
||||
}
|
||||
else
|
||||
{
|
||||
uint16_t size;
|
||||
uint8_t *temp_buf = (uint8_t *)buf;
|
||||
|
||||
while(len > 0)
|
||||
{
|
||||
/* We write maximum 4 bytes at the time */
|
||||
size = (len > 4) ? 4 : len;
|
||||
/* Make size aligned to address according to LAN9252 datasheet
|
||||
* Table 12-14 EtherCAT CSR Address VS size and MicroChip SDK code
|
||||
*/
|
||||
/* If we got an odd address size is 1 , 01b 11b is captured */
|
||||
if(address & BIT(0))
|
||||
{
|
||||
size = 1;
|
||||
}
|
||||
/* If address 1xb and size != 1 and 3 , allow size 2 else size 1 */
|
||||
else if (address & BIT(1))
|
||||
{
|
||||
size = (size & BIT(0)) ? 1 : 2;
|
||||
}
|
||||
/* size 3 not valid */
|
||||
else if (size == 3)
|
||||
{
|
||||
size = 1;
|
||||
}
|
||||
/* else size is kept AS IS */
|
||||
ESC_read_csr(address, temp_buf, size);
|
||||
|
||||
/* next address */
|
||||
len -= size;
|
||||
temp_buf += size;
|
||||
address += size;
|
||||
}
|
||||
}
|
||||
/* To mimic the ET1100 always providing AlEvent on every read or write */
|
||||
ESC_read_csr(ESCREG_ALEVENT,(void *)&ESCvar.ALevent,sizeof(ESCvar.ALevent));
|
||||
ESCvar.ALevent = etohs (ESCvar.ALevent);
|
||||
|
||||
}
|
||||
|
||||
/** ESC write function used by the Slave stack.
|
||||
*
|
||||
* @param[in] address = address of ESC register to write
|
||||
* @param[out] buf = pointer to buffer to write from
|
||||
* @param[in] len = number of bytes to write
|
||||
*/
|
||||
void ESC_write (uint16_t address, void *buf, uint16_t len)
|
||||
{
|
||||
/* Select Write function depending on address, process data ram or not */
|
||||
if (address >= 0x1000)
|
||||
{
|
||||
ESC_write_pram(address, buf, len);
|
||||
}
|
||||
else
|
||||
{
|
||||
uint16_t size;
|
||||
uint8_t *temp_buf = (uint8_t *)buf;
|
||||
|
||||
while(len > 0)
|
||||
{
|
||||
/* We write maximum 4 bytes at the time */
|
||||
size = (len > 4) ? 4 : len;
|
||||
/* Make size aligned to address according to LAN9252 datasheet
|
||||
* Table 12-14 EtherCAT CSR Address VS size and MicroChip SDK code
|
||||
*/
|
||||
/* If we got an odd address size is 1 , 01b 11b is captured */
|
||||
if(address & BIT(0))
|
||||
{
|
||||
size = 1;
|
||||
}
|
||||
/* If address 1xb and size != 1 and 3 , allow size 2 else size 1 */
|
||||
else if (address & BIT(1))
|
||||
{
|
||||
size = (size & BIT(0)) ? 1 : 2;
|
||||
}
|
||||
/* size 3 not valid */
|
||||
else if (size == 3)
|
||||
{
|
||||
size = 1;
|
||||
}
|
||||
/* else size is kept AS IS */
|
||||
ESC_write_csr(address, temp_buf, size);
|
||||
|
||||
/* next address */
|
||||
len -= size;
|
||||
temp_buf += size;
|
||||
address += size;
|
||||
}
|
||||
}
|
||||
|
||||
/* To mimic the ET1x00 always providing AlEvent on every read or write */
|
||||
ESC_read_csr(ESCREG_ALEVENT,(void *)&ESCvar.ALevent,sizeof(ESCvar.ALevent));
|
||||
ESCvar.ALevent = etohs (ESCvar.ALevent);
|
||||
}
|
||||
|
||||
/* Un-used due to evb-lan9252-digio not havning any possability to
|
||||
* reset except over SPI.
|
||||
*/
|
||||
void ESC_reset (void)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
uint8_t ESC_IsLAN9252()
|
||||
{
|
||||
volatile uint32_t value;
|
||||
uint16_t detectedChip, revision;
|
||||
|
||||
/* Read */
|
||||
value = lan9252_read_32(ESC_ID_REV_REG);
|
||||
detectedChip = value >> 16;
|
||||
revision = value & 0xFF;
|
||||
|
||||
return detectedChip == LAN9252_ID_REV
|
||||
&& revision >= 1;
|
||||
}
|
||||
|
||||
|
||||
void ESC_init (const esc_cfg_t * config)
|
||||
{
|
||||
uint32_t value;
|
||||
|
||||
spi_setup();
|
||||
|
||||
/* Reset the ecat core here due to evb-lan9252-digio not having any GPIO
|
||||
* for that purpose.
|
||||
*/
|
||||
lan9252_write_32(ESC_RESET_CTRL_REG, ESC_DIGITAL_RST);
|
||||
do
|
||||
{
|
||||
value = lan9252_read_32(ESC_RESET_CTRL_REG);
|
||||
}
|
||||
while(value & ESC_RESET_CTRL_RST);
|
||||
|
||||
/* Read test register */
|
||||
do
|
||||
{
|
||||
value = lan9252_read_32(ESC_BYTE_TEST_REG);
|
||||
}
|
||||
while (value != ESC_TEST_VALUE);
|
||||
|
||||
/* Check Ready flag */
|
||||
do
|
||||
{
|
||||
value = lan9252_read_32(ESC_HW_CFG_REG);
|
||||
}
|
||||
while ((value & ESC_READY) == 0);
|
||||
|
||||
if(!ESC_IsLAN9252())
|
||||
{
|
||||
while (1);
|
||||
}
|
||||
}
|
||||
66
Pcb-1-lan9252/Firmware/lib/soes/hal/arduino-lan9252/spi.cpp
Executable file
66
Pcb-1-lan9252/Firmware/lib/soes/hal/arduino-lan9252/spi.cpp
Executable file
@@ -0,0 +1,66 @@
|
||||
#include "spi.hpp"
|
||||
// #include <Arduino.h>
|
||||
#include <SPI.h>
|
||||
|
||||
|
||||
char SCS = ESC_GPIO_Pin_CS;
|
||||
|
||||
|
||||
void spi_setup(void)
|
||||
{
|
||||
SPI.begin();
|
||||
pinMode(SCS, OUTPUT);
|
||||
spi_unselect(0);
|
||||
delay(100);
|
||||
SPI.beginTransaction(SPISettings(SPIX_ESC_SPEED, MSBFIRST, SPI_MODE0));
|
||||
|
||||
}
|
||||
|
||||
void spi_select (int8_t board)
|
||||
{
|
||||
// Soft CSN
|
||||
#if SCS_ACTIVE_POLARITY == SCS_LOW
|
||||
digitalWrite(SCS, LOW);
|
||||
#endif
|
||||
}
|
||||
|
||||
void spi_unselect (int8_t board)
|
||||
{
|
||||
// Soft CSN
|
||||
#if SCS_ACTIVE_POLARITY == SCS_LOW
|
||||
digitalWrite(SCS, HIGH);
|
||||
#endif
|
||||
}
|
||||
|
||||
inline static uint8_t spi_transfer_byte(uint8_t byte)
|
||||
{
|
||||
return SPI.transfer(byte);
|
||||
// AVR will need handling last byte transfer difference,
|
||||
// but then again they pobably wont even fit EtherCAT stack in RAM
|
||||
// so no need to care for now
|
||||
}
|
||||
|
||||
void write (int8_t board, uint8_t *data, uint8_t size)
|
||||
{
|
||||
for(int i = 0; i < size; ++i)
|
||||
{
|
||||
spi_transfer_byte(data[i]);
|
||||
}
|
||||
}
|
||||
|
||||
void read (int8_t board, uint8_t *result, uint8_t size)
|
||||
{
|
||||
for(int i = 0; i < size; ++i)
|
||||
{
|
||||
result[i] = spi_transfer_byte(DUMMY_BYTE);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void spi_bidirectionally_transfer (int8_t board, uint8_t *result, uint8_t *data, uint8_t size)
|
||||
{
|
||||
for(int i = 0; i < size; ++i)
|
||||
{
|
||||
result[i] = spi_transfer_byte(data[i]);
|
||||
}
|
||||
}
|
||||
15
Pcb-1-lan9252/Firmware/lib/soes/hal/arduino-lan9252/spi.h
Executable file
15
Pcb-1-lan9252/Firmware/lib/soes/hal/arduino-lan9252/spi.h
Executable file
@@ -0,0 +1,15 @@
|
||||
#ifndef SRC_APP_SPI_H_
|
||||
#define SRC_APP_SPI_H_
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
|
||||
void spi_setup(void);
|
||||
void spi_select (int8_t board);
|
||||
void spi_unselect (int8_t board);
|
||||
void write (int8_t board, uint8_t *data, uint8_t size);
|
||||
void read (int8_t board, uint8_t *result, uint8_t size);
|
||||
void spi_bidirectionally_transfer (int8_t board, uint8_t *result, uint8_t *data, uint8_t size);
|
||||
|
||||
|
||||
#endif /* SRC_APP_SPI_H_ */
|
||||
25
Pcb-1-lan9252/Firmware/lib/soes/hal/arduino-lan9252/spi.hpp
Executable file
25
Pcb-1-lan9252/Firmware/lib/soes/hal/arduino-lan9252/spi.hpp
Executable file
@@ -0,0 +1,25 @@
|
||||
#ifndef SRC_APP_SPI_H_
|
||||
#define SRC_APP_SPI_H_
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#define SCS_LOW 0
|
||||
#define SCS_HIGH 1
|
||||
#define SCS_ACTIVE_POLARITY SCS_LOW
|
||||
|
||||
#define SPIX_ESC SPI1
|
||||
//#define SPIX_ESC_SPEED 18000000
|
||||
#define SPIX_ESC_SPEED 50000000
|
||||
#define ESC_GPIO_Pin_CS PC4
|
||||
|
||||
#define DUMMY_BYTE 0xFF
|
||||
|
||||
extern "C" void spi_setup(void);
|
||||
extern "C" void spi_select (int8_t board);
|
||||
extern "C" void spi_unselect (int8_t board);
|
||||
extern "C" void write (int8_t board, uint8_t *data, uint8_t size);
|
||||
extern "C" void read (int8_t board, uint8_t *result, uint8_t size);
|
||||
extern "C" void spi_bidirectionally_transfer (int8_t board, uint8_t *result, uint8_t *data, uint8_t size);
|
||||
|
||||
|
||||
#endif /* SRC_APP_SPI_H_ */
|
||||
198
Pcb-1-lan9252/Firmware/lib/soes/objectlist.c
Executable file
198
Pcb-1-lan9252/Firmware/lib/soes/objectlist.c
Executable file
@@ -0,0 +1,198 @@
|
||||
#include "esc_coe.h"
|
||||
#include "utypes.h"
|
||||
#include <stddef.h>
|
||||
|
||||
|
||||
static const char acName1000[] = "Device Type";
|
||||
static const char acName1008[] = "Device Name";
|
||||
static const char acName1009[] = "Hardware Version";
|
||||
static const char acName100A[] = "Software Version";
|
||||
static const char acName1018[] = "Identity Object";
|
||||
static const char acName1018_00[] = "Max SubIndex";
|
||||
static const char acName1018_01[] = "Vendor ID";
|
||||
static const char acName1018_02[] = "Product Code";
|
||||
static const char acName1018_03[] = "Revision Number";
|
||||
static const char acName1018_04[] = "Serial Number";
|
||||
static const char acName1600[] = "EncPosScale";
|
||||
static const char acName1600_00[] = "Max SubIndex";
|
||||
static const char acName1600_01[] = "EncPosScale";
|
||||
static const char acName1601[] = "IndexLatchEnable";
|
||||
static const char acName1601_00[] = "Max SubIndex";
|
||||
static const char acName1601_01[] = "IndexLatchEnable";
|
||||
static const char acName1A00[] = "EncPos";
|
||||
static const char acName1A00_00[] = "Max SubIndex";
|
||||
static const char acName1A00_01[] = "EncPos";
|
||||
static const char acName1A01[] = "EncFrequency";
|
||||
static const char acName1A01_00[] = "Max SubIndex";
|
||||
static const char acName1A01_01[] = "EncFrequency";
|
||||
static const char acName1A02[] = "DiffT";
|
||||
static const char acName1A02_00[] = "Max SubIndex";
|
||||
static const char acName1A02_01[] = "DiffT";
|
||||
static const char acName1A03[] = "IndexByte";
|
||||
static const char acName1A03_00[] = "Max SubIndex";
|
||||
static const char acName1A03_01[] = "IndexByte";
|
||||
static const char acName1A04[] = "IndexStatus";
|
||||
static const char acName1A04_00[] = "Max SubIndex";
|
||||
static const char acName1A04_01[] = "IndexStatus";
|
||||
static const char acName1C00[] = "Sync Manager Communication Type";
|
||||
static const char acName1C00_00[] = "Max SubIndex";
|
||||
static const char acName1C00_01[] = "Communications Type SM0";
|
||||
static const char acName1C00_02[] = "Communications Type SM1";
|
||||
static const char acName1C00_03[] = "Communications Type SM2";
|
||||
static const char acName1C00_04[] = "Communications Type SM3";
|
||||
static const char acName1C12[] = "Sync Manager 2 PDO Assignment";
|
||||
static const char acName1C12_00[] = "Max SubIndex";
|
||||
static const char acName1C12_01[] = "PDO Mapping";
|
||||
static const char acName1C12_02[] = "PDO Mapping";
|
||||
static const char acName1C13[] = "Sync Manager 3 PDO Assignment";
|
||||
static const char acName1C13_00[] = "Max SubIndex";
|
||||
static const char acName1C13_01[] = "PDO Mapping";
|
||||
static const char acName1C13_02[] = "PDO Mapping";
|
||||
static const char acName1C13_03[] = "PDO Mapping";
|
||||
static const char acName1C13_04[] = "PDO Mapping";
|
||||
static const char acName1C13_05[] = "PDO Mapping";
|
||||
static const char acName6000[] = "EncPos";
|
||||
static const char acName6001[] = "EncFrequency";
|
||||
static const char acName6002[] = "DiffT";
|
||||
static const char acName6003[] = "IndexByte";
|
||||
static const char acName6004[] = "IndexStatus";
|
||||
static const char acName7000[] = "EncPosScale";
|
||||
static const char acName7001[] = "IndexLatchEnable";
|
||||
|
||||
const _objd SDO1000[] =
|
||||
{
|
||||
{0x0, DTYPE_UNSIGNED32, 32, ATYPE_RO, acName1000, 5001, NULL},
|
||||
};
|
||||
const _objd SDO1008[] =
|
||||
{
|
||||
{0x0, DTYPE_VISIBLE_STRING, 208, ATYPE_RO, acName1008, 0, "MetalMusings EaserCAT 2000"},
|
||||
};
|
||||
const _objd SDO1009[] =
|
||||
{
|
||||
{0x0, DTYPE_VISIBLE_STRING, 40, ATYPE_RO, acName1009, 0, "0.0.1"},
|
||||
};
|
||||
const _objd SDO100A[] =
|
||||
{
|
||||
{0x0, DTYPE_VISIBLE_STRING, 40, ATYPE_RO, acName100A, 0, "0.0.1"},
|
||||
};
|
||||
const _objd SDO1018[] =
|
||||
{
|
||||
{0x00, DTYPE_UNSIGNED8, 8, ATYPE_RO, acName1018_00, 4, NULL},
|
||||
{0x01, DTYPE_UNSIGNED32, 32, ATYPE_RO, acName1018_01, 2730, NULL},
|
||||
{0x02, DTYPE_UNSIGNED32, 32, ATYPE_RO, acName1018_02, 12303564, NULL},
|
||||
{0x03, DTYPE_UNSIGNED32, 32, ATYPE_RO, acName1018_03, 2, NULL},
|
||||
{0x04, DTYPE_UNSIGNED32, 32, ATYPE_RO, acName1018_04, 1, &Obj.serial},
|
||||
};
|
||||
const _objd SDO1600[] =
|
||||
{
|
||||
{0x00, DTYPE_UNSIGNED8, 8, ATYPE_RO, acName1600_00, 1, NULL},
|
||||
{0x01, DTYPE_UNSIGNED32, 32, ATYPE_RO, acName1600_01, 0x70000020, NULL},
|
||||
};
|
||||
const _objd SDO1601[] =
|
||||
{
|
||||
{0x00, DTYPE_UNSIGNED8, 8, ATYPE_RO, acName1601_00, 1, NULL},
|
||||
{0x01, DTYPE_UNSIGNED32, 32, ATYPE_RO, acName1601_01, 0x70010020, NULL},
|
||||
};
|
||||
const _objd SDO1A00[] =
|
||||
{
|
||||
{0x00, DTYPE_UNSIGNED8, 8, ATYPE_RO, acName1A00_00, 1, NULL},
|
||||
{0x01, DTYPE_UNSIGNED32, 32, ATYPE_RO, acName1A00_01, 0x60000020, NULL},
|
||||
};
|
||||
const _objd SDO1A01[] =
|
||||
{
|
||||
{0x00, DTYPE_UNSIGNED8, 8, ATYPE_RO, acName1A01_00, 1, NULL},
|
||||
{0x01, DTYPE_UNSIGNED32, 32, ATYPE_RO, acName1A01_01, 0x60010020, NULL},
|
||||
};
|
||||
const _objd SDO1A02[] =
|
||||
{
|
||||
{0x00, DTYPE_UNSIGNED8, 8, ATYPE_RO, acName1A02_00, 1, NULL},
|
||||
{0x01, DTYPE_UNSIGNED32, 32, ATYPE_RO, acName1A02_01, 0x60020020, NULL},
|
||||
};
|
||||
const _objd SDO1A03[] =
|
||||
{
|
||||
{0x00, DTYPE_UNSIGNED8, 8, ATYPE_RO, acName1A03_00, 1, NULL},
|
||||
{0x01, DTYPE_UNSIGNED32, 32, ATYPE_RO, acName1A03_01, 0x60030020, NULL},
|
||||
};
|
||||
const _objd SDO1A04[] =
|
||||
{
|
||||
{0x00, DTYPE_UNSIGNED8, 8, ATYPE_RO, acName1A04_00, 1, NULL},
|
||||
{0x01, DTYPE_UNSIGNED32, 32, ATYPE_RO, acName1A04_01, 0x60040020, NULL},
|
||||
};
|
||||
const _objd SDO1C00[] =
|
||||
{
|
||||
{0x00, DTYPE_UNSIGNED8, 8, ATYPE_RO, acName1C00_00, 4, NULL},
|
||||
{0x01, DTYPE_UNSIGNED8, 8, ATYPE_RO, acName1C00_01, 1, NULL},
|
||||
{0x02, DTYPE_UNSIGNED8, 8, ATYPE_RO, acName1C00_02, 2, NULL},
|
||||
{0x03, DTYPE_UNSIGNED8, 8, ATYPE_RO, acName1C00_03, 3, NULL},
|
||||
{0x04, DTYPE_UNSIGNED8, 8, ATYPE_RO, acName1C00_04, 4, NULL},
|
||||
};
|
||||
const _objd SDO1C12[] =
|
||||
{
|
||||
{0x00, DTYPE_UNSIGNED8, 8, ATYPE_RO, acName1C12_00, 2, NULL},
|
||||
{0x01, DTYPE_UNSIGNED16, 16, ATYPE_RO, acName1C12_01, 0x1600, NULL},
|
||||
{0x02, DTYPE_UNSIGNED16, 16, ATYPE_RO, acName1C12_02, 0x1601, NULL},
|
||||
};
|
||||
const _objd SDO1C13[] =
|
||||
{
|
||||
{0x00, DTYPE_UNSIGNED8, 8, ATYPE_RO, acName1C13_00, 5, NULL},
|
||||
{0x01, DTYPE_UNSIGNED16, 16, ATYPE_RO, acName1C13_01, 0x1A00, NULL},
|
||||
{0x02, DTYPE_UNSIGNED16, 16, ATYPE_RO, acName1C13_02, 0x1A01, NULL},
|
||||
{0x03, DTYPE_UNSIGNED16, 16, ATYPE_RO, acName1C13_03, 0x1A02, NULL},
|
||||
{0x04, DTYPE_UNSIGNED16, 16, ATYPE_RO, acName1C13_04, 0x1A03, NULL},
|
||||
{0x05, DTYPE_UNSIGNED16, 16, ATYPE_RO, acName1C13_05, 0x1A04, NULL},
|
||||
};
|
||||
const _objd SDO6000[] =
|
||||
{
|
||||
{0x0, DTYPE_REAL32, 32, ATYPE_RO | ATYPE_TXPDO, acName6000, 0x00000000, &Obj.EncPos},
|
||||
};
|
||||
const _objd SDO6001[] =
|
||||
{
|
||||
{0x0, DTYPE_REAL32, 32, ATYPE_RO | ATYPE_TXPDO, acName6001, 0x00000000, &Obj.EncFrequency},
|
||||
};
|
||||
const _objd SDO6002[] =
|
||||
{
|
||||
{0x0, DTYPE_UNSIGNED32, 32, ATYPE_RO | ATYPE_TXPDO, acName6002, 0, &Obj.DiffT},
|
||||
};
|
||||
const _objd SDO6003[] =
|
||||
{
|
||||
{0x0, DTYPE_UNSIGNED32, 32, ATYPE_RO | ATYPE_TXPDO, acName6003, 0, &Obj.IndexByte},
|
||||
};
|
||||
const _objd SDO6004[] =
|
||||
{
|
||||
{0x0, DTYPE_UNSIGNED32, 32, ATYPE_RO | ATYPE_TXPDO, acName6004, 0, &Obj.IndexStatus},
|
||||
};
|
||||
const _objd SDO7000[] =
|
||||
{
|
||||
{0x0, DTYPE_INTEGER32, 32, ATYPE_RO | ATYPE_RXPDO, acName7000, 0, &Obj.EncPosScale},
|
||||
};
|
||||
const _objd SDO7001[] =
|
||||
{
|
||||
{0x0, DTYPE_UNSIGNED32, 32, ATYPE_RO | ATYPE_RXPDO, acName7001, 0, &Obj.IndexLatchEnable},
|
||||
};
|
||||
|
||||
const _objectlist SDOobjects[] =
|
||||
{
|
||||
{0x1000, OTYPE_VAR, 0, 0, acName1000, SDO1000},
|
||||
{0x1008, OTYPE_VAR, 0, 0, acName1008, SDO1008},
|
||||
{0x1009, OTYPE_VAR, 0, 0, acName1009, SDO1009},
|
||||
{0x100A, OTYPE_VAR, 0, 0, acName100A, SDO100A},
|
||||
{0x1018, OTYPE_RECORD, 4, 0, acName1018, SDO1018},
|
||||
{0x1600, OTYPE_RECORD, 1, 0, acName1600, SDO1600},
|
||||
{0x1601, OTYPE_RECORD, 1, 0, acName1601, SDO1601},
|
||||
{0x1A00, OTYPE_RECORD, 1, 0, acName1A00, SDO1A00},
|
||||
{0x1A01, OTYPE_RECORD, 1, 0, acName1A01, SDO1A01},
|
||||
{0x1A02, OTYPE_RECORD, 1, 0, acName1A02, SDO1A02},
|
||||
{0x1A03, OTYPE_RECORD, 1, 0, acName1A03, SDO1A03},
|
||||
{0x1A04, OTYPE_RECORD, 1, 0, acName1A04, SDO1A04},
|
||||
{0x1C00, OTYPE_ARRAY, 4, 0, acName1C00, SDO1C00},
|
||||
{0x1C12, OTYPE_ARRAY, 2, 0, acName1C12, SDO1C12},
|
||||
{0x1C13, OTYPE_ARRAY, 5, 0, acName1C13, SDO1C13},
|
||||
{0x6000, OTYPE_VAR, 0, 0, acName6000, SDO6000},
|
||||
{0x6001, OTYPE_VAR, 0, 0, acName6001, SDO6001},
|
||||
{0x6002, OTYPE_VAR, 0, 0, acName6002, SDO6002},
|
||||
{0x6003, OTYPE_VAR, 0, 0, acName6003, SDO6003},
|
||||
{0x6004, OTYPE_VAR, 0, 0, acName6004, SDO6004},
|
||||
{0x7000, OTYPE_VAR, 0, 0, acName7000, SDO7000},
|
||||
{0x7001, OTYPE_VAR, 0, 0, acName7001, SDO7001},
|
||||
{0xffff, 0xff, 0xff, 0xff, NULL, NULL}
|
||||
};
|
||||
31
Pcb-1-lan9252/Firmware/lib/soes/utypes.h
Executable file
31
Pcb-1-lan9252/Firmware/lib/soes/utypes.h
Executable file
@@ -0,0 +1,31 @@
|
||||
#ifndef __UTYPES_H__
|
||||
#define __UTYPES_H__
|
||||
|
||||
#include "cc.h"
|
||||
|
||||
/* Object dictionary storage */
|
||||
|
||||
typedef struct
|
||||
{
|
||||
/* Identity */
|
||||
|
||||
uint32_t serial;
|
||||
|
||||
/* Inputs */
|
||||
|
||||
float EncPos;
|
||||
float EncFrequency;
|
||||
uint32_t DiffT;
|
||||
uint32_t IndexByte;
|
||||
uint32_t IndexStatus;
|
||||
|
||||
/* Outputs */
|
||||
|
||||
int32_t EncPosScale;
|
||||
uint32_t IndexLatchEnable;
|
||||
|
||||
} _Objects;
|
||||
|
||||
extern _Objects Obj;
|
||||
|
||||
#endif /* __UTYPES_H__ */
|
||||
23
Pcb-1-lan9252/Firmware/platformio.ini
Executable file
23
Pcb-1-lan9252/Firmware/platformio.ini
Executable file
@@ -0,0 +1,23 @@
|
||||
; PlatformIO Project Configuration File
|
||||
;
|
||||
; Build options: build flags, source filter
|
||||
; Upload options: custom upload port, speed and extra flags
|
||||
; Library options: dependencies, extra library storages
|
||||
; Advanced options: extra scripting
|
||||
;
|
||||
; Please visit documentation for the other options and examples
|
||||
; https://docs.platformio.org/page/projectconf.html
|
||||
|
||||
[env:genericSTM32F407VGT6]
|
||||
framework = arduino
|
||||
platform = ststm32
|
||||
board = genericSTM32F407VGT6
|
||||
upload_protocol = stlink
|
||||
debug_tool = stlink
|
||||
debug_build_flags = -O0 -g -ggdb
|
||||
monitor_port = COM7
|
||||
monitor_speed = 115200
|
||||
build_flags = -Wl,--no-warn-rwx-segment
|
||||
lib_deps =
|
||||
SPI
|
||||
rlogiacco/CircularBuffer@^1.3.3
|
||||
270
Pcb-1-lan9252/Firmware/src/Stepper.cpp
Executable file
270
Pcb-1-lan9252/Firmware/src/Stepper.cpp
Executable file
@@ -0,0 +1,270 @@
|
||||
#include <Arduino.h>
|
||||
|
||||
/* USER CODE BEGIN Header */
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file : main.c
|
||||
* @brief : Main program body
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* Copyright (c) 2023 STMicroelectronics.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This software is licensed under terms that can be found in the LICENSE file
|
||||
* in the root directory of this software component.
|
||||
* If no LICENSE file comes with this software, it is provided AS-IS.
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
/* USER CODE END Header */
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "Stepper.h"
|
||||
|
||||
/* Private includes ----------------------------------------------------------*/
|
||||
/* USER CODE BEGIN Includes */
|
||||
|
||||
/* USER CODE END Includes */
|
||||
|
||||
/* Private typedef -----------------------------------------------------------*/
|
||||
/* USER CODE BEGIN PTD */
|
||||
|
||||
/* USER CODE END PTD */
|
||||
|
||||
/* Private define ------------------------------------------------------------*/
|
||||
/* USER CODE BEGIN PD */
|
||||
|
||||
/* USER CODE END PD */
|
||||
|
||||
/* Private macro -------------------------------------------------------------*/
|
||||
/* USER CODE BEGIN PM */
|
||||
|
||||
/* USER CODE END PM */
|
||||
|
||||
/* Private variables ---------------------------------------------------------*/
|
||||
TIM_HandleTypeDef htim1;
|
||||
|
||||
/* USER CODE BEGIN PV */
|
||||
|
||||
/* USER CODE END PV */
|
||||
|
||||
/* Private function prototypes -----------------------------------------------*/
|
||||
void SystemClock_Config(void);
|
||||
static void MX_GPIO_Init(void);
|
||||
static void MX_TIM1_Init(void);
|
||||
/* USER CODE BEGIN PFP */
|
||||
|
||||
/* USER CODE END PFP */
|
||||
|
||||
/* Private user code ---------------------------------------------------------*/
|
||||
/* USER CODE BEGIN 0 */
|
||||
|
||||
/* USER CODE END 0 */
|
||||
|
||||
void HAL_TIM_MspPostInit(TIM_HandleTypeDef *htim)
|
||||
{
|
||||
GPIO_InitTypeDef GPIO_InitStruct = {0};
|
||||
if (htim->Instance == TIM1)
|
||||
{
|
||||
//__HAL_RCC_GPIOE_CLK_ENABLE();
|
||||
/**TIM1 GPIO Configuration
|
||||
PE9 ------> TIM1_CH1
|
||||
PA8 ------< TIM1_CH1
|
||||
*/
|
||||
GPIO_InitStruct.Pin = GPIO_PIN_8; // 9;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
|
||||
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
|
||||
GPIO_InitStruct.Alternate = GPIO_AF1_TIM1;
|
||||
// HAL_GPIO_Init(GPIOE, &GPIO_InitStruct);
|
||||
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief The application entry point.
|
||||
* @retval int
|
||||
*/
|
||||
void StepperSetup(void)
|
||||
{
|
||||
/* Reset of all peripherals, Initializes the Flash interface and the Systick. */
|
||||
// HAL_Init();
|
||||
// SystemClock_Config();
|
||||
|
||||
/* Initialize all configured peripherals */
|
||||
// MX_GPIO_Init();
|
||||
MX_TIM1_Init();
|
||||
|
||||
// htim1.Instance->ARR = 1;
|
||||
// htim1.Instance->CCR1 = 1;
|
||||
HAL_TIM_PWM_Start(&htim1, TIM_CHANNEL_1);
|
||||
TIM_TypeDef *TIMM = TIM1;
|
||||
|
||||
#define CLOCK_FREQ (168000000-2000000)
|
||||
// Best range on timer clock frequency/pulse length/65355 +1 => best resolution in the pulse range
|
||||
TIM1->PSC = CLOCK_FREQ / 1000 / (1 << 16);
|
||||
|
||||
/* Infinite loop */
|
||||
#if 0
|
||||
while (1)
|
||||
{
|
||||
makePulses(1200, 15);
|
||||
HAL_Delay(1000);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void makePulses(uint32_t totalLength /* µsec */, uint32_t nPulses)
|
||||
{
|
||||
uint64_t TickFreq = CLOCK_FREQ / (TIM1->PSC+1); // 56 MHz at PSC=2
|
||||
uint64_t TicksTotal = TickFreq * totalLength / 1000000; // Total number of ticks during this time, ca 56000
|
||||
uint32_t TicksPerPulse = TicksTotal / nPulses;
|
||||
|
||||
TIM1->ARR = TicksPerPulse - 1;
|
||||
TIM1->CCR1 = TicksPerPulse / 2;
|
||||
TIM1->RCR = nPulses - 1;
|
||||
TIM1->EGR = TIM_EGR_UG;
|
||||
TIM1->CR1 |= TIM_CR1_OPM;
|
||||
TIM1->CR1 |= TIM_CR1_CEN;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief System Clock Configuration
|
||||
* @retval None
|
||||
*/
|
||||
void SystemClock_Config(void)
|
||||
{
|
||||
RCC_OscInitTypeDef RCC_OscInitStruct = {0};
|
||||
RCC_ClkInitTypeDef RCC_ClkInitStruct = {0};
|
||||
|
||||
/** Configure the main internal regulator output voltage
|
||||
*/
|
||||
__HAL_RCC_PWR_CLK_ENABLE();
|
||||
__HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE1);
|
||||
|
||||
/** Initializes the RCC Oscillators according to the specified parameters
|
||||
* in the RCC_OscInitTypeDef structure.
|
||||
*/
|
||||
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI;
|
||||
RCC_OscInitStruct.HSIState = RCC_HSI_ON;
|
||||
RCC_OscInitStruct.HSICalibrationValue = RCC_HSICALIBRATION_DEFAULT;
|
||||
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
|
||||
RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSI;
|
||||
RCC_OscInitStruct.PLL.PLLM = 8;
|
||||
RCC_OscInitStruct.PLL.PLLN = 168;
|
||||
RCC_OscInitStruct.PLL.PLLP = RCC_PLLP_DIV2;
|
||||
RCC_OscInitStruct.PLL.PLLQ = 4;
|
||||
if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK)
|
||||
{
|
||||
Error_Handler();
|
||||
}
|
||||
|
||||
/** Initializes the CPU, AHB and APB buses clocks
|
||||
*/
|
||||
RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK | RCC_CLOCKTYPE_SYSCLK | RCC_CLOCKTYPE_PCLK1 | RCC_CLOCKTYPE_PCLK2;
|
||||
RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK;
|
||||
RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1;
|
||||
RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV4;
|
||||
RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV2;
|
||||
|
||||
if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_5) != HAL_OK)
|
||||
{
|
||||
Error_Handler();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief TIM1 Initialization Function
|
||||
* @param None
|
||||
* @retval None
|
||||
*/
|
||||
static void MX_TIM1_Init(void)
|
||||
{
|
||||
|
||||
/* USER CODE BEGIN TIM1_Init 0 */
|
||||
|
||||
/* USER CODE END TIM1_Init 0 */
|
||||
|
||||
TIM_ClockConfigTypeDef sClockSourceConfig = {0};
|
||||
TIM_MasterConfigTypeDef sMasterConfig = {0};
|
||||
TIM_OC_InitTypeDef sConfigOC = {0};
|
||||
TIM_BreakDeadTimeConfigTypeDef sBreakDeadTimeConfig = {0};
|
||||
|
||||
/* USER CODE BEGIN TIM1_Init 1 */
|
||||
|
||||
/* USER CODE END TIM1_Init 1 */
|
||||
htim1.Instance = TIM1;
|
||||
htim1.Init.Prescaler = 70;
|
||||
htim1.Init.CounterMode = TIM_COUNTERMODE_UP;
|
||||
htim1.Init.Period = 65535;
|
||||
htim1.Init.ClockDivision = TIM_CLOCKDIVISION_DIV1;
|
||||
htim1.Init.RepetitionCounter = 10;
|
||||
htim1.Init.AutoReloadPreload = TIM_AUTORELOAD_PRELOAD_ENABLE;
|
||||
if (HAL_TIM_Base_Init(&htim1) != HAL_OK)
|
||||
{
|
||||
Error_Handler();
|
||||
}
|
||||
sClockSourceConfig.ClockSource = TIM_CLOCKSOURCE_INTERNAL;
|
||||
if (HAL_TIM_ConfigClockSource(&htim1, &sClockSourceConfig) != HAL_OK)
|
||||
{
|
||||
Error_Handler();
|
||||
}
|
||||
if (HAL_TIM_PWM_Init(&htim1) != HAL_OK)
|
||||
{
|
||||
Error_Handler();
|
||||
}
|
||||
sMasterConfig.MasterOutputTrigger = TIM_TRGO_RESET;
|
||||
sMasterConfig.MasterSlaveMode = TIM_MASTERSLAVEMODE_DISABLE;
|
||||
if (HAL_TIMEx_MasterConfigSynchronization(&htim1, &sMasterConfig) != HAL_OK)
|
||||
{
|
||||
Error_Handler();
|
||||
}
|
||||
sConfigOC.OCMode = TIM_OCMODE_PWM2;
|
||||
sConfigOC.Pulse = 0;
|
||||
sConfigOC.OCPolarity = TIM_OCPOLARITY_HIGH;
|
||||
sConfigOC.OCNPolarity = TIM_OCNPOLARITY_HIGH;
|
||||
sConfigOC.OCFastMode = TIM_OCFAST_DISABLE;
|
||||
sConfigOC.OCIdleState = TIM_OCIDLESTATE_RESET;
|
||||
sConfigOC.OCNIdleState = TIM_OCNIDLESTATE_RESET;
|
||||
if (HAL_TIM_PWM_ConfigChannel(&htim1, &sConfigOC, TIM_CHANNEL_1) != HAL_OK)
|
||||
{
|
||||
Error_Handler();
|
||||
}
|
||||
sBreakDeadTimeConfig.OffStateRunMode = TIM_OSSR_DISABLE;
|
||||
sBreakDeadTimeConfig.OffStateIDLEMode = TIM_OSSI_DISABLE;
|
||||
sBreakDeadTimeConfig.LockLevel = TIM_LOCKLEVEL_OFF;
|
||||
sBreakDeadTimeConfig.DeadTime = 0;
|
||||
sBreakDeadTimeConfig.BreakState = TIM_BREAK_DISABLE;
|
||||
sBreakDeadTimeConfig.BreakPolarity = TIM_BREAKPOLARITY_HIGH;
|
||||
sBreakDeadTimeConfig.AutomaticOutput = TIM_AUTOMATICOUTPUT_DISABLE;
|
||||
if (HAL_TIMEx_ConfigBreakDeadTime(&htim1, &sBreakDeadTimeConfig) != HAL_OK)
|
||||
{
|
||||
Error_Handler();
|
||||
}
|
||||
/* USER CODE BEGIN TIM1_Init 2 */
|
||||
|
||||
/* USER CODE END TIM1_Init 2 */
|
||||
HAL_TIM_MspPostInit(&htim1);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief GPIO Initialization Function
|
||||
* @param None
|
||||
* @retval None
|
||||
*/
|
||||
static void MX_GPIO_Init(void)
|
||||
{
|
||||
/* USER CODE BEGIN MX_GPIO_Init_1 */
|
||||
/* USER CODE END MX_GPIO_Init_1 */
|
||||
|
||||
/* GPIO Ports Clock Enable */
|
||||
__HAL_RCC_GPIOH_CLK_ENABLE();
|
||||
__HAL_RCC_GPIOE_CLK_ENABLE();
|
||||
|
||||
/* USER CODE BEGIN MX_GPIO_Init_2 */
|
||||
/* USER CODE END MX_GPIO_Init_2 */
|
||||
}
|
||||
|
||||
/* USER CODE BEGIN 4 */
|
||||
|
||||
/* USER CODE END 4 */
|
||||
352
Pcb-1-lan9252/Firmware/src/Stm32F4_Encoder.cpp
Executable file
352
Pcb-1-lan9252/Firmware/src/Stm32F4_Encoder.cpp
Executable file
@@ -0,0 +1,352 @@
|
||||
#include <Stm32F4_Encoder.h>
|
||||
|
||||
/*
|
||||
Stm32F4_Encoder.cpp
|
||||
Created on: Nov 20, 2020
|
||||
Author: GoktugH.
|
||||
*/
|
||||
|
||||
Encoder::Encoder()
|
||||
{
|
||||
int unit;
|
||||
}
|
||||
|
||||
void Encoder::eattach(int enco)
|
||||
{
|
||||
}
|
||||
|
||||
void Encoder::attachh(int encoNumber)
|
||||
{
|
||||
eattach(encoNumber);
|
||||
}
|
||||
|
||||
void Encoder::SetCount(enum EncTimer enc, int64_t Counter)
|
||||
{
|
||||
|
||||
if (enc == Tim2)
|
||||
TIM2->CNT = Counter;
|
||||
else if (enc == Tim3)
|
||||
TIM3->CNT = Counter;
|
||||
else if (enc == Tim4)
|
||||
TIM4->CNT = Counter;
|
||||
else if (enc == Tim8)
|
||||
TIM8->CNT = Counter;
|
||||
}
|
||||
uint16_t Encoder::GetCount(enum EncTimer enc)
|
||||
{
|
||||
|
||||
if (enc == Tim2)
|
||||
c = (TIM2->CNT);
|
||||
else if (enc == Tim3)
|
||||
c = (TIM3->CNT);
|
||||
else if (enc == Tim4)
|
||||
c = (TIM4->CNT);
|
||||
else if (enc == Tim8)
|
||||
c = (TIM8->CNT);
|
||||
return c;
|
||||
}
|
||||
|
||||
void GpioConfigPortA(GPIO_TypeDef *GPIOx)
|
||||
{
|
||||
|
||||
uint32_t pinpos = 0x00, pos = 0x00, currentpin = 0x00;
|
||||
|
||||
/* ------------------------- Configure the port pins ---------------- */
|
||||
/*-- GPIO Mode Configuration --*/
|
||||
for (pinpos = 0x00; pinpos < 0x10; pinpos++)
|
||||
{
|
||||
pos = ((uint32_t)0x01) << pinpos;
|
||||
/* Get the port pins position */
|
||||
currentpin = (GPIO_Pin_0 | GPIO_Pin_1 | GPIO_Pin_6 | GPIO_Pin_7) & pos;
|
||||
|
||||
if (currentpin == pos)
|
||||
{
|
||||
GPIOx->MODER &= ~(GPIO_MODER_MODER0 << (pinpos * 2));
|
||||
GPIOx->MODER |= (((uint32_t)GPIO_Mode_AF) << (pinpos * 2));
|
||||
|
||||
if ((GPIO_Mode_AF == GPIO_Mode_OUT) || (GPIO_Mode_AF == GPIO_Mode_AF))
|
||||
{
|
||||
/* Check Speed mode parameters */
|
||||
|
||||
/* Speed mode configuration */
|
||||
GPIOx->OSPEEDR &= ~(GPIO_OSPEEDER_OSPEEDR0 << (pinpos * 2));
|
||||
GPIOx->OSPEEDR |= ((uint32_t)(GPIO_Speed_50MHz) << (pinpos * 2));
|
||||
|
||||
/* Check Output mode parameters */
|
||||
|
||||
/* Output mode configuration*/
|
||||
GPIOx->OTYPER &= ~((GPIO_OTYPER_OT_0) << ((uint16_t)pinpos));
|
||||
GPIOx->OTYPER |= (uint16_t)(((uint16_t)GPIO_OType_PP) << ((uint16_t)pinpos));
|
||||
}
|
||||
|
||||
/* Pull-up Pull down resistor configuration*/
|
||||
GPIOx->PUPDR &= ~(GPIO_PUPDR_PUPDR0 << ((uint16_t)pinpos * 2));
|
||||
GPIOx->PUPDR |= (((uint32_t)GPIO_PuPd_NOPULL) << (pinpos * 2));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void GpioConfigPortC(GPIO_TypeDef *GPIOx)
|
||||
{
|
||||
|
||||
uint32_t pinpos = 0x00, pos = 0x00, currentpin = 0x00;
|
||||
|
||||
/* ------------------------- Configure the port pins ---------------- */
|
||||
/*-- GPIO Mode Configuration --*/
|
||||
for (pinpos = 0x00; pinpos < 0x10; pinpos++)
|
||||
{
|
||||
pos = ((uint32_t)0x01) << pinpos;
|
||||
/* Get the port pins position */
|
||||
currentpin = (GPIO_Pin_6 | GPIO_Pin_7) & pos;
|
||||
|
||||
if (currentpin == pos)
|
||||
{
|
||||
GPIOx->MODER &= ~(GPIO_MODER_MODER0 << (pinpos * 2));
|
||||
GPIOx->MODER |= (((uint32_t)GPIO_Mode_AF) << (pinpos * 2));
|
||||
|
||||
if ((GPIO_Mode_AF == GPIO_Mode_OUT) || (GPIO_Mode_AF == GPIO_Mode_AF))
|
||||
{
|
||||
/* Check Speed mode parameters */
|
||||
|
||||
/* Speed mode configuration */
|
||||
GPIOx->OSPEEDR &= ~(GPIO_OSPEEDER_OSPEEDR0 << (pinpos * 2));
|
||||
GPIOx->OSPEEDR |= ((uint32_t)(GPIO_Speed_50MHz) << (pinpos * 2));
|
||||
|
||||
/* Check Output mode parameters */
|
||||
|
||||
/* Output mode configuration*/
|
||||
GPIOx->OTYPER &= ~((GPIO_OTYPER_OT_0) << ((uint16_t)pinpos));
|
||||
GPIOx->OTYPER |= (uint16_t)(((uint16_t)GPIO_OType_PP) << ((uint16_t)pinpos));
|
||||
}
|
||||
|
||||
/* Pull-up Pull down resistor configuration*/
|
||||
GPIOx->PUPDR &= ~(GPIO_PUPDR_PUPDR0 << ((uint16_t)pinpos * 2));
|
||||
GPIOx->PUPDR |= (((uint32_t)GPIO_PuPd_NOPULL) << (pinpos * 2));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void GpioConfigPortD(GPIO_TypeDef *GPIOx)
|
||||
{
|
||||
|
||||
uint32_t pinpos = 0x00, pos = 0x00, currentpin = 0x00;
|
||||
|
||||
/* ------------------------- Configure the port pins ---------------- */
|
||||
/*-- GPIO Mode Configuration --*/
|
||||
for (pinpos = 0x00; pinpos < 0x10; pinpos++)
|
||||
{
|
||||
pos = ((uint32_t)0x01) << pinpos;
|
||||
/* Get the port pins position */
|
||||
currentpin = (GPIO_Pin_12 | GPIO_Pin_13) & pos;
|
||||
|
||||
if (currentpin == pos)
|
||||
{
|
||||
GPIOx->MODER &= ~(GPIO_MODER_MODER0 << (pinpos * 2));
|
||||
GPIOx->MODER |= (((uint32_t)GPIO_Mode_AF) << (pinpos * 2));
|
||||
|
||||
if ((GPIO_Mode_AF == GPIO_Mode_OUT) || (GPIO_Mode_AF == GPIO_Mode_AF))
|
||||
{
|
||||
/* Check Speed mode parameters */
|
||||
|
||||
/* Speed mode configuration */
|
||||
GPIOx->OSPEEDR &= ~(GPIO_OSPEEDER_OSPEEDR0 << (pinpos * 2));
|
||||
GPIOx->OSPEEDR |= ((uint32_t)(GPIO_Speed_50MHz) << (pinpos * 2));
|
||||
|
||||
/* Check Output mode parameters */
|
||||
|
||||
/* Output mode configuration*/
|
||||
GPIOx->OTYPER &= ~((GPIO_OTYPER_OT_0) << ((uint16_t)pinpos));
|
||||
GPIOx->OTYPER |= (uint16_t)(((uint16_t)GPIO_OType_PP) << ((uint16_t)pinpos));
|
||||
}
|
||||
|
||||
/* Pull-up Pull down resistor configuration*/
|
||||
GPIOx->PUPDR &= ~(GPIO_PUPDR_PUPDR0 << ((uint16_t)pinpos * 2));
|
||||
GPIOx->PUPDR |= (((uint32_t)GPIO_PuPd_NOPULL) << (pinpos * 2));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void TIM_EncoderInterConfig(TIM_TypeDef *TIMx, uint16_t TIM_EncoderMode, uint16_t TIM_IC1Polarity, uint16_t TIM_IC2Polarity)
|
||||
{
|
||||
|
||||
uint16_t tmpsmcr = 0;
|
||||
uint16_t tmpccmr1 = 0;
|
||||
uint16_t tmpccer = 0;
|
||||
|
||||
/* Get the TIMx SMCR register value */
|
||||
tmpsmcr = TIMx->SMCR;
|
||||
|
||||
/* Get the TIMx CCMR1 register value */
|
||||
tmpccmr1 = TIMx->CCMR1;
|
||||
|
||||
/* Get the TIMx CCER register value */
|
||||
tmpccer = TIMx->CCER;
|
||||
|
||||
/* Set the encoder Mode */
|
||||
tmpsmcr &= (uint16_t)~TIM_SMCR_SMS;
|
||||
tmpsmcr |= TIM_EncoderMode;
|
||||
|
||||
/* Select the Capture Compare 1 and the Capture Compare 2 as input */
|
||||
tmpccmr1 &= ((uint16_t)~TIM_CCMR1_CC1S) & ((uint16_t)~TIM_CCMR1_CC2S);
|
||||
tmpccmr1 |= TIM_CCMR1_CC1S_0 | TIM_CCMR1_CC2S_0;
|
||||
|
||||
/* Set the TI1 and the TI2 Polarities */
|
||||
tmpccer &= ((uint16_t)~TIM_CCER_CC1P) & ((uint16_t)~TIM_CCER_CC2P);
|
||||
tmpccer |= (uint16_t)(TIM_IC1Polarity | (uint16_t)(TIM_IC2Polarity << (uint16_t)4));
|
||||
|
||||
/* Write to TIMx SMCR */
|
||||
TIMx->SMCR = tmpsmcr;
|
||||
|
||||
/* Write to TIMx CCMR1 */
|
||||
TIMx->CCMR1 = tmpccmr1;
|
||||
|
||||
/* Write to TIMx CCER */
|
||||
TIMx->CCER = tmpccer;
|
||||
}
|
||||
|
||||
void TIM_TimeBaseStructInit(TIM_TimeBaseInitTypeDef *TIM_TimeBaseInitStruct)
|
||||
{
|
||||
/* Set the default configuration */
|
||||
TIM_TimeBaseInitStruct->TIM_Period = 0xFFFFFFFF;
|
||||
TIM_TimeBaseInitStruct->TIM_Prescaler = 0x0000;
|
||||
TIM_TimeBaseInitStruct->TIM_ClockDivision = TIM_CKD_DIV1;
|
||||
TIM_TimeBaseInitStruct->TIM_CounterMode = TIM_CounterMode_Up;
|
||||
TIM_TimeBaseInitStruct->TIM_RepetitionCounter = 0x0000;
|
||||
}
|
||||
|
||||
void TIM_TimeBaseInit(TIM_TypeDef *TIMx, TIM_TimeBaseInitTypeDef *TIM_TimeBaseInitStruct)
|
||||
{
|
||||
uint16_t tmpcr1 = 0;
|
||||
|
||||
tmpcr1 = TIMx->CR1;
|
||||
|
||||
if ((TIMx == TIM1) || (TIMx == TIM8) ||
|
||||
(TIMx == TIM2) || (TIMx == TIM3) ||
|
||||
(TIMx == TIM4) || (TIMx == TIM5))
|
||||
{
|
||||
/* Select the Counter Mode */
|
||||
tmpcr1 &= (uint16_t)(~(TIM_CR1_DIR | TIM_CR1_CMS));
|
||||
tmpcr1 |= (uint32_t)TIM_TimeBaseInitStruct->TIM_CounterMode;
|
||||
}
|
||||
|
||||
if ((TIMx != TIM6) && (TIMx != TIM7))
|
||||
{
|
||||
/* Set the clock division */
|
||||
tmpcr1 &= (uint16_t)(~TIM_CR1_CKD);
|
||||
tmpcr1 |= (uint32_t)TIM_TimeBaseInitStruct->TIM_ClockDivision;
|
||||
}
|
||||
|
||||
TIMx->CR1 = tmpcr1;
|
||||
|
||||
/* Set the Autoreload value */
|
||||
TIMx->ARR = TIM_TimeBaseInitStruct->TIM_Period;
|
||||
|
||||
/* Set the Prescaler value */
|
||||
TIMx->PSC = TIM_TimeBaseInitStruct->TIM_Prescaler;
|
||||
|
||||
if ((TIMx == TIM1) || (TIMx == TIM8))
|
||||
{
|
||||
/* Set the Repetition Counter value */
|
||||
TIMx->RCR = TIM_TimeBaseInitStruct->TIM_RepetitionCounter;
|
||||
}
|
||||
|
||||
/* Generate an update event to reload the Prescaler
|
||||
and the repetition counter(only for TIM1 and TIM8) value immediatly */
|
||||
TIMx->EGR = TIM_PSCReloadMode_Immediate;
|
||||
}
|
||||
|
||||
TIM_TimeBaseInitTypeDef TIMER_InitStructure;
|
||||
TIM_TimeBaseInitTypeDef TIMER_InitStructureE;
|
||||
TIM_TimeBaseInitTypeDef TIMER_InitStructureEE;
|
||||
TIM_TimeBaseInitTypeDef TIMER_InitStructureEEG;
|
||||
|
||||
void TIM_Cmd(TIM_TypeDef *TIMx, FunctionalState NewState)
|
||||
{
|
||||
|
||||
if (NewState != DISABLE)
|
||||
{
|
||||
/* Enable the TIM Counter */
|
||||
TIMx->CR1 |= TIM_CR1_CEN;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Disable the TIM Counter */
|
||||
TIMx->CR1 &= (uint16_t)~TIM_CR1_CEN;
|
||||
}
|
||||
}
|
||||
void GPIO_PinAF(GPIO_TypeDef *GPIOx, uint16_t GPIO_PinSource, uint8_t GPIO_AF)
|
||||
|
||||
{
|
||||
|
||||
uint32_t temp = 0x00;
|
||||
uint32_t temp_2 = 0x00;
|
||||
|
||||
temp = ((uint32_t)(GPIO_AF) << ((uint32_t)((uint32_t)GPIO_PinSource & (uint32_t)0x07) * 4));
|
||||
GPIOx->AFR[GPIO_PinSource >> 0x03] &= ~((uint32_t)0xF << ((uint32_t)((uint32_t)GPIO_PinSource & (uint32_t)0x07) * 4));
|
||||
temp_2 = GPIOx->AFR[GPIO_PinSource >> 0x03] | temp;
|
||||
GPIOx->AFR[GPIO_PinSource >> 0x03] = temp_2;
|
||||
}
|
||||
|
||||
void rcc_config()
|
||||
{
|
||||
RCC->AHB1ENR |= 0x1; // GPIOA
|
||||
RCC->AHB1ENR |= 0x4; // GPIOC
|
||||
RCC->AHB1ENR |= 0x8; // GPIOD
|
||||
RCC->AHB1ENR |= 0x10; // GPIOE
|
||||
|
||||
RCC->APB1ENR |= 0x20000000; // ENABLE DAC
|
||||
RCC->APB2ENR |= 0x00000002; // APB2 TIM8
|
||||
RCC->APB1ENR |= 0x00000004; // APB1 TIM4
|
||||
RCC->APB1ENR |= 0x00000001; // APB1 TIM2
|
||||
RCC->APB1ENR |= 0x00000002; // APB1 TIM3
|
||||
|
||||
GpioConfigPortA(GPIOA);
|
||||
GpioConfigPortC(GPIOC);
|
||||
GpioConfigPortD(GPIOD);
|
||||
|
||||
GPIO_PinAF(GPIOA, GPIO_PinSource6, GPIO_AF_TIM3);
|
||||
GPIO_PinAF(GPIOA, GPIO_PinSource7, GPIO_AF_TIM3);
|
||||
|
||||
GPIO_PinAF(GPIOC, GPIO_PinSource6, GPIO_AF_TIM8);
|
||||
GPIO_PinAF(GPIOC, GPIO_PinSource7, GPIO_AF_TIM8);
|
||||
|
||||
GPIO_PinAF(GPIOD, GPIO_PinSource12, GPIO_AF_TIM4);
|
||||
GPIO_PinAF(GPIOD, GPIO_PinSource13, GPIO_AF_TIM4);
|
||||
|
||||
GPIO_PinAF(GPIOA, GPIO_PinSource0, GPIO_AF_TIM2);
|
||||
GPIO_PinAF(GPIOA, GPIO_PinSource1, GPIO_AF_TIM2);
|
||||
|
||||
TIM_EncoderInterConfig(TIM8, TIM_EncoderMode_TI12, TIM_ICPolarity_Rising, TIM_ICPolarity_Falling);
|
||||
TIMER_InitStructure.TIM_Period = 65535;
|
||||
TIMER_InitStructure.TIM_CounterMode = TIM_CounterMode_Up | TIM_CounterMode_Down;
|
||||
TIM_TimeBaseInit(TIM8, &TIMER_InitStructure);
|
||||
TIM_TimeBaseStructInit(&TIMER_InitStructure);
|
||||
TIM_Cmd(TIM8, ENABLE);
|
||||
TIM8->CNT = 0;
|
||||
|
||||
TIM_EncoderInterConfig(TIM4, TIM_EncoderMode_TI12, TIM_ICPolarity_Rising, TIM_ICPolarity_Falling);
|
||||
TIMER_InitStructureE.TIM_Period = 65535;
|
||||
TIMER_InitStructureE.TIM_CounterMode = TIM_CounterMode_Up | TIM_CounterMode_Down;
|
||||
TIM_TimeBaseInit(TIM4, &TIMER_InitStructureE);
|
||||
TIM_TimeBaseStructInit(&TIMER_InitStructureE);
|
||||
TIM_Cmd(TIM4, ENABLE);
|
||||
TIM4->CNT = 0;
|
||||
|
||||
TIM_EncoderInterConfig(TIM2, TIM_EncoderMode_TI12, TIM_ICPolarity_Rising, TIM_ICPolarity_Falling);
|
||||
TIMER_InitStructureEE.TIM_Period = 65535;
|
||||
TIMER_InitStructureEE.TIM_CounterMode = TIM_CounterMode_Up | TIM_CounterMode_Down;
|
||||
TIM_TimeBaseInit(TIM2, &TIMER_InitStructureEE);
|
||||
TIM_TimeBaseStructInit(&TIMER_InitStructureEE);
|
||||
TIM_Cmd(TIM2, ENABLE);
|
||||
|
||||
TIM2->CNT = 0;
|
||||
|
||||
TIM_EncoderInterConfig(TIM3, TIM_EncoderMode_TI12, TIM_ICPolarity_Rising, TIM_ICPolarity_Falling);
|
||||
TIMER_InitStructureEEG.TIM_Period = 65535;
|
||||
TIMER_InitStructureEEG.TIM_CounterMode = TIM_CounterMode_Up | TIM_CounterMode_Down;
|
||||
TIM_TimeBaseInit(TIM3, &TIMER_InitStructureEEG);
|
||||
TIM_TimeBaseStructInit(&TIMER_InitStructureEEG);
|
||||
TIM_Cmd(TIM3, ENABLE);
|
||||
|
||||
TIM3->CNT = 0;
|
||||
}
|
||||
154
Pcb-1-lan9252/Firmware/src/main.cpp
Executable file
154
Pcb-1-lan9252/Firmware/src/main.cpp
Executable file
@@ -0,0 +1,154 @@
|
||||
#include <Arduino.h>
|
||||
|
||||
#include <stdio.h>
|
||||
extern "C"
|
||||
{
|
||||
#include "ecat_slv.h"
|
||||
#include "utypes.h"
|
||||
};
|
||||
#include <CircularBuffer.h>
|
||||
#define RINGBUFFERLEN 101
|
||||
CircularBuffer<double_t, RINGBUFFERLEN> Pos;
|
||||
CircularBuffer<uint32_t, RINGBUFFERLEN> TDelta;
|
||||
|
||||
int64_t PreviousEncoderCounterValue = 0;
|
||||
int64_t unwrap_encoder(uint16_t in, int64_t *prev);
|
||||
#include <Stm32F4_Encoder.h>
|
||||
Encoder EncoderInit;
|
||||
Encoder *encP = &EncoderInit;
|
||||
|
||||
// #include "Stepper.h"
|
||||
#define INDEX_PIN PA2
|
||||
HardwareSerial Serial1(PA10, PA9);
|
||||
_Objects Obj;
|
||||
|
||||
void indexPulse(void);
|
||||
double PosScaleRes = 1.0;
|
||||
uint32_t CurPosScale = 1;
|
||||
uint8_t OldLatchCEnable = 0;
|
||||
volatile uint8_t indexPulseFired = 0;
|
||||
uint32_t nFires = 0;
|
||||
volatile uint8_t pleaseZeroTheCounter = 0;
|
||||
uint32_t PrevTime = 0, Prev2Time = 0;
|
||||
|
||||
void cb_set_outputs(void) // Master outputs gets here, slave inputs, first operation
|
||||
{
|
||||
if (Obj.IndexLatchEnable && !OldLatchCEnable) // Should only happen first time IndexCEnable is set
|
||||
{
|
||||
pleaseZeroTheCounter = 1;
|
||||
}
|
||||
OldLatchCEnable = Obj.IndexLatchEnable;
|
||||
|
||||
if (CurPosScale != Obj.EncPosScale && Obj.EncPosScale != 0)
|
||||
{
|
||||
CurPosScale = Obj.EncPosScale;
|
||||
PosScaleRes = 1.0 / double(CurPosScale);
|
||||
}
|
||||
}
|
||||
|
||||
void cb_get_inputs(void) // Set Master inputs, slave outputs, last operation
|
||||
{
|
||||
Obj.IndexStatus = 0;
|
||||
if (indexPulseFired)
|
||||
{
|
||||
Obj.IndexStatus = 1;
|
||||
indexPulseFired = 0;
|
||||
nFires++;
|
||||
PreviousEncoderCounterValue = 0;
|
||||
}
|
||||
uint64_t now = micros(); // Exploring the cycle times
|
||||
Obj.DiffT = now - Prev2Time;
|
||||
Prev2Time = PrevTime;
|
||||
PrevTime = now;
|
||||
|
||||
int64_t pos = unwrap_encoder(TIM2->CNT, &PreviousEncoderCounterValue);
|
||||
double CurPos = pos * PosScaleRes;
|
||||
Obj.EncPos = CurPos;
|
||||
|
||||
double diffT = 0;
|
||||
double diffPos = 0;
|
||||
TDelta.push(ESCvar.Time); // Running average over the length of the circular buffer
|
||||
Pos.push(CurPos);
|
||||
if (Pos.size() >= 2)
|
||||
{
|
||||
diffT = 1.0e-9 * (TDelta.last() - TDelta.first()); // Time is in nanoseconds
|
||||
diffPos = fabs(Pos.last() - Pos.first());
|
||||
}
|
||||
Obj.EncFrequency = diffT != 0 ? diffPos / diffT : 0.0; // Revolutions per second
|
||||
|
||||
Obj.IndexByte = digitalRead(INDEX_PIN);
|
||||
if (Obj.IndexByte)
|
||||
Serial1.printf("IS 1\n");
|
||||
}
|
||||
|
||||
static esc_cfg_t config =
|
||||
{
|
||||
.user_arg = NULL,
|
||||
.use_interrupt = 0,
|
||||
.watchdog_cnt = 150,
|
||||
.set_defaults_hook = NULL,
|
||||
.pre_state_change_hook = NULL,
|
||||
.post_state_change_hook = NULL,
|
||||
.application_hook = NULL, // StepGen,
|
||||
.safeoutput_override = NULL,
|
||||
.pre_object_download_hook = NULL,
|
||||
.post_object_download_hook = NULL,
|
||||
.rxpdo_override = NULL,
|
||||
.txpdo_override = NULL,
|
||||
.esc_hw_interrupt_enable = NULL,
|
||||
.esc_hw_interrupt_disable = NULL,
|
||||
.esc_hw_eep_handler = NULL,
|
||||
.esc_check_dc_handler = NULL,
|
||||
};
|
||||
|
||||
void setup(void)
|
||||
{
|
||||
Serial1.begin(115200);
|
||||
rcc_config();
|
||||
|
||||
// Set starting count value
|
||||
EncoderInit.SetCount(Tim2, 0);
|
||||
// EncoderInit.SetCount(Tim3, 0);
|
||||
// EncoderInit.SetCount(Tim4, 0);
|
||||
// EncoderInit.SetCount(Tim8, 0);
|
||||
|
||||
ecat_slv_init(&config);
|
||||
attachInterrupt(digitalPinToInterrupt(INDEX_PIN), indexPulse, RISING); // Always when Index triggered
|
||||
}
|
||||
|
||||
void loop(void)
|
||||
{
|
||||
ESCvar.PrevTime = ESCvar.Time;
|
||||
ecat_slv();
|
||||
}
|
||||
|
||||
#define ONE_PERIOD 65536
|
||||
#define HALF_PERIOD 32768
|
||||
|
||||
int64_t unwrap_encoder(uint16_t in, int64_t *prev)
|
||||
{
|
||||
int64_t c64 = (int32_t)in - HALF_PERIOD; // remove half period to determine (+/-) sign of the wrap
|
||||
int64_t dif = (c64 - *prev); // core concept: prev + (current - prev) = current
|
||||
|
||||
// wrap difference from -HALF_PERIOD to HALF_PERIOD. modulo prevents differences after the wrap from having an incorrect result
|
||||
int64_t mod_dif = ((dif + HALF_PERIOD) % ONE_PERIOD) - HALF_PERIOD;
|
||||
if (dif < -HALF_PERIOD)
|
||||
mod_dif += ONE_PERIOD; // account for mod of negative number behavior in C
|
||||
|
||||
int64_t unwrapped = *prev + mod_dif;
|
||||
*prev = unwrapped; // load previous value
|
||||
|
||||
return unwrapped + HALF_PERIOD; // remove the shift we applied at the beginning, and return
|
||||
}
|
||||
|
||||
void indexPulse(void)
|
||||
{
|
||||
if (pleaseZeroTheCounter)
|
||||
{
|
||||
TIM2->CNT = 0;
|
||||
indexPulseFired = 1;
|
||||
Pos.clear();
|
||||
TDelta.clear();
|
||||
pleaseZeroTheCounter = 0;
|
||||
}
|
||||
}
|
||||
11
Pcb-1-lan9252/Firmware/test/README
Executable file
11
Pcb-1-lan9252/Firmware/test/README
Executable file
@@ -0,0 +1,11 @@
|
||||
|
||||
This directory is intended for PlatformIO Test Runner and project tests.
|
||||
|
||||
Unit Testing is a software testing method by which individual units of
|
||||
source code, sets of one or more MCU program modules together with associated
|
||||
control data, usage procedures, and operating procedures, are tested to
|
||||
determine whether they are fit for use. Unit testing finds problems early
|
||||
in the development cycle.
|
||||
|
||||
More information about PlatformIO Unit Testing:
|
||||
- https://docs.platformio.org/en/latest/advanced/unit-testing/index.html
|
||||
2
Pcb-1-lan9252/Kicad/.gitignore
vendored
Normal file
2
Pcb-1-lan9252/Kicad/.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
Ethercat-stm32-backups
|
||||
*.lck
|
||||
3
Pcb-1-lan9252/Kicad/Ethercat-stm32/.gitignore
vendored
Normal file
3
Pcb-1-lan9252/Kicad/Ethercat-stm32/.gitignore
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
fp-info-cache
|
||||
Ethercat-stm32-backup*
|
||||
*.lck
|
||||
53691
Pcb-1-lan9252/Kicad/Ethercat-stm32/Ethercat-stm32.kicad_pcb
Executable file
53691
Pcb-1-lan9252/Kicad/Ethercat-stm32/Ethercat-stm32.kicad_pcb
Executable file
File diff suppressed because it is too large
Load Diff
77
Pcb-1-lan9252/Kicad/Ethercat-stm32/Ethercat-stm32.kicad_prl
Executable file
77
Pcb-1-lan9252/Kicad/Ethercat-stm32/Ethercat-stm32.kicad_prl
Executable file
@@ -0,0 +1,77 @@
|
||||
{
|
||||
"board": {
|
||||
"active_layer": 37,
|
||||
"active_layer_preset": "",
|
||||
"auto_track_width": true,
|
||||
"hidden_netclasses": [],
|
||||
"hidden_nets": [],
|
||||
"high_contrast_mode": 0,
|
||||
"net_color_mode": 1,
|
||||
"opacity": {
|
||||
"images": 0.6,
|
||||
"pads": 1.0,
|
||||
"tracks": 1.0,
|
||||
"vias": 1.0,
|
||||
"zones": 0.6
|
||||
},
|
||||
"selection_filter": {
|
||||
"dimensions": true,
|
||||
"footprints": true,
|
||||
"graphics": true,
|
||||
"keepouts": true,
|
||||
"lockedItems": false,
|
||||
"otherItems": true,
|
||||
"pads": true,
|
||||
"text": true,
|
||||
"tracks": true,
|
||||
"vias": true,
|
||||
"zones": true
|
||||
},
|
||||
"visible_items": [
|
||||
0,
|
||||
1,
|
||||
2,
|
||||
3,
|
||||
4,
|
||||
5,
|
||||
8,
|
||||
9,
|
||||
10,
|
||||
11,
|
||||
12,
|
||||
13,
|
||||
15,
|
||||
16,
|
||||
17,
|
||||
18,
|
||||
19,
|
||||
20,
|
||||
21,
|
||||
22,
|
||||
23,
|
||||
24,
|
||||
25,
|
||||
26,
|
||||
27,
|
||||
28,
|
||||
29,
|
||||
30,
|
||||
32,
|
||||
33,
|
||||
34,
|
||||
35,
|
||||
36,
|
||||
39,
|
||||
40
|
||||
],
|
||||
"visible_layers": "002202a_00000001",
|
||||
"zone_display_mode": 0
|
||||
},
|
||||
"meta": {
|
||||
"filename": "Ethercat-stm32.kicad_prl",
|
||||
"version": 3
|
||||
},
|
||||
"project": {
|
||||
"files": []
|
||||
}
|
||||
}
|
||||
493
Pcb-1-lan9252/Kicad/Ethercat-stm32/Ethercat-stm32.kicad_pro
Executable file
493
Pcb-1-lan9252/Kicad/Ethercat-stm32/Ethercat-stm32.kicad_pro
Executable file
@@ -0,0 +1,493 @@
|
||||
{
|
||||
"board": {
|
||||
"3dviewports": [],
|
||||
"design_settings": {
|
||||
"defaults": {
|
||||
"board_outline_line_width": 0.09999999999999999,
|
||||
"copper_line_width": 0.19999999999999998,
|
||||
"copper_text_italic": false,
|
||||
"copper_text_size_h": 1.5,
|
||||
"copper_text_size_v": 1.5,
|
||||
"copper_text_thickness": 0.3,
|
||||
"copper_text_upright": false,
|
||||
"courtyard_line_width": 0.049999999999999996,
|
||||
"dimension_precision": 4,
|
||||
"dimension_units": 3,
|
||||
"dimensions": {
|
||||
"arrow_length": 1270000,
|
||||
"extension_offset": 500000,
|
||||
"keep_text_aligned": true,
|
||||
"suppress_zeroes": false,
|
||||
"text_position": 0,
|
||||
"units_format": 1
|
||||
},
|
||||
"fab_line_width": 0.09999999999999999,
|
||||
"fab_text_italic": false,
|
||||
"fab_text_size_h": 1.0,
|
||||
"fab_text_size_v": 1.0,
|
||||
"fab_text_thickness": 0.15,
|
||||
"fab_text_upright": false,
|
||||
"other_line_width": 0.15,
|
||||
"other_text_italic": false,
|
||||
"other_text_size_h": 1.0,
|
||||
"other_text_size_v": 1.0,
|
||||
"other_text_thickness": 0.15,
|
||||
"other_text_upright": false,
|
||||
"pads": {
|
||||
"drill": 0.762,
|
||||
"height": 1.524,
|
||||
"width": 1.524
|
||||
},
|
||||
"silk_line_width": 0.15,
|
||||
"silk_text_italic": false,
|
||||
"silk_text_size_h": 1.0,
|
||||
"silk_text_size_v": 1.0,
|
||||
"silk_text_thickness": 0.15,
|
||||
"silk_text_upright": false,
|
||||
"zones": {
|
||||
"min_clearance": 0.5
|
||||
}
|
||||
},
|
||||
"diff_pair_dimensions": [],
|
||||
"drc_exclusions": [],
|
||||
"meta": {
|
||||
"version": 2
|
||||
},
|
||||
"rule_severities": {
|
||||
"annular_width": "error",
|
||||
"clearance": "error",
|
||||
"connection_width": "warning",
|
||||
"copper_edge_clearance": "error",
|
||||
"copper_sliver": "warning",
|
||||
"courtyards_overlap": "error",
|
||||
"diff_pair_gap_out_of_range": "error",
|
||||
"diff_pair_uncoupled_length_too_long": "error",
|
||||
"drill_out_of_range": "error",
|
||||
"duplicate_footprints": "warning",
|
||||
"extra_footprint": "warning",
|
||||
"footprint": "error",
|
||||
"footprint_type_mismatch": "ignore",
|
||||
"hole_clearance": "error",
|
||||
"hole_near_hole": "error",
|
||||
"invalid_outline": "error",
|
||||
"isolated_copper": "warning",
|
||||
"item_on_disabled_layer": "error",
|
||||
"items_not_allowed": "error",
|
||||
"length_out_of_range": "error",
|
||||
"lib_footprint_issues": "warning",
|
||||
"lib_footprint_mismatch": "warning",
|
||||
"malformed_courtyard": "error",
|
||||
"microvia_drill_out_of_range": "error",
|
||||
"missing_courtyard": "ignore",
|
||||
"missing_footprint": "warning",
|
||||
"net_conflict": "warning",
|
||||
"npth_inside_courtyard": "ignore",
|
||||
"padstack": "warning",
|
||||
"pth_inside_courtyard": "ignore",
|
||||
"shorting_items": "error",
|
||||
"silk_edge_clearance": "warning",
|
||||
"silk_over_copper": "warning",
|
||||
"silk_overlap": "warning",
|
||||
"skew_out_of_range": "error",
|
||||
"solder_mask_bridge": "error",
|
||||
"starved_thermal": "error",
|
||||
"text_height": "warning",
|
||||
"text_thickness": "warning",
|
||||
"through_hole_pad_without_hole": "error",
|
||||
"too_many_vias": "error",
|
||||
"track_dangling": "warning",
|
||||
"track_width": "error",
|
||||
"tracks_crossing": "error",
|
||||
"unconnected_items": "error",
|
||||
"unresolved_variable": "error",
|
||||
"via_dangling": "warning",
|
||||
"zones_intersect": "error"
|
||||
},
|
||||
"rules": {
|
||||
"max_error": 0.005,
|
||||
"min_clearance": 0.0,
|
||||
"min_connection": 0.0,
|
||||
"min_copper_edge_clearance": 0.0,
|
||||
"min_hole_clearance": 0.25,
|
||||
"min_hole_to_hole": 0.25,
|
||||
"min_microvia_diameter": 0.19999999999999998,
|
||||
"min_microvia_drill": 0.09999999999999999,
|
||||
"min_resolved_spokes": 2,
|
||||
"min_silk_clearance": 0.0,
|
||||
"min_text_height": 0.7999999999999999,
|
||||
"min_text_thickness": 0.08,
|
||||
"min_through_hole_diameter": 0.3,
|
||||
"min_track_width": 0.0,
|
||||
"min_via_annular_width": 0.09999999999999999,
|
||||
"min_via_diameter": 0.5,
|
||||
"solder_mask_clearance": 0.0,
|
||||
"solder_mask_min_width": 0.0,
|
||||
"solder_mask_to_copper_clearance": 0.0,
|
||||
"use_height_for_length_calcs": true
|
||||
},
|
||||
"teardrop_options": [
|
||||
{
|
||||
"td_allow_use_two_tracks": true,
|
||||
"td_curve_segcount": 5,
|
||||
"td_on_pad_in_zone": false,
|
||||
"td_onpadsmd": true,
|
||||
"td_onroundshapesonly": false,
|
||||
"td_ontrackend": false,
|
||||
"td_onviapad": true
|
||||
}
|
||||
],
|
||||
"teardrop_parameters": [
|
||||
{
|
||||
"td_curve_segcount": 0,
|
||||
"td_height_ratio": 1.0,
|
||||
"td_length_ratio": 0.5,
|
||||
"td_maxheight": 2.0,
|
||||
"td_maxlen": 1.0,
|
||||
"td_target_name": "td_round_shape",
|
||||
"td_width_to_size_filter_ratio": 0.9
|
||||
},
|
||||
{
|
||||
"td_curve_segcount": 0,
|
||||
"td_height_ratio": 1.0,
|
||||
"td_length_ratio": 0.5,
|
||||
"td_maxheight": 2.0,
|
||||
"td_maxlen": 1.0,
|
||||
"td_target_name": "td_rect_shape",
|
||||
"td_width_to_size_filter_ratio": 0.9
|
||||
},
|
||||
{
|
||||
"td_curve_segcount": 0,
|
||||
"td_height_ratio": 1.0,
|
||||
"td_length_ratio": 0.5,
|
||||
"td_maxheight": 2.0,
|
||||
"td_maxlen": 1.0,
|
||||
"td_target_name": "td_track_end",
|
||||
"td_width_to_size_filter_ratio": 0.9
|
||||
}
|
||||
],
|
||||
"track_widths": [],
|
||||
"via_dimensions": [],
|
||||
"zones_allow_external_fillets": false
|
||||
},
|
||||
"layer_presets": [],
|
||||
"viewports": []
|
||||
},
|
||||
"boards": [],
|
||||
"cvpcb": {
|
||||
"equivalence_files": []
|
||||
},
|
||||
"erc": {
|
||||
"erc_exclusions": [],
|
||||
"meta": {
|
||||
"version": 0
|
||||
},
|
||||
"pin_map": [
|
||||
[
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
1,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
2
|
||||
],
|
||||
[
|
||||
0,
|
||||
2,
|
||||
0,
|
||||
1,
|
||||
0,
|
||||
0,
|
||||
1,
|
||||
0,
|
||||
2,
|
||||
2,
|
||||
2,
|
||||
2
|
||||
],
|
||||
[
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
1,
|
||||
0,
|
||||
1,
|
||||
0,
|
||||
1,
|
||||
2
|
||||
],
|
||||
[
|
||||
0,
|
||||
1,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
1,
|
||||
1,
|
||||
2,
|
||||
1,
|
||||
1,
|
||||
2
|
||||
],
|
||||
[
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
1,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
2
|
||||
],
|
||||
[
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
2
|
||||
],
|
||||
[
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
0,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
2
|
||||
],
|
||||
[
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
1,
|
||||
0,
|
||||
0,
|
||||
1,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
2
|
||||
],
|
||||
[
|
||||
0,
|
||||
2,
|
||||
1,
|
||||
2,
|
||||
0,
|
||||
0,
|
||||
1,
|
||||
0,
|
||||
2,
|
||||
2,
|
||||
2,
|
||||
2
|
||||
],
|
||||
[
|
||||
0,
|
||||
2,
|
||||
0,
|
||||
1,
|
||||
0,
|
||||
0,
|
||||
1,
|
||||
0,
|
||||
2,
|
||||
0,
|
||||
0,
|
||||
2
|
||||
],
|
||||
[
|
||||
0,
|
||||
2,
|
||||
1,
|
||||
1,
|
||||
0,
|
||||
0,
|
||||
1,
|
||||
0,
|
||||
2,
|
||||
0,
|
||||
0,
|
||||
2
|
||||
],
|
||||
[
|
||||
2,
|
||||
2,
|
||||
2,
|
||||
2,
|
||||
2,
|
||||
2,
|
||||
2,
|
||||
2,
|
||||
2,
|
||||
2,
|
||||
2,
|
||||
2
|
||||
]
|
||||
],
|
||||
"rule_severities": {
|
||||
"bus_definition_conflict": "error",
|
||||
"bus_entry_needed": "error",
|
||||
"bus_to_bus_conflict": "error",
|
||||
"bus_to_net_conflict": "error",
|
||||
"conflicting_netclasses": "error",
|
||||
"different_unit_footprint": "error",
|
||||
"different_unit_net": "error",
|
||||
"duplicate_reference": "error",
|
||||
"duplicate_sheet_names": "error",
|
||||
"endpoint_off_grid": "warning",
|
||||
"extra_units": "error",
|
||||
"global_label_dangling": "warning",
|
||||
"hier_label_mismatch": "error",
|
||||
"label_dangling": "error",
|
||||
"lib_symbol_issues": "warning",
|
||||
"missing_bidi_pin": "warning",
|
||||
"missing_input_pin": "warning",
|
||||
"missing_power_pin": "error",
|
||||
"missing_unit": "warning",
|
||||
"multiple_net_names": "warning",
|
||||
"net_not_bus_member": "warning",
|
||||
"no_connect_connected": "warning",
|
||||
"no_connect_dangling": "warning",
|
||||
"pin_not_connected": "error",
|
||||
"pin_not_driven": "error",
|
||||
"pin_to_pin": "warning",
|
||||
"power_pin_not_driven": "error",
|
||||
"similar_labels": "warning",
|
||||
"simulation_model_issue": "ignore",
|
||||
"unannotated": "error",
|
||||
"unit_value_mismatch": "error",
|
||||
"unresolved_variable": "error",
|
||||
"wire_dangling": "error"
|
||||
}
|
||||
},
|
||||
"libraries": {
|
||||
"pinned_footprint_libs": [],
|
||||
"pinned_symbol_libs": []
|
||||
},
|
||||
"meta": {
|
||||
"filename": "Ethercat-stm32.kicad_pro",
|
||||
"version": 1
|
||||
},
|
||||
"net_settings": {
|
||||
"classes": [
|
||||
{
|
||||
"bus_width": 12,
|
||||
"clearance": 0.2,
|
||||
"diff_pair_gap": 0.25,
|
||||
"diff_pair_via_gap": 0.25,
|
||||
"diff_pair_width": 0.2,
|
||||
"line_style": 0,
|
||||
"microvia_diameter": 0.3,
|
||||
"microvia_drill": 0.1,
|
||||
"name": "Default",
|
||||
"pcb_color": "rgba(0, 0, 0, 0.000)",
|
||||
"schematic_color": "rgba(0, 0, 0, 0.000)",
|
||||
"track_width": 0.25,
|
||||
"via_diameter": 0.8,
|
||||
"via_drill": 0.4,
|
||||
"wire_width": 6
|
||||
}
|
||||
],
|
||||
"meta": {
|
||||
"version": 3
|
||||
},
|
||||
"net_colors": null,
|
||||
"netclass_assignments": null,
|
||||
"netclass_patterns": []
|
||||
},
|
||||
"pcbnew": {
|
||||
"last_paths": {
|
||||
"gencad": "",
|
||||
"idf": "",
|
||||
"netlist": "C:/Program Files/KiCad/7.0/",
|
||||
"specctra_dsn": "Ethercat-stm32.dsn",
|
||||
"step": "",
|
||||
"vrml": ""
|
||||
},
|
||||
"page_layout_descr_file": ""
|
||||
},
|
||||
"schematic": {
|
||||
"annotate_start_num": 0,
|
||||
"drawing": {
|
||||
"dashed_lines_dash_length_ratio": 12.0,
|
||||
"dashed_lines_gap_length_ratio": 3.0,
|
||||
"default_line_thickness": 6.0,
|
||||
"default_text_size": 50.0,
|
||||
"field_names": [],
|
||||
"intersheets_ref_own_page": false,
|
||||
"intersheets_ref_prefix": "",
|
||||
"intersheets_ref_short": false,
|
||||
"intersheets_ref_show": false,
|
||||
"intersheets_ref_suffix": "",
|
||||
"junction_size_choice": 3,
|
||||
"label_size_ratio": 0.375,
|
||||
"pin_symbol_size": 25.0,
|
||||
"text_offset_ratio": 0.15
|
||||
},
|
||||
"legacy_lib_dir": "",
|
||||
"legacy_lib_list": [],
|
||||
"meta": {
|
||||
"version": 1
|
||||
},
|
||||
"net_format_name": "",
|
||||
"page_layout_descr_file": "",
|
||||
"plot_directory": "",
|
||||
"spice_current_sheet_as_root": false,
|
||||
"spice_external_command": "spice \"%I\"",
|
||||
"spice_model_current_sheet_as_root": true,
|
||||
"spice_save_all_currents": false,
|
||||
"spice_save_all_voltages": false,
|
||||
"subpart_first_id": 65,
|
||||
"subpart_id_separator": 0
|
||||
},
|
||||
"sheets": [
|
||||
[
|
||||
"5597aedc-b607-407f-bbfd-31b3b298ecb1",
|
||||
""
|
||||
],
|
||||
[
|
||||
"a120273a-c1ae-42b3-935d-01f789f654a3",
|
||||
"LAN9252"
|
||||
],
|
||||
[
|
||||
"650f1ee4-2ce7-4e9d-a70d-f9d8defa5d03",
|
||||
"LAN9252_diverse"
|
||||
],
|
||||
[
|
||||
"d564400f-40ba-4aca-9c2a-14ec52a8353b",
|
||||
"STM32F4"
|
||||
],
|
||||
[
|
||||
"0a376a6c-0f15-42f8-81f6-3a55619be267",
|
||||
"Peripherals"
|
||||
]
|
||||
],
|
||||
"text_variables": {}
|
||||
}
|
||||
87
Pcb-1-lan9252/Kicad/Ethercat-stm32/Ethercat-stm32.kicad_sch
Executable file
87
Pcb-1-lan9252/Kicad/Ethercat-stm32/Ethercat-stm32.kicad_sch
Executable file
@@ -0,0 +1,87 @@
|
||||
(kicad_sch (version 20230121) (generator eeschema)
|
||||
|
||||
(uuid 5597aedc-b607-407f-bbfd-31b3b298ecb1)
|
||||
|
||||
(paper "A3")
|
||||
|
||||
(lib_symbols
|
||||
)
|
||||
|
||||
|
||||
(text "Huvudsida" (at 162.56 85.09 0)
|
||||
(effects (font (size 1.27 1.27)) (justify left bottom))
|
||||
(uuid adf2be63-7ec7-44be-837f-901ddbc80717)
|
||||
)
|
||||
|
||||
(sheet (at 144.78 224.79) (size 71.12 16.51) (fields_autoplaced)
|
||||
(stroke (width 0.1524) (type solid))
|
||||
(fill (color 0 0 0 0.0000))
|
||||
(uuid 0a376a6c-0f15-42f8-81f6-3a55619be267)
|
||||
(property "Sheetname" "Peripherals" (at 144.78 224.0784 0)
|
||||
(effects (font (size 1.27 1.27)) (justify left bottom))
|
||||
)
|
||||
(property "Sheetfile" "peripherals.kicad_sch" (at 144.78 241.8846 0)
|
||||
(effects (font (size 1.27 1.27)) (justify left top))
|
||||
)
|
||||
(instances
|
||||
(project "Ethercat-stm32"
|
||||
(path "/5597aedc-b607-407f-bbfd-31b3b298ecb1" (page "5"))
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
(sheet (at 46.99 224.79) (size 82.55 17.78) (fields_autoplaced)
|
||||
(stroke (width 0.1524) (type solid))
|
||||
(fill (color 0 0 0 0.0000))
|
||||
(uuid 650f1ee4-2ce7-4e9d-a70d-f9d8defa5d03)
|
||||
(property "Sheetname" "LAN9252_diverse" (at 46.99 224.0784 0)
|
||||
(effects (font (size 1.27 1.27)) (justify left bottom))
|
||||
)
|
||||
(property "Sheetfile" "LAN9252_diverse.kicad_sch" (at 46.99 243.1546 0)
|
||||
(effects (font (size 1.27 1.27)) (justify left top))
|
||||
)
|
||||
(instances
|
||||
(project "Ethercat-stm32"
|
||||
(path "/5597aedc-b607-407f-bbfd-31b3b298ecb1" (page "3"))
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
(sheet (at 46.99 200.66) (size 82.55 17.78) (fields_autoplaced)
|
||||
(stroke (width 0.1524) (type solid))
|
||||
(fill (color 0 0 0 0.0000))
|
||||
(uuid a120273a-c1ae-42b3-935d-01f789f654a3)
|
||||
(property "Sheetname" "LAN9252" (at 46.99 199.9484 0)
|
||||
(effects (font (size 1.27 1.27)) (justify left bottom))
|
||||
)
|
||||
(property "Sheetfile" "LAN9252.kicad_sch" (at 46.99 219.0246 0)
|
||||
(effects (font (size 1.27 1.27)) (justify left top))
|
||||
)
|
||||
(instances
|
||||
(project "Ethercat-stm32"
|
||||
(path "/5597aedc-b607-407f-bbfd-31b3b298ecb1" (page "2"))
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
(sheet (at 142.24 200.66) (size 74.93 17.78) (fields_autoplaced)
|
||||
(stroke (width 0.1524) (type solid))
|
||||
(fill (color 0 0 0 0.0000))
|
||||
(uuid d564400f-40ba-4aca-9c2a-14ec52a8353b)
|
||||
(property "Sheetname" "STM32F4" (at 142.24 199.9484 0)
|
||||
(effects (font (size 1.27 1.27)) (justify left bottom))
|
||||
)
|
||||
(property "Sheetfile" "STM32F4.kicad_sch" (at 142.24 219.0246 0)
|
||||
(effects (font (size 1.27 1.27)) (justify left top))
|
||||
)
|
||||
(instances
|
||||
(project "Ethercat-stm32"
|
||||
(path "/5597aedc-b607-407f-bbfd-31b3b298ecb1" (page "4"))
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
(sheet_instances
|
||||
(path "/" (page "1"))
|
||||
)
|
||||
)
|
||||
2889
Pcb-1-lan9252/Kicad/Ethercat-stm32/Ethercat-stm32.xml
Executable file
2889
Pcb-1-lan9252/Kicad/Ethercat-stm32/Ethercat-stm32.xml
Executable file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,32 @@
|
||||
(footprint "2.8 TFT 320x240 led with sd and touch" (version 20221018) (generator pcbnew)
|
||||
(layer "F.Cu")
|
||||
(attr smd)
|
||||
(fp_text reference "REF**" (at -33.782 -7.112 unlocked) (layer "F.SilkS")
|
||||
(effects (font (size 1 1) (thickness 0.15)))
|
||||
(tstamp 1dd33759-143b-476c-bb42-c5e5d445a2fc)
|
||||
)
|
||||
(fp_text value "2.8 TFT 320x240 led with sd and touch" (at -36.83 -0.254 90 unlocked) (layer "F.Fab")
|
||||
(effects (font (size 1 1) (thickness 0.15)))
|
||||
(tstamp 1ce2bf2b-b61f-46da-a1cb-06e193ac5296)
|
||||
)
|
||||
(fp_rect (start -43 25) (end 43 -25)
|
||||
(stroke (width 0.12) (type solid)) (fill none) (layer "F.SilkS") (tstamp 9717e78c-245e-4b0a-ba7e-ef5374b0c38c))
|
||||
(pad "1" thru_hole roundrect (at 40.005 3.81 180) (size 2.286 1.524) (drill 0.9) (layers "*.Cu" "*.Mask") (roundrect_rratio 0.25) (tstamp 21623806-8193-49aa-8e86-f5d741ee3217))
|
||||
(pad "2" thru_hole roundrect (at 40.005 1.27 180) (size 2.286 1.524) (drill 0.9) (layers "*.Cu" "*.Mask") (roundrect_rratio 0.25) (tstamp 1c8efd92-4e91-4579-bd5c-5fab3c9a7156))
|
||||
(pad "3" thru_hole roundrect (at 40.005 -1.27 180) (size 2.286 1.524) (drill 0.9) (layers "*.Cu" "*.Mask") (roundrect_rratio 0.25) (tstamp c0b8101a-448b-46a1-9a8a-2ff22c1b14db))
|
||||
(pad "4" thru_hole roundrect (at 40.005 -3.81 180) (size 2.286 1.524) (drill 0.9) (layers "*.Cu" "*.Mask") (roundrect_rratio 0.25) (tstamp a34698d6-085b-485a-ba4e-0184bb2cbfd8))
|
||||
(pad "5" thru_hole roundrect (at -40.3 16.51 180) (size 2.286 1.524) (drill 0.9) (layers "*.Cu" "*.Mask") (roundrect_rratio 0.25) (tstamp d099de14-88e2-441e-a73e-ff95baeb8e26))
|
||||
(pad "6" thru_hole roundrect (at -40.3 13.97 180) (size 2.286 1.524) (drill 0.9) (layers "*.Cu" "*.Mask") (roundrect_rratio 0.25) (tstamp 59a1ecf0-8d7b-4db7-8aa7-b858a90fc7be))
|
||||
(pad "7" thru_hole roundrect (at -40.3 11.43 180) (size 2.286 1.524) (drill 0.9) (layers "*.Cu" "*.Mask") (roundrect_rratio 0.25) (tstamp b96d741a-8459-4bdc-b8c3-996255ed9d94))
|
||||
(pad "8" thru_hole roundrect (at -40.3 8.89 180) (size 2.286 1.524) (drill 0.9) (layers "*.Cu" "*.Mask") (roundrect_rratio 0.25) (tstamp 378396b7-816f-412c-b398-2bfbec7f6a55))
|
||||
(pad "9" thru_hole roundrect (at -40.3 6.35 180) (size 2.286 1.524) (drill 0.9) (layers "*.Cu" "*.Mask") (roundrect_rratio 0.25) (tstamp 3f510b37-3d66-4b1f-a522-569a3c2d8bbf))
|
||||
(pad "10" thru_hole roundrect (at -40.3 3.81 180) (size 2.286 1.524) (drill 0.9) (layers "*.Cu" "*.Mask") (roundrect_rratio 0.25) (tstamp 434996e1-61bd-42ff-a716-8e2eded0b81d))
|
||||
(pad "11" thru_hole roundrect (at -40.3 1.27 180) (size 2.286 1.524) (drill 0.9) (layers "*.Cu" "*.Mask") (roundrect_rratio 0.25) (tstamp d04da8c4-1375-40f5-862d-89a40323615e))
|
||||
(pad "12" thru_hole roundrect (at -40.3 -1.27 180) (size 2.286 1.524) (drill 0.9) (layers "*.Cu" "*.Mask") (roundrect_rratio 0.25) (tstamp d3eb6fac-45c7-4fd1-9912-2d8c789ffa62))
|
||||
(pad "13" thru_hole roundrect (at -40.3 -3.81 180) (size 2.286 1.524) (drill 0.9) (layers "*.Cu" "*.Mask") (roundrect_rratio 0.25) (tstamp 925b72f2-8f72-452d-a630-3febc08cc9ad))
|
||||
(pad "14" thru_hole roundrect (at -40.3 -6.35 180) (size 2.286 1.524) (drill 0.9) (layers "*.Cu" "*.Mask") (roundrect_rratio 0.25) (tstamp b4fcf448-08be-496d-8886-fa111b5b3ed1))
|
||||
(pad "15" thru_hole roundrect (at -40.3 -8.89 180) (size 2.286 1.524) (drill 0.9) (layers "*.Cu" "*.Mask") (roundrect_rratio 0.25) (tstamp 71333f91-0375-4115-aff4-5c1287b2ffc3))
|
||||
(pad "16" thru_hole roundrect (at -40.3 -11.43 180) (size 2.286 1.524) (drill 0.9) (layers "*.Cu" "*.Mask") (roundrect_rratio 0.25) (tstamp 1da1d33c-0ecb-4e9c-810a-201946bf2333))
|
||||
(pad "17" thru_hole roundrect (at -40.3 -13.97 180) (size 2.286 1.524) (drill 0.9) (layers "*.Cu" "*.Mask") (roundrect_rratio 0.25) (tstamp da71bc08-e42f-44ea-865c-6032dc757532))
|
||||
(pad "18" thru_hole roundrect (at -40.3 -16.51 180) (size 2.286 1.524) (drill 0.9) (layers "*.Cu" "*.Mask") (roundrect_rratio 0.25) (tstamp e630b3ad-972b-48f8-8387-439339d1a82b))
|
||||
)
|
||||
@@ -0,0 +1,36 @@
|
||||
(footprint "4.0 TFT 480x320 led with sd and touch" (version 20221018) (generator pcbnew)
|
||||
(layer "F.Cu")
|
||||
(attr through_hole)
|
||||
(fp_text reference "REF**" (at 6.858 -7.112 unlocked) (layer "F.SilkS")
|
||||
(effects (font (size 1 1) (thickness 0.15)))
|
||||
(tstamp 1dd33759-143b-476c-bb42-c5e5d445a2fc)
|
||||
)
|
||||
(fp_text value "4.0 TFT 480x320 led with sd and touch" (at 3.47 -0.254 90 unlocked) (layer "F.Fab")
|
||||
(effects (font (size 1 1) (thickness 0.15)))
|
||||
(tstamp 1ce2bf2b-b61f-46da-a1cb-06e193ac5296)
|
||||
)
|
||||
(fp_rect (start -1.93 30.9) (end 106.07 -30.9)
|
||||
(stroke (width 0.12) (type solid)) (fill none) (layer "F.SilkS") (tstamp 9717e78c-245e-4b0a-ba7e-ef5374b0c38c))
|
||||
(pad "" np_thru_hole circle (at 1.07 -27.5) (size 6 6) (drill 3.5) (layers "F&B.Cu" "*.Mask") (tstamp 7ce980db-52dc-41e1-bac4-30a0cf9df4f2))
|
||||
(pad "" np_thru_hole circle (at 1.07 27.5) (size 6 6) (drill 3.5) (layers "F&B.Cu" "*.Mask") (tstamp d2f64eb5-177b-453b-a52e-31c9cd53aa66))
|
||||
(pad "" np_thru_hole circle (at 103.07 -27.5) (size 6 6) (drill 3.5) (layers "F&B.Cu" "*.Mask") (tstamp 9edc280a-c2af-4851-92a3-2973bd93b7ea))
|
||||
(pad "" np_thru_hole circle (at 103.07 27.5) (size 6 6) (drill 3.5) (layers "F&B.Cu" "*.Mask") (tstamp f03fba2d-995e-47a0-b9be-5909be892403))
|
||||
(pad "1" thru_hole roundrect (at 104.14 3.81 180) (size 2.286 1.524) (drill 0.9) (layers "*.Cu" "*.Mask") (roundrect_rratio 0.25) (tstamp 21623806-8193-49aa-8e86-f5d741ee3217))
|
||||
(pad "2" thru_hole roundrect (at 104.14 1.27 180) (size 2.286 1.524) (drill 0.9) (layers "*.Cu" "*.Mask") (roundrect_rratio 0.25) (tstamp 1c8efd92-4e91-4579-bd5c-5fab3c9a7156))
|
||||
(pad "3" thru_hole roundrect (at 104.14 -1.27 180) (size 2.286 1.524) (drill 0.9) (layers "*.Cu" "*.Mask") (roundrect_rratio 0.25) (tstamp c0b8101a-448b-46a1-9a8a-2ff22c1b14db))
|
||||
(pad "4" thru_hole roundrect (at 104.14 -3.81 180) (size 2.286 1.524) (drill 0.9) (layers "*.Cu" "*.Mask") (roundrect_rratio 0.25) (tstamp a34698d6-085b-485a-ba4e-0184bb2cbfd8))
|
||||
(pad "5" thru_hole roundrect (at 0 16.51 180) (size 2.286 1.524) (drill 0.9) (layers "*.Cu" "*.Mask") (roundrect_rratio 0.25) (tstamp d099de14-88e2-441e-a73e-ff95baeb8e26))
|
||||
(pad "6" thru_hole roundrect (at 0 13.97 180) (size 2.286 1.524) (drill 0.9) (layers "*.Cu" "*.Mask") (roundrect_rratio 0.25) (tstamp 59a1ecf0-8d7b-4db7-8aa7-b858a90fc7be))
|
||||
(pad "7" thru_hole roundrect (at 0 11.43 180) (size 2.286 1.524) (drill 0.9) (layers "*.Cu" "*.Mask") (roundrect_rratio 0.25) (tstamp b96d741a-8459-4bdc-b8c3-996255ed9d94))
|
||||
(pad "8" thru_hole roundrect (at 0 8.89 180) (size 2.286 1.524) (drill 0.9) (layers "*.Cu" "*.Mask") (roundrect_rratio 0.25) (tstamp 378396b7-816f-412c-b398-2bfbec7f6a55))
|
||||
(pad "9" thru_hole roundrect (at 0 6.35 180) (size 2.286 1.524) (drill 0.9) (layers "*.Cu" "*.Mask") (roundrect_rratio 0.25) (tstamp 3f510b37-3d66-4b1f-a522-569a3c2d8bbf))
|
||||
(pad "10" thru_hole roundrect (at 0 3.81 180) (size 2.286 1.524) (drill 0.9) (layers "*.Cu" "*.Mask") (roundrect_rratio 0.25) (tstamp 434996e1-61bd-42ff-a716-8e2eded0b81d))
|
||||
(pad "11" thru_hole roundrect (at 0 1.27 180) (size 2.286 1.524) (drill 0.9) (layers "*.Cu" "*.Mask") (roundrect_rratio 0.25) (tstamp d04da8c4-1375-40f5-862d-89a40323615e))
|
||||
(pad "12" thru_hole roundrect (at 0 -1.27 180) (size 2.286 1.524) (drill 0.9) (layers "*.Cu" "*.Mask") (roundrect_rratio 0.25) (tstamp d3eb6fac-45c7-4fd1-9912-2d8c789ffa62))
|
||||
(pad "13" thru_hole roundrect (at 0 -3.81 180) (size 2.286 1.524) (drill 0.9) (layers "*.Cu" "*.Mask") (roundrect_rratio 0.25) (tstamp 925b72f2-8f72-452d-a630-3febc08cc9ad))
|
||||
(pad "14" thru_hole roundrect (at 0 -6.35 180) (size 2.286 1.524) (drill 0.9) (layers "*.Cu" "*.Mask") (roundrect_rratio 0.25) (tstamp b4fcf448-08be-496d-8886-fa111b5b3ed1))
|
||||
(pad "15" thru_hole roundrect (at 0 -8.89 180) (size 2.286 1.524) (drill 0.9) (layers "*.Cu" "*.Mask") (roundrect_rratio 0.25) (tstamp 71333f91-0375-4115-aff4-5c1287b2ffc3))
|
||||
(pad "16" thru_hole roundrect (at 0 -11.43 180) (size 2.286 1.524) (drill 0.9) (layers "*.Cu" "*.Mask") (roundrect_rratio 0.25) (tstamp 1da1d33c-0ecb-4e9c-810a-201946bf2333))
|
||||
(pad "17" thru_hole roundrect (at 0 -13.97 180) (size 2.286 1.524) (drill 0.9) (layers "*.Cu" "*.Mask") (roundrect_rratio 0.25) (tstamp da71bc08-e42f-44ea-865c-6032dc757532))
|
||||
(pad "18" thru_hole roundrect (at 0 -16.51 180) (size 2.286 1.524) (drill 0.9) (layers "*.Cu" "*.Mask") (roundrect_rratio 0.25) (tstamp e630b3ad-972b-48f8-8387-439339d1a82b))
|
||||
)
|
||||
@@ -0,0 +1,48 @@
|
||||
(footprint "IC_DRV8825_STEPPER_MOTOR_DRIVER_CARRIER" (version 20211014) (generator pcbnew)
|
||||
(layer "F.Cu")
|
||||
(tedit 6381DD42)
|
||||
(attr through_hole)
|
||||
(fp_text reference "REF**" (at -4.445 -12.065) (layer "F.SilkS")
|
||||
(effects (font (size 1 1) (thickness 0.15)))
|
||||
(tstamp 1f808c90-825e-49d0-9480-2865cbd239e3)
|
||||
)
|
||||
(fp_text value "IC_DRV8825_STEPPER_MOTOR_DRIVER_CARRIER" (at 17.145 12.065) (layer "F.Fab")
|
||||
(effects (font (size 1 1) (thickness 0.15)))
|
||||
(tstamp cd8735a2-64b2-46f7-86e5-f65aa6773d1a)
|
||||
)
|
||||
(fp_line (start 7.62 10.16) (end -7.62 10.16) (layer "F.SilkS") (width 0.127) (tstamp 184ea5e5-773a-4470-a1d9-ada8f7c72915))
|
||||
(fp_line (start 7.62 -10.16) (end 7.62 10.16) (layer "F.SilkS") (width 0.127) (tstamp 332001f5-cc71-4238-ac59-603f5e908f28))
|
||||
(fp_line (start -7.62 -10.16) (end 7.62 -10.16) (layer "F.SilkS") (width 0.127) (tstamp 55d53cb2-4740-441d-b360-53850205a522))
|
||||
(fp_line (start -7.62 10.16) (end -7.62 -10.16) (layer "F.SilkS") (width 0.127) (tstamp eb50be0a-af3d-4f72-8f32-b836afc4ea23))
|
||||
(fp_circle (center -8.6 -9) (end -8.5 -9) (layer "F.SilkS") (width 0.2) (fill none) (tstamp c3e53920-591b-41f7-bfa4-cdec252f192d))
|
||||
(fp_line (start 7.87 10.41) (end -7.87 10.41) (layer "F.CrtYd") (width 0.05) (tstamp 9d0dccba-7ac6-439e-bee8-29aefc9066a6))
|
||||
(fp_line (start -7.87 10.41) (end -7.87 -10.41) (layer "F.CrtYd") (width 0.05) (tstamp a58804ce-8cb0-4f6a-a098-d45aeb1aae2d))
|
||||
(fp_line (start 7.87 -10.41) (end 7.87 10.41) (layer "F.CrtYd") (width 0.05) (tstamp df63f6d8-a5ee-4781-9ec1-cc05348d1b96))
|
||||
(fp_line (start -7.87 -10.41) (end 7.87 -10.41) (layer "F.CrtYd") (width 0.05) (tstamp faf89614-78d8-4859-84c0-3ebe11c19d95))
|
||||
(fp_line (start -7.62 -10.16) (end 7.62 -10.16) (layer "F.Fab") (width 0.127) (tstamp 5ded9bb8-1156-457b-84b6-685326575cf1))
|
||||
(fp_line (start 7.62 -10.16) (end 7.62 10.16) (layer "F.Fab") (width 0.127) (tstamp 940db903-16a4-48e2-a98f-adad90558e9e))
|
||||
(fp_line (start 7.62 10.16) (end -7.62 10.16) (layer "F.Fab") (width 0.127) (tstamp a2ec6ef3-fc2f-46bb-b912-4a1b212ee2aa))
|
||||
(fp_line (start -7.62 10.16) (end -7.62 -10.16) (layer "F.Fab") (width 0.127) (tstamp b51a4bcf-71d4-420a-bfc9-af8e91ffce12))
|
||||
(fp_circle (center -8.6 -9) (end -8.5 -9) (layer "F.Fab") (width 0.2) (fill none) (tstamp c5b0755b-ae47-484b-a9d8-a14bc3fe4d6a))
|
||||
(pad "1" thru_hole rect (at -6.35 -8.89) (size 1.65 1.65) (drill 1.1) (layers *.Cu *.Mask) (tstamp 741b3aed-a21f-49e6-afae-979a391e69e3))
|
||||
(pad "2" thru_hole circle (at -6.35 -6.35) (size 1.65 1.65) (drill 1.1) (layers *.Cu *.Mask) (tstamp e08eefbd-e4db-4df7-81f8-1db4f4624b8e))
|
||||
(pad "3" thru_hole circle (at -6.35 -3.81) (size 1.65 1.65) (drill 1.1) (layers *.Cu *.Mask) (tstamp fa23c747-4f5a-467c-b9ee-d1568722f9f4))
|
||||
(pad "4" thru_hole circle (at -6.35 -1.27) (size 1.65 1.65) (drill 1.1) (layers *.Cu *.Mask) (tstamp 1526f4b4-4f3a-4309-88e3-e357e5e4fd01))
|
||||
(pad "5" thru_hole circle (at -6.35 1.27) (size 1.65 1.65) (drill 1.1) (layers *.Cu *.Mask) (tstamp 346d4de3-c86e-4f9a-b0cd-327abb4e6e16))
|
||||
(pad "6" thru_hole circle (at -6.35 3.81) (size 1.65 1.65) (drill 1.1) (layers *.Cu *.Mask) (tstamp 2b0dcfb1-04fb-4736-9932-8b443dc4b4db))
|
||||
(pad "7" thru_hole circle (at -6.35 6.35) (size 1.65 1.65) (drill 1.1) (layers *.Cu *.Mask) (tstamp f5651210-70bd-4ef4-b435-4f5b604ad5ea))
|
||||
(pad "8" thru_hole circle (at -6.35 8.89) (size 1.65 1.65) (drill 1.1) (layers *.Cu *.Mask) (tstamp 4c930822-2577-4b8f-880c-ba5110fe90ca))
|
||||
(pad "9" thru_hole circle (at 6.35 8.89) (size 1.65 1.65) (drill 1.1) (layers *.Cu *.Mask) (tstamp 58a376a7-9b6c-4a01-8858-f7f3b141df35))
|
||||
(pad "10" thru_hole circle (at 6.35 6.35) (size 1.65 1.65) (drill 1.1) (layers *.Cu *.Mask) (tstamp 826cd63c-449b-4341-9d3a-e4f9d7be3522))
|
||||
(pad "11" thru_hole circle (at 6.35 3.81) (size 1.65 1.65) (drill 1.1) (layers *.Cu *.Mask) (tstamp 3ecd8ab0-f3ff-4b33-b61a-ac8f6d635b8d))
|
||||
(pad "12" thru_hole circle (at 6.35 1.27) (size 1.65 1.65) (drill 1.1) (layers *.Cu *.Mask) (tstamp d98ae056-8cce-485d-8161-65c8fa9131da))
|
||||
(pad "13" thru_hole circle (at 6.35 -1.27) (size 1.65 1.65) (drill 1.1) (layers *.Cu *.Mask) (tstamp 7b3e4290-3208-4aa1-a099-022dbb423783))
|
||||
(pad "14" thru_hole circle (at 6.35 -3.81) (size 1.65 1.65) (drill 1.1) (layers *.Cu *.Mask) (tstamp a1c91abb-0590-4d22-9c4d-0cc9face79ef))
|
||||
(pad "15" thru_hole circle (at 6.35 -6.35) (size 1.65 1.65) (drill 1.1) (layers *.Cu *.Mask) (tstamp bcbd6a36-e817-4130-a8e3-a17958b1b374))
|
||||
(pad "16" thru_hole circle (at 6.35 -8.89) (size 1.65 1.65) (drill 1.1) (layers *.Cu *.Mask) (tstamp fa5466b9-c748-4ab2-8ed8-0ca9c70ab11e))
|
||||
(model "C:/Users/Hakan/Downloads/DRV8825 STEPPER MOTOR DRIVER CARRIER--3DModel-STEP-1.STEP"
|
||||
(offset (xyz 0 0 0))
|
||||
(scale (xyz 1 1 1))
|
||||
(rotate (xyz -90 0 0))
|
||||
)
|
||||
)
|
||||
@@ -0,0 +1,29 @@
|
||||
(footprint "L298N Motor driver module-utan motorpads" (version 20221018) (generator pcbnew)
|
||||
(layer "F.Cu")
|
||||
(attr through_hole)
|
||||
(fp_text reference "REF**" (at 0 -0.5 unlocked) (layer "F.SilkS")
|
||||
(effects (font (size 1 1) (thickness 0.15)))
|
||||
(tstamp 09a028f6-0462-4b35-a49b-ef2c13c355bf)
|
||||
)
|
||||
(fp_text value "L298N Motor driver module-utan motorpads" (at 0 1 unlocked) (layer "F.Fab")
|
||||
(effects (font (size 1 1) (thickness 0.15)))
|
||||
(tstamp 14df8c27-1aca-4de8-bd30-28d03a31e6f6)
|
||||
)
|
||||
(fp_line (start -12.192 19.7) (end 9.398 19.7)
|
||||
(stroke (width 0.12) (type default)) (layer "F.SilkS") (tstamp 317d2810-d3c2-49db-938a-bafe7f4e1e31))
|
||||
(fp_rect (start -21.7 -21.9) (end 21.7 21.9)
|
||||
(stroke (width 0.12) (type default)) (fill none) (layer "F.SilkS") (tstamp 5b17b7f5-435b-4a28-afb4-86ded0e884be))
|
||||
(pad "" np_thru_hole circle (at -18.5 -18.5) (size 3.5 3.5) (drill 3.5) (layers "F&B.Cu" "*.Mask") (tstamp c04b2057-c14b-4dd5-b142-15b98e9d5668))
|
||||
(pad "" np_thru_hole circle (at -18.5 18.5) (size 3.5 3.5) (drill 3.5) (layers "F&B.Cu" "*.Mask") (tstamp 7a2864d1-8946-4dc9-93a0-02a917a24fd8))
|
||||
(pad "" np_thru_hole circle (at 18.5 -18.5) (size 3.5 3.5) (drill 3.5) (layers "F&B.Cu" "*.Mask") (tstamp 269d31b6-76fe-44b5-8014-0153a125cf89))
|
||||
(pad "" np_thru_hole circle (at 18.5 18.5) (size 3.5 3.5) (drill 3.5) (layers "F&B.Cu" "*.Mask") (tstamp c86e2980-43bd-4dde-a031-8739fee66cba))
|
||||
(pad "1" thru_hole oval (at 2 19.7) (size 2 3) (drill 1) (layers "*.Cu" "*.Mask") (tstamp 2a20db31-01a1-4353-ae5f-88685f485774))
|
||||
(pad "2" thru_hole oval (at 4.54 19.7) (size 2 3) (drill 1) (layers "*.Cu" "*.Mask") (tstamp 00389037-846c-4418-9b22-7fd733ca52aa))
|
||||
(pad "3" thru_hole oval (at 7.08 19.7) (size 2 3) (drill 1) (layers "*.Cu" "*.Mask") (tstamp 08d18f74-257d-41fb-b81c-4b1a4997e10a))
|
||||
(pad "4" thru_hole oval (at 9.62 19.7) (size 2 3) (drill 1) (layers "*.Cu" "*.Mask") (tstamp d53e5f93-12ba-4536-a4db-2ce58ccb8456))
|
||||
(pad "5" thru_hole oval (at 12.16 19.7) (size 2 3) (drill 1) (layers "*.Cu" "*.Mask") (tstamp 6b708c4d-114c-4ca0-87da-43019ce568bd))
|
||||
(pad "6" thru_hole oval (at 14.7 19.7) (size 2 3) (drill 1) (layers "*.Cu" "*.Mask") (tstamp 5d21a68b-46af-4933-ac21-2a94a7818f09))
|
||||
(pad "7" thru_hole oval (at -12.9 18.2) (size 4 7) (drill 1.2) (layers "*.Cu" "*.Mask") (tstamp 22dc6290-4fa9-4254-9657-42161eb64109))
|
||||
(pad "8" thru_hole oval (at -7.9 18.2) (size 4 7) (drill 1.2) (layers "*.Cu" "*.Mask") (tstamp fb5ddbfb-2f7d-4a7b-8c41-0e9c79aa84cc))
|
||||
(pad "9" thru_hole oval (at -2.9 18.2) (size 4 7) (drill 1.2) (layers "*.Cu" "*.Mask") (tstamp cdffeec5-53fa-4dc9-a305-b74eb46b6bfe))
|
||||
)
|
||||
@@ -0,0 +1,33 @@
|
||||
(footprint "L298N Motor driver module" (version 20221018) (generator pcbnew)
|
||||
(layer "F.Cu")
|
||||
(attr through_hole)
|
||||
(fp_text reference "REF**" (at 0 -0.5 unlocked) (layer "F.SilkS")
|
||||
(effects (font (size 1 1) (thickness 0.15)))
|
||||
(tstamp 09a028f6-0462-4b35-a49b-ef2c13c355bf)
|
||||
)
|
||||
(fp_text value "L298N Motor driver module" (at 0 1 unlocked) (layer "F.Fab")
|
||||
(effects (font (size 1 1) (thickness 0.15)))
|
||||
(tstamp 14df8c27-1aca-4de8-bd30-28d03a31e6f6)
|
||||
)
|
||||
(fp_line (start -12.192 19.7) (end 9.398 19.7)
|
||||
(stroke (width 0.12) (type default)) (layer "F.SilkS") (tstamp 317d2810-d3c2-49db-938a-bafe7f4e1e31))
|
||||
(fp_rect (start -21.7 -21.9) (end 21.7 21.9)
|
||||
(stroke (width 0.12) (type default)) (fill none) (layer "F.SilkS") (tstamp 5b17b7f5-435b-4a28-afb4-86ded0e884be))
|
||||
(pad "" np_thru_hole circle (at -18.5 -18.5) (size 3.5 3.5) (drill 3.5) (layers "F&B.Cu" "*.Mask") (tstamp c04b2057-c14b-4dd5-b142-15b98e9d5668))
|
||||
(pad "" np_thru_hole circle (at -18.5 18.5) (size 3.5 3.5) (drill 3.5) (layers "F&B.Cu" "*.Mask") (tstamp 7a2864d1-8946-4dc9-93a0-02a917a24fd8))
|
||||
(pad "" np_thru_hole circle (at 18.5 -18.5) (size 3.5 3.5) (drill 3.5) (layers "F&B.Cu" "*.Mask") (tstamp 269d31b6-76fe-44b5-8014-0153a125cf89))
|
||||
(pad "" np_thru_hole circle (at 18.5 18.5) (size 3.5 3.5) (drill 3.5) (layers "F&B.Cu" "*.Mask") (tstamp c86e2980-43bd-4dde-a031-8739fee66cba))
|
||||
(pad "1" thru_hole oval (at 2 19.7) (size 2 3) (drill 1) (layers "*.Cu" "*.Mask") (tstamp 2a20db31-01a1-4353-ae5f-88685f485774))
|
||||
(pad "2" thru_hole oval (at 4.54 19.7) (size 2 3) (drill 1) (layers "*.Cu" "*.Mask") (tstamp 00389037-846c-4418-9b22-7fd733ca52aa))
|
||||
(pad "3" thru_hole oval (at 7.08 19.7) (size 2 3) (drill 1) (layers "*.Cu" "*.Mask") (tstamp 08d18f74-257d-41fb-b81c-4b1a4997e10a))
|
||||
(pad "4" thru_hole oval (at 9.62 19.7) (size 2 3) (drill 1) (layers "*.Cu" "*.Mask") (tstamp d53e5f93-12ba-4536-a4db-2ce58ccb8456))
|
||||
(pad "5" thru_hole oval (at 12.16 19.7) (size 2 3) (drill 1) (layers "*.Cu" "*.Mask") (tstamp 6b708c4d-114c-4ca0-87da-43019ce568bd))
|
||||
(pad "6" thru_hole oval (at 14.7 19.7) (size 2 3) (drill 1) (layers "*.Cu" "*.Mask") (tstamp 5d21a68b-46af-4933-ac21-2a94a7818f09))
|
||||
(pad "7" thru_hole oval (at -12.9 18.2) (size 4 7) (drill 1.2) (layers "*.Cu" "*.Mask") (tstamp 22dc6290-4fa9-4254-9657-42161eb64109))
|
||||
(pad "8" thru_hole oval (at -7.9 18.2) (size 4 7) (drill 1.2) (layers "*.Cu" "*.Mask") (tstamp fb5ddbfb-2f7d-4a7b-8c41-0e9c79aa84cc))
|
||||
(pad "9" thru_hole oval (at -2.9 18.2) (size 4 7) (drill 1.2) (layers "*.Cu" "*.Mask") (tstamp cdffeec5-53fa-4dc9-a305-b74eb46b6bfe))
|
||||
(pad "10" thru_hole oval (at -18 4.3 90) (size 4 7) (drill 1.2) (layers "*.Cu" "*.Mask") (tstamp 0e3fa457-3725-462a-a14a-790e4c546848))
|
||||
(pad "11" thru_hole oval (at -18 9.3 90) (size 4 7) (drill 1.2) (layers "*.Cu" "*.Mask") (tstamp ad687e58-7c86-4b4e-991b-893276f1f94c))
|
||||
(pad "12" thru_hole oval (at 18 9.3 90) (size 4 7) (drill 1.2) (layers "*.Cu" "*.Mask") (tstamp 6302ccd5-1c76-4372-a74c-9fedcff4b8cd))
|
||||
(pad "13" thru_hole oval (at 18 4.3 90) (size 4 7) (drill 1.2) (layers "*.Cu" "*.Mask") (tstamp 9557f817-b189-4de2-b586-7853253c921f))
|
||||
)
|
||||
@@ -0,0 +1,348 @@
|
||||
(footprint "LQFP-80-1EP_10x10mm_P0.4mm_EP5.3x4.5mm_ThermalVias" (version 20221018) (generator pcbnew)
|
||||
(layer "F.Cu")
|
||||
(descr "LQFP, 80 Pin (https://www.renesas.com/eu/en/package-image/pdf/outdrawing/q80.10x10.pdf), generated with kicad-footprint-generator ipc_gullwing_generator.py")
|
||||
(tags "LQFP QFP")
|
||||
(attr smd)
|
||||
(fp_text reference "REF**" (at 0 -7.35) (layer "F.SilkS")
|
||||
(effects (font (size 1 1) (thickness 0.15)))
|
||||
(tstamp 70a26ab6-df9c-48f2-b232-ba5a4878094a)
|
||||
)
|
||||
(fp_text value "LQFP-80-1EP_10x10mm_P0.4mm_EP5.3x4.5mm_ThermalVias" (at 0 7.35) (layer "F.Fab")
|
||||
(effects (font (size 1 1) (thickness 0.15)))
|
||||
(tstamp 56c71606-43cb-468f-a489-b58f27e62838)
|
||||
)
|
||||
(fp_text user "${REFERENCE}" (at 0 0) (layer "F.Fab")
|
||||
(effects (font (size 1 1) (thickness 0.15)))
|
||||
(tstamp c4eb89c8-c35e-439b-9b14-00202743cb5d)
|
||||
)
|
||||
(fp_line (start -5.11 -5.11) (end -5.11 -4.185)
|
||||
(stroke (width 0.12) (type solid)) (layer "F.SilkS") (tstamp c5bddc3b-f651-475f-983e-cf26dcd39f29))
|
||||
(fp_line (start -5.11 -4.185) (end -6.4 -4.185)
|
||||
(stroke (width 0.12) (type solid)) (layer "F.SilkS") (tstamp dadd5c9b-2a27-4b9e-a444-e08638750ba6))
|
||||
(fp_line (start -5.11 5.11) (end -5.11 4.185)
|
||||
(stroke (width 0.12) (type solid)) (layer "F.SilkS") (tstamp f5def86f-240a-467c-8c02-0f072b5b84d7))
|
||||
(fp_line (start -4.185 -5.11) (end -5.11 -5.11)
|
||||
(stroke (width 0.12) (type solid)) (layer "F.SilkS") (tstamp 530dac9e-65e4-48f9-a600-3bbd1e830082))
|
||||
(fp_line (start -4.185 5.11) (end -5.11 5.11)
|
||||
(stroke (width 0.12) (type solid)) (layer "F.SilkS") (tstamp 7621f715-b087-44f1-8143-e6e5c792b5f4))
|
||||
(fp_line (start 4.185 -5.11) (end 5.11 -5.11)
|
||||
(stroke (width 0.12) (type solid)) (layer "F.SilkS") (tstamp 3679784e-2dcd-491e-8a80-f42a72cadd52))
|
||||
(fp_line (start 4.185 5.11) (end 5.11 5.11)
|
||||
(stroke (width 0.12) (type solid)) (layer "F.SilkS") (tstamp 943ff432-66db-4385-97ca-4d25dd102247))
|
||||
(fp_line (start 5.11 -5.11) (end 5.11 -4.185)
|
||||
(stroke (width 0.12) (type solid)) (layer "F.SilkS") (tstamp 3317151a-3858-4575-8c5c-394a9ed2e4d3))
|
||||
(fp_line (start 5.11 5.11) (end 5.11 4.185)
|
||||
(stroke (width 0.12) (type solid)) (layer "F.SilkS") (tstamp c1bce80f-e6a5-4cc5-940a-ae00f257044d))
|
||||
(fp_line (start -6.65 -4.18) (end -6.65 0)
|
||||
(stroke (width 0.05) (type solid)) (layer "F.CrtYd") (tstamp da9a1a45-ac9e-41ea-bd71-4e69a36ecfc9))
|
||||
(fp_line (start -6.65 4.18) (end -6.65 0)
|
||||
(stroke (width 0.05) (type solid)) (layer "F.CrtYd") (tstamp 051c90c9-9e89-49eb-9ca7-bcb39cb1a823))
|
||||
(fp_line (start -5.25 -5.25) (end -5.25 -4.18)
|
||||
(stroke (width 0.05) (type solid)) (layer "F.CrtYd") (tstamp 29a0c261-d919-4091-adb0-248e8090cde4))
|
||||
(fp_line (start -5.25 -4.18) (end -6.65 -4.18)
|
||||
(stroke (width 0.05) (type solid)) (layer "F.CrtYd") (tstamp d063dbd7-7a5d-4f1a-aeed-d918ab802785))
|
||||
(fp_line (start -5.25 4.18) (end -6.65 4.18)
|
||||
(stroke (width 0.05) (type solid)) (layer "F.CrtYd") (tstamp 3ee90fd5-7212-4e30-8044-e032ddbda20e))
|
||||
(fp_line (start -5.25 5.25) (end -5.25 4.18)
|
||||
(stroke (width 0.05) (type solid)) (layer "F.CrtYd") (tstamp 9ef09f70-188d-4b81-9741-49766493be45))
|
||||
(fp_line (start -4.18 -6.65) (end -4.18 -5.25)
|
||||
(stroke (width 0.05) (type solid)) (layer "F.CrtYd") (tstamp 4a909761-7e01-4bef-a53d-25fc094e00d2))
|
||||
(fp_line (start -4.18 -5.25) (end -5.25 -5.25)
|
||||
(stroke (width 0.05) (type solid)) (layer "F.CrtYd") (tstamp 3b0255f2-4927-4627-9924-9584744fc2a2))
|
||||
(fp_line (start -4.18 5.25) (end -5.25 5.25)
|
||||
(stroke (width 0.05) (type solid)) (layer "F.CrtYd") (tstamp 3482fba9-bad5-4c49-8c24-f0181769fb20))
|
||||
(fp_line (start -4.18 6.65) (end -4.18 5.25)
|
||||
(stroke (width 0.05) (type solid)) (layer "F.CrtYd") (tstamp c5509683-4355-40bd-bbde-e7eb51c8f247))
|
||||
(fp_line (start 0 -6.65) (end -4.18 -6.65)
|
||||
(stroke (width 0.05) (type solid)) (layer "F.CrtYd") (tstamp 5714a1dc-f2b7-4ff2-b089-7521d2416a6f))
|
||||
(fp_line (start 0 -6.65) (end 4.18 -6.65)
|
||||
(stroke (width 0.05) (type solid)) (layer "F.CrtYd") (tstamp 8acd3e0e-36a7-41ae-99df-1c5f22d1ec62))
|
||||
(fp_line (start 0 6.65) (end -4.18 6.65)
|
||||
(stroke (width 0.05) (type solid)) (layer "F.CrtYd") (tstamp f40345b6-b387-4fd0-aa68-f1d362375732))
|
||||
(fp_line (start 0 6.65) (end 4.18 6.65)
|
||||
(stroke (width 0.05) (type solid)) (layer "F.CrtYd") (tstamp e708afeb-860e-4202-b808-c9d599294938))
|
||||
(fp_line (start 4.18 -6.65) (end 4.18 -5.25)
|
||||
(stroke (width 0.05) (type solid)) (layer "F.CrtYd") (tstamp 8ebbfe90-811e-480f-9089-55aa4ea65885))
|
||||
(fp_line (start 4.18 -5.25) (end 5.25 -5.25)
|
||||
(stroke (width 0.05) (type solid)) (layer "F.CrtYd") (tstamp 9071e95a-8022-44b0-8abe-ef7b0ee1020c))
|
||||
(fp_line (start 4.18 5.25) (end 5.25 5.25)
|
||||
(stroke (width 0.05) (type solid)) (layer "F.CrtYd") (tstamp cf570861-0bc3-4701-9148-3284e7c36c37))
|
||||
(fp_line (start 4.18 6.65) (end 4.18 5.25)
|
||||
(stroke (width 0.05) (type solid)) (layer "F.CrtYd") (tstamp a29515fd-97b0-4960-9058-63c30163e785))
|
||||
(fp_line (start 5.25 -5.25) (end 5.25 -4.18)
|
||||
(stroke (width 0.05) (type solid)) (layer "F.CrtYd") (tstamp 6e1b7053-41ca-4470-8a3b-d4fcc9ebaf85))
|
||||
(fp_line (start 5.25 -4.18) (end 6.65 -4.18)
|
||||
(stroke (width 0.05) (type solid)) (layer "F.CrtYd") (tstamp a37dada8-0704-417d-beaf-9928452138d6))
|
||||
(fp_line (start 5.25 4.18) (end 6.65 4.18)
|
||||
(stroke (width 0.05) (type solid)) (layer "F.CrtYd") (tstamp b6a81440-240d-46e2-b5c6-60d154000d9e))
|
||||
(fp_line (start 5.25 5.25) (end 5.25 4.18)
|
||||
(stroke (width 0.05) (type solid)) (layer "F.CrtYd") (tstamp 6f1c3838-3a73-42f7-911c-d9dba0d09bc0))
|
||||
(fp_line (start 6.65 -4.18) (end 6.65 0)
|
||||
(stroke (width 0.05) (type solid)) (layer "F.CrtYd") (tstamp 4985a328-96f8-4248-bbb9-19b68bbcea52))
|
||||
(fp_line (start 6.65 4.18) (end 6.65 0)
|
||||
(stroke (width 0.05) (type solid)) (layer "F.CrtYd") (tstamp 4d6df114-c8a5-439b-9bc8-72b0c0d0a875))
|
||||
(fp_line (start -5 -4) (end -4 -5)
|
||||
(stroke (width 0.1) (type solid)) (layer "F.Fab") (tstamp c60a5f83-09e1-4784-9ca1-a45fd876984c))
|
||||
(fp_line (start -5 5) (end -5 -4)
|
||||
(stroke (width 0.1) (type solid)) (layer "F.Fab") (tstamp 5f0a98af-340b-4806-a4a9-354e3ddc6b64))
|
||||
(fp_line (start -4 -5) (end 5 -5)
|
||||
(stroke (width 0.1) (type solid)) (layer "F.Fab") (tstamp 3fdeb27d-a382-4fc8-a55b-6a7393c81183))
|
||||
(fp_line (start 5 -5) (end 5 5)
|
||||
(stroke (width 0.1) (type solid)) (layer "F.Fab") (tstamp cb92a039-abdd-4888-a265-be65549f967d))
|
||||
(fp_line (start 5 5) (end -5 5)
|
||||
(stroke (width 0.1) (type solid)) (layer "F.Fab") (tstamp 724131b3-f967-4db3-9ebe-79c738e1642c))
|
||||
(pad "" smd custom (at -2.225 -2.025) (size 0.251864 0.251864) (layers "F.Paste")
|
||||
(options (clearance outline) (anchor circle))
|
||||
(primitives
|
||||
(gr_poly
|
||||
(pts
|
||||
(xy -0.251946 -0.0907)
|
||||
(xy 0.251946 -0.0907)
|
||||
(xy 0.251946 -0.013058)
|
||||
(xy 0.148187 0.0907)
|
||||
(xy -0.251946 0.0907)
|
||||
)
|
||||
(width 0.181401) (fill yes))
|
||||
) (tstamp 28f4ea71-2775-4c4f-9ce4-5fe517418270))
|
||||
(pad "" smd roundrect (at -2.225 -1.2) (size 0.685292 0.967471) (layers "F.Paste") (roundrect_rratio 0.25) (tstamp ace3dc98-8d6d-4849-95da-6221efe251a5))
|
||||
(pad "" smd roundrect (at -2.225 0) (size 0.685292 0.967471) (layers "F.Paste") (roundrect_rratio 0.25) (tstamp 457afe70-9334-41d5-b1a7-42603d03c053))
|
||||
(pad "" smd roundrect (at -2.225 1.2) (size 0.685292 0.967471) (layers "F.Paste") (roundrect_rratio 0.25) (tstamp 016c8c32-3ffe-41e2-bee0-9d54aae88d95))
|
||||
(pad "" smd custom (at -2.225 2.025) (size 0.251864 0.251864) (layers "F.Paste")
|
||||
(options (clearance outline) (anchor circle))
|
||||
(primitives
|
||||
(gr_poly
|
||||
(pts
|
||||
(xy -0.251946 -0.0907)
|
||||
(xy 0.148187 -0.0907)
|
||||
(xy 0.251946 0.013058)
|
||||
(xy 0.251946 0.0907)
|
||||
(xy -0.251946 0.0907)
|
||||
)
|
||||
(width 0.181401) (fill yes))
|
||||
) (tstamp 8297f017-cc08-41b4-9e72-cac57b6af107))
|
||||
(pad "" smd custom (at -1.2 -2.025) (size 0.275842 0.275842) (layers "F.Paste")
|
||||
(options (clearance outline) (anchor circle))
|
||||
(primitives
|
||||
(gr_poly
|
||||
(pts
|
||||
(xy -0.396776 -0.094442)
|
||||
(xy 0.396776 -0.094442)
|
||||
(xy 0.396776 0.022402)
|
||||
(xy 0.324737 0.094442)
|
||||
(xy -0.324737 0.094442)
|
||||
(xy -0.396776 0.022402)
|
||||
)
|
||||
(width 0.173919) (fill yes))
|
||||
) (tstamp 98104fdc-d8a9-4b30-bc46-07b1452b5e7b))
|
||||
(pad "" smd roundrect (at -1.2 -1.2) (size 0.967471 0.967471) (layers "F.Paste") (roundrect_rratio 0.25) (tstamp 56615431-ec6b-49bf-b6c7-8e06a826515e))
|
||||
(pad "" smd roundrect (at -1.2 0) (size 0.967471 0.967471) (layers "F.Paste") (roundrect_rratio 0.25) (tstamp eca585ef-f6d3-44a2-9b23-06c0f135db6a))
|
||||
(pad "" smd roundrect (at -1.2 1.2) (size 0.967471 0.967471) (layers "F.Paste") (roundrect_rratio 0.25) (tstamp 1f5212d2-d855-4380-81b9-7da89c06b550))
|
||||
(pad "" smd custom (at -1.2 2.025) (size 0.275842 0.275842) (layers "F.Paste")
|
||||
(options (clearance outline) (anchor circle))
|
||||
(primitives
|
||||
(gr_poly
|
||||
(pts
|
||||
(xy -0.396776 -0.022402)
|
||||
(xy -0.324737 -0.094442)
|
||||
(xy 0.324737 -0.094442)
|
||||
(xy 0.396776 -0.022402)
|
||||
(xy 0.396776 0.094442)
|
||||
(xy -0.396776 0.094442)
|
||||
)
|
||||
(width 0.173919) (fill yes))
|
||||
) (tstamp 4d107af8-6e67-485f-97e4-a79041dfe91b))
|
||||
(pad "" smd custom (at 0 -2.025) (size 0.275842 0.275842) (layers "F.Paste")
|
||||
(options (clearance outline) (anchor circle))
|
||||
(primitives
|
||||
(gr_poly
|
||||
(pts
|
||||
(xy -0.396776 -0.094442)
|
||||
(xy 0.396776 -0.094442)
|
||||
(xy 0.396776 0.022402)
|
||||
(xy 0.324737 0.094442)
|
||||
(xy -0.324737 0.094442)
|
||||
(xy -0.396776 0.022402)
|
||||
)
|
||||
(width 0.173919) (fill yes))
|
||||
) (tstamp 69ce57af-8692-4681-851f-05bc6b7dcd2d))
|
||||
(pad "" smd roundrect (at 0 -1.2) (size 0.967471 0.967471) (layers "F.Paste") (roundrect_rratio 0.25) (tstamp 695d8e54-c6f8-4dfe-988d-304fb510d9b3))
|
||||
(pad "" smd roundrect (at 0 0) (size 0.967471 0.967471) (layers "F.Paste") (roundrect_rratio 0.25) (tstamp 9dc5aade-238d-41b5-a8bd-17246da04521))
|
||||
(pad "" smd roundrect (at 0 1.2) (size 0.967471 0.967471) (layers "F.Paste") (roundrect_rratio 0.25) (tstamp 68228e66-bac4-4d77-9622-0ebf44e75e11))
|
||||
(pad "" smd custom (at 0 2.025) (size 0.275842 0.275842) (layers "F.Paste")
|
||||
(options (clearance outline) (anchor circle))
|
||||
(primitives
|
||||
(gr_poly
|
||||
(pts
|
||||
(xy -0.396776 -0.022402)
|
||||
(xy -0.324737 -0.094442)
|
||||
(xy 0.324737 -0.094442)
|
||||
(xy 0.396776 -0.022402)
|
||||
(xy 0.396776 0.094442)
|
||||
(xy -0.396776 0.094442)
|
||||
)
|
||||
(width 0.173919) (fill yes))
|
||||
) (tstamp 29ba71eb-7459-4020-bf47-c0e12aaf082e))
|
||||
(pad "" smd custom (at 1.2 -2.025) (size 0.275842 0.275842) (layers "F.Paste")
|
||||
(options (clearance outline) (anchor circle))
|
||||
(primitives
|
||||
(gr_poly
|
||||
(pts
|
||||
(xy -0.396776 -0.094442)
|
||||
(xy 0.396776 -0.094442)
|
||||
(xy 0.396776 0.022402)
|
||||
(xy 0.324737 0.094442)
|
||||
(xy -0.324737 0.094442)
|
||||
(xy -0.396776 0.022402)
|
||||
)
|
||||
(width 0.173919) (fill yes))
|
||||
) (tstamp 5606937d-2462-41df-ae65-5390836b3089))
|
||||
(pad "" smd roundrect (at 1.2 -1.2) (size 0.967471 0.967471) (layers "F.Paste") (roundrect_rratio 0.25) (tstamp d95bc55d-5437-4ce2-a6a7-2f6f9bd08c83))
|
||||
(pad "" smd roundrect (at 1.2 0) (size 0.967471 0.967471) (layers "F.Paste") (roundrect_rratio 0.25) (tstamp 528e6ae8-c7f4-4de4-8a42-c1153f9c72ca))
|
||||
(pad "" smd roundrect (at 1.2 1.2) (size 0.967471 0.967471) (layers "F.Paste") (roundrect_rratio 0.25) (tstamp d957b47d-59f6-4d60-b26c-b5bcb6627e0c))
|
||||
(pad "" smd custom (at 1.2 2.025) (size 0.275842 0.275842) (layers "F.Paste")
|
||||
(options (clearance outline) (anchor circle))
|
||||
(primitives
|
||||
(gr_poly
|
||||
(pts
|
||||
(xy -0.396776 -0.022402)
|
||||
(xy -0.324737 -0.094442)
|
||||
(xy 0.324737 -0.094442)
|
||||
(xy 0.396776 -0.022402)
|
||||
(xy 0.396776 0.094442)
|
||||
(xy -0.396776 0.094442)
|
||||
)
|
||||
(width 0.173919) (fill yes))
|
||||
) (tstamp 1940cced-0695-4c6b-95a8-ed760b617735))
|
||||
(pad "" smd custom (at 2.225 -2.025) (size 0.251864 0.251864) (layers "F.Paste")
|
||||
(options (clearance outline) (anchor circle))
|
||||
(primitives
|
||||
(gr_poly
|
||||
(pts
|
||||
(xy -0.251946 -0.0907)
|
||||
(xy 0.251946 -0.0907)
|
||||
(xy 0.251946 0.0907)
|
||||
(xy -0.148187 0.0907)
|
||||
(xy -0.251946 -0.013058)
|
||||
)
|
||||
(width 0.181401) (fill yes))
|
||||
) (tstamp fe6b212c-b08d-40e8-b6af-119b0a54a6f8))
|
||||
(pad "" smd roundrect (at 2.225 -1.2) (size 0.685292 0.967471) (layers "F.Paste") (roundrect_rratio 0.25) (tstamp 29ae4d63-60a3-400a-9119-0444f5c74a7d))
|
||||
(pad "" smd roundrect (at 2.225 0) (size 0.685292 0.967471) (layers "F.Paste") (roundrect_rratio 0.25) (tstamp 3b4198a9-29e7-4b87-ab6b-39a740dc63ea))
|
||||
(pad "" smd roundrect (at 2.225 1.2) (size 0.685292 0.967471) (layers "F.Paste") (roundrect_rratio 0.25) (tstamp 95f63383-7bcd-4986-a9d4-5411fc4cc19b))
|
||||
(pad "" smd custom (at 2.225 2.025) (size 0.251864 0.251864) (layers "F.Paste")
|
||||
(options (clearance outline) (anchor circle))
|
||||
(primitives
|
||||
(gr_poly
|
||||
(pts
|
||||
(xy -0.251946 0.013058)
|
||||
(xy -0.148187 -0.0907)
|
||||
(xy 0.251946 -0.0907)
|
||||
(xy 0.251946 0.0907)
|
||||
(xy -0.251946 0.0907)
|
||||
)
|
||||
(width 0.181401) (fill yes))
|
||||
) (tstamp 5851fa62-7fbc-4c3e-b562-32571c57b543))
|
||||
(pad "1" smd roundrect (at -5.6625 -3.8) (size 1.475 0.25) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp 4daef23d-07c8-4f34-8723-ed9bc3d6b6cb))
|
||||
(pad "2" smd roundrect (at -5.6625 -3.4) (size 1.475 0.25) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp 80bbd5c1-90c3-4e16-84cb-d1a9ad4f4555))
|
||||
(pad "3" smd roundrect (at -5.6625 -3) (size 1.475 0.25) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp 57798149-8b9a-42cd-a306-84d63971dbfd))
|
||||
(pad "4" smd roundrect (at -5.6625 -2.6) (size 1.475 0.25) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp 71c128b4-c833-4d94-a2ee-bc4af75063ce))
|
||||
(pad "5" smd roundrect (at -5.6625 -2.2) (size 1.475 0.25) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp e2e6943e-5dd0-47ee-9ccf-d93c05d6aa7d))
|
||||
(pad "6" smd roundrect (at -5.6625 -1.8) (size 1.475 0.25) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp 681064bb-a98c-4135-a898-1667adbad002))
|
||||
(pad "7" smd roundrect (at -5.6625 -1.4) (size 1.475 0.25) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp 61d7c1c5-09a6-4353-80e6-349f7b9d1c44))
|
||||
(pad "8" smd roundrect (at -5.6625 -1) (size 1.475 0.25) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp a40afa06-82eb-4b41-8b78-afcd4b56635f))
|
||||
(pad "9" smd roundrect (at -5.6625 -0.6) (size 1.475 0.25) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp bbe7b114-0763-4f51-9471-ee9f1ddddb2d))
|
||||
(pad "10" smd roundrect (at -5.6625 -0.2) (size 1.475 0.25) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp bb46ccb4-88df-4333-82a5-9639d064c1a7))
|
||||
(pad "11" smd roundrect (at -5.6625 0.2) (size 1.475 0.25) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp 1f61fe27-8c24-48bb-9ec9-f5fa56292bda))
|
||||
(pad "12" smd roundrect (at -5.6625 0.6) (size 1.475 0.25) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp cf3c9f3a-b1d8-4ce2-a95d-aba48d872ab4))
|
||||
(pad "13" smd roundrect (at -5.6625 1) (size 1.475 0.25) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp 798cbbb5-1c07-4b16-81c5-e3d269aa517c))
|
||||
(pad "14" smd roundrect (at -5.6625 1.4) (size 1.475 0.25) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp 25796559-fe4a-4b6e-88fb-aab86db9b3d5))
|
||||
(pad "15" smd roundrect (at -5.6625 1.8) (size 1.475 0.25) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp c8e0607f-0619-497f-aac3-2c542027833b))
|
||||
(pad "16" smd roundrect (at -5.6625 2.2) (size 1.475 0.25) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp 505371d5-69e1-4023-a2b3-9078c042c98a))
|
||||
(pad "17" smd roundrect (at -5.6625 2.6) (size 1.475 0.25) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp 8320eb5d-5dee-4299-b385-226c77bd4226))
|
||||
(pad "18" smd roundrect (at -5.6625 3) (size 1.475 0.25) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp 28d36ebb-6a23-474f-b96b-0ab32b065c7a))
|
||||
(pad "19" smd roundrect (at -5.6625 3.4) (size 1.475 0.25) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp d61558ae-2451-42fe-a996-6e0d836f682f))
|
||||
(pad "20" smd roundrect (at -5.6625 3.8) (size 1.475 0.25) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp 2ef10c3c-1b85-4037-8003-17be6f26d23f))
|
||||
(pad "21" smd roundrect (at -3.8 5.6625) (size 0.25 1.475) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp 94cae820-b620-4a09-a1e9-8e2476592263))
|
||||
(pad "22" smd roundrect (at -3.4 5.6625) (size 0.25 1.475) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp 1cd4d34c-e3f5-413a-aae5-f4089b83270a))
|
||||
(pad "23" smd roundrect (at -3 5.6625) (size 0.25 1.475) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp cc110e54-3685-4781-b4eb-35134891a364))
|
||||
(pad "24" smd roundrect (at -2.6 5.6625) (size 0.25 1.475) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp 589ed67a-fcfc-42c3-9a97-d82870d65f96))
|
||||
(pad "25" smd roundrect (at -2.2 5.6625) (size 0.25 1.475) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp cb26aabe-ef10-4d14-a7de-83a599d1cd24))
|
||||
(pad "26" smd roundrect (at -1.8 5.6625) (size 0.25 1.475) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp 806dbab8-f1ed-4d80-bbaa-f9e2087abd20))
|
||||
(pad "27" smd roundrect (at -1.4 5.6625) (size 0.25 1.475) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp 1cc486d5-ab04-4f7c-a154-5b58bbecde54))
|
||||
(pad "28" smd roundrect (at -1 5.6625) (size 0.25 1.475) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp c66c7a13-3792-4c28-9d48-c10990aa30cb))
|
||||
(pad "29" smd roundrect (at -0.6 5.6625) (size 0.25 1.475) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp 2b623c24-987e-4f8f-804c-29f4a63dc949))
|
||||
(pad "30" smd roundrect (at -0.2 5.6625) (size 0.25 1.475) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp e2746c2b-6047-412a-b9f0-aac5f4817b1b))
|
||||
(pad "31" smd roundrect (at 0.2 5.6625) (size 0.25 1.475) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp a363212b-60c8-4d69-a56b-078490918f7f))
|
||||
(pad "32" smd roundrect (at 0.6 5.6625) (size 0.25 1.475) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp cd117bd9-1811-440a-a334-753a9914a021))
|
||||
(pad "33" smd roundrect (at 1 5.6625) (size 0.25 1.475) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp f79260c8-8985-4e34-b936-b31b559f4784))
|
||||
(pad "34" smd roundrect (at 1.4 5.6625) (size 0.25 1.475) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp 2c6f0908-3752-4f4e-8e4e-71db83bcc7a1))
|
||||
(pad "35" smd roundrect (at 1.8 5.6625) (size 0.25 1.475) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp b743a367-cb36-410c-80f8-f09e10b366ef))
|
||||
(pad "36" smd roundrect (at 2.2 5.6625) (size 0.25 1.475) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp 27e31d4b-d83e-4150-8a9f-3473455e2447))
|
||||
(pad "37" smd roundrect (at 2.6 5.6625) (size 0.25 1.475) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp d829991f-31cf-48e9-ac59-c0db20d007cb))
|
||||
(pad "38" smd roundrect (at 3 5.6625) (size 0.25 1.475) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp 4d35a71c-1c0a-4db4-a544-d0970f9bc662))
|
||||
(pad "39" smd roundrect (at 3.4 5.6625) (size 0.25 1.475) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp 33fae0a6-c7e8-4bc2-a2ec-9960a3f24fea))
|
||||
(pad "40" smd roundrect (at 3.8 5.6625) (size 0.25 1.475) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp 6714c4a3-e4fe-488d-a47c-0fb19a41c6e6))
|
||||
(pad "41" smd roundrect (at 5.6625 3.8) (size 1.475 0.25) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp c91bdcda-0ef9-4442-8028-f8a016a4eda0))
|
||||
(pad "42" smd roundrect (at 5.6625 3.4) (size 1.475 0.25) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp cdf5baa1-903b-41c8-a8fc-da83e43ba080))
|
||||
(pad "43" smd roundrect (at 5.6625 3) (size 1.475 0.25) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp fe8e28cf-2551-4e27-ab22-2a4ef391cc43))
|
||||
(pad "44" smd roundrect (at 5.6625 2.6) (size 1.475 0.25) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp 3457736e-76df-4073-aa88-d2d0b90f6279))
|
||||
(pad "45" smd roundrect (at 5.6625 2.2) (size 1.475 0.25) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp 202baced-75c6-43f6-9c65-e0e33beedfbb))
|
||||
(pad "46" smd roundrect (at 5.6625 1.8) (size 1.475 0.25) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp 93553dd1-e0c9-49de-af0c-42a0849eee29))
|
||||
(pad "47" smd roundrect (at 5.6625 1.4) (size 1.475 0.25) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp b25f7e27-2b15-4933-9905-4bdf1dd499c7))
|
||||
(pad "48" smd roundrect (at 5.6625 1) (size 1.475 0.25) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp 8cbb89ee-3844-4a26-88ae-c4345619c983))
|
||||
(pad "49" smd roundrect (at 5.6625 0.6) (size 1.475 0.25) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp a533518f-f81b-481e-ad7b-4d5e9198a1f7))
|
||||
(pad "50" smd roundrect (at 5.6625 0.2) (size 1.475 0.25) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp 3a2a942e-c501-4fd4-84ea-3ad96ff1a192))
|
||||
(pad "51" smd roundrect (at 5.6625 -0.2) (size 1.475 0.25) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp 79f0f9b9-9b21-45f3-97e2-88ba82ce088c))
|
||||
(pad "52" smd roundrect (at 5.6625 -0.6) (size 1.475 0.25) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp c4aa2af9-475d-4b77-ba9c-90f14ca002ce))
|
||||
(pad "53" smd roundrect (at 5.6625 -1) (size 1.475 0.25) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp 96e062a8-bb55-423a-9a24-47af09eb9c9e))
|
||||
(pad "54" smd roundrect (at 5.6625 -1.4) (size 1.475 0.25) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp f9a9aabe-e5f2-42fc-9d57-c3e2a45a9768))
|
||||
(pad "55" smd roundrect (at 5.6625 -1.8) (size 1.475 0.25) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp b05c78a8-6fd1-46d2-a9f0-39acd1c3760b))
|
||||
(pad "56" smd roundrect (at 5.6625 -2.2) (size 1.475 0.25) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp 6a0eaa31-4f55-4617-8f34-6a1acdd3140e))
|
||||
(pad "57" smd roundrect (at 5.6625 -2.6) (size 1.475 0.25) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp 088cb985-3a4f-4c5b-9fa5-65d48ad13894))
|
||||
(pad "58" smd roundrect (at 5.6625 -3) (size 1.475 0.25) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp 5682c911-0567-497c-92ed-dd7984108790))
|
||||
(pad "59" smd roundrect (at 5.6625 -3.4) (size 1.475 0.25) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp 4bac6f90-0038-422e-a1eb-10dfcb1f7dd7))
|
||||
(pad "60" smd roundrect (at 5.6625 -3.8) (size 1.475 0.25) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp 0b95bd24-1012-4fe1-801b-d26fcd007595))
|
||||
(pad "61" smd roundrect (at 3.8 -5.6625) (size 0.25 1.475) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp 282de30a-8759-4271-ba7b-3ebbf5196414))
|
||||
(pad "62" smd roundrect (at 3.4 -5.6625) (size 0.25 1.475) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp 0f23526c-60d9-4637-aedf-656bf5417285))
|
||||
(pad "63" smd roundrect (at 3 -5.6625) (size 0.25 1.475) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp 863d77fb-3c5f-45c9-b14c-3810b3f25173))
|
||||
(pad "64" smd roundrect (at 2.6 -5.6625) (size 0.25 1.475) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp 0c69ca09-47d5-4a65-af2e-bdb0338ae166))
|
||||
(pad "65" smd roundrect (at 2.2 -5.6625) (size 0.25 1.475) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp 9de94c1c-dcee-4f27-88b6-beddb05a688b))
|
||||
(pad "66" smd roundrect (at 1.8 -5.6625) (size 0.25 1.475) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp 5766892b-b632-4f08-a7d8-8c08c196450c))
|
||||
(pad "67" smd roundrect (at 1.4 -5.6625) (size 0.25 1.475) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp fb2f46f5-c78f-4fbd-ba08-8a4100c976d8))
|
||||
(pad "68" smd roundrect (at 1 -5.6625) (size 0.25 1.475) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp 6d6e1fad-c06e-4786-a691-fba5e9dd0e1b))
|
||||
(pad "69" smd roundrect (at 0.6 -5.6625) (size 0.25 1.475) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp 42103648-634c-419f-9fbc-4ba66b82d1aa))
|
||||
(pad "70" smd roundrect (at 0.2 -5.6625) (size 0.25 1.475) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp 1eaf98ee-0640-45c9-b717-2450f475a292))
|
||||
(pad "71" smd roundrect (at -0.2 -5.6625) (size 0.25 1.475) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp 27bfab82-b658-43fa-8d50-59ee0ca72d97))
|
||||
(pad "72" smd roundrect (at -0.6 -5.6625) (size 0.25 1.475) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp 60e5fc74-08a3-4db8-a1c0-4684abffcb6a))
|
||||
(pad "73" smd roundrect (at -1 -5.6625) (size 0.25 1.475) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp 22608ae5-d499-4454-b51d-86f40e1f9679))
|
||||
(pad "74" smd roundrect (at -1.4 -5.6625) (size 0.25 1.475) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp ac334e14-408a-44ca-a5f3-9ac479bf2303))
|
||||
(pad "75" smd roundrect (at -1.8 -5.6625) (size 0.25 1.475) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp eb85667d-1d76-4a1a-b218-6420eed784e8))
|
||||
(pad "76" smd roundrect (at -2.2 -5.6625) (size 0.25 1.475) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp 4e722732-36fb-479b-816a-a6981bfd2e2c))
|
||||
(pad "77" smd roundrect (at -2.6 -5.6625) (size 0.25 1.475) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp d14f7c99-5641-42a7-9325-1fc1bdebad7d))
|
||||
(pad "78" smd roundrect (at -3 -5.6625) (size 0.25 1.475) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp 08220d57-c9b6-4a80-b56b-f9d237a90e79))
|
||||
(pad "79" smd roundrect (at -3.4 -5.6625) (size 0.25 1.475) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp 9d5bd4e3-9c57-429e-8f79-5eb9908f5665))
|
||||
(pad "80" smd roundrect (at -3.8 -5.6625) (size 0.25 1.475) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (tstamp 56578a29-4295-4269-b1c7-4244a7f89431))
|
||||
(pad "81" thru_hole circle (at -1.8 -1.8) (size 0.5 0.5) (drill 0.2) (layers "*.Cu") (tstamp 16391819-43ac-4734-80c1-34ad12a20b03))
|
||||
(pad "81" thru_hole circle (at -1.8 -0.6) (size 0.5 0.5) (drill 0.2) (layers "*.Cu") (tstamp c79c41d4-2bbc-4f52-a74b-31a4fba09e9b))
|
||||
(pad "81" thru_hole circle (at -1.8 0.6) (size 0.5 0.5) (drill 0.2) (layers "*.Cu") (tstamp 46d71156-7c0a-47c6-999d-2d75a92a9dcd))
|
||||
(pad "81" thru_hole circle (at -1.8 1.8) (size 0.5 0.5) (drill 0.2) (layers "*.Cu") (tstamp 12a77539-6cda-47cc-962e-6d19266036b7))
|
||||
(pad "81" thru_hole circle (at -0.6 -1.8) (size 0.5 0.5) (drill 0.2) (layers "*.Cu") (tstamp adb21cd2-d504-44d7-99f1-8a56890c2bed))
|
||||
(pad "81" thru_hole circle (at -0.6 -0.6) (size 0.5 0.5) (drill 0.2) (layers "*.Cu") (tstamp 0bbaa0b7-6acc-46ea-9259-124b37923068))
|
||||
(pad "81" thru_hole circle (at -0.6 0.6) (size 0.5 0.5) (drill 0.2) (layers "*.Cu") (tstamp 3af3c50a-a553-41cb-aaad-4b5d4451be2c))
|
||||
(pad "81" thru_hole circle (at -0.6 1.8) (size 0.5 0.5) (drill 0.2) (layers "*.Cu") (tstamp c286aaae-6526-436f-930d-3b059458a276))
|
||||
(pad "81" smd rect (at 0 0) (size 4.1 4.1) (layers "B.Cu") (tstamp 3524f943-29c4-43e0-92bc-5a9a84114d38))
|
||||
(pad "81" smd rect (at 0 0) (size 5.3 4.5) (layers "F.Cu" "F.Mask") (tstamp 88727049-5477-40c7-8453-c60008c63992))
|
||||
(pad "81" thru_hole circle (at 0.6 -1.8) (size 0.5 0.5) (drill 0.2) (layers "*.Cu") (tstamp 7be4eceb-8fd4-44a3-ac4c-9e24c2e9defd))
|
||||
(pad "81" thru_hole circle (at 0.6 -0.6) (size 0.5 0.5) (drill 0.2) (layers "*.Cu") (tstamp b2019f80-ee10-4345-9965-c0bac17c6275))
|
||||
(pad "81" thru_hole circle (at 0.6 0.6) (size 0.5 0.5) (drill 0.2) (layers "*.Cu") (tstamp da8885f6-e2d7-4797-9607-cfb52f650bf0))
|
||||
(pad "81" thru_hole circle (at 0.6 1.8) (size 0.5 0.5) (drill 0.2) (layers "*.Cu") (tstamp aa3a8115-8e44-4ad1-bd65-ccd7f22502df))
|
||||
(pad "81" thru_hole circle (at 1.8 -1.8) (size 0.5 0.5) (drill 0.2) (layers "*.Cu") (tstamp 6706993c-a834-462c-8357-a40f1869517b))
|
||||
(pad "81" thru_hole circle (at 1.8 -0.6) (size 0.5 0.5) (drill 0.2) (layers "*.Cu") (tstamp 726bba8c-e324-4c4f-afdf-f6697cd388e4))
|
||||
(pad "81" thru_hole circle (at 1.8 0.6) (size 0.5 0.5) (drill 0.2) (layers "*.Cu") (tstamp 88fe9863-0350-4442-905f-e914481006f5))
|
||||
(pad "81" thru_hole circle (at 1.8 1.8) (size 0.5 0.5) (drill 0.2) (layers "*.Cu") (tstamp 118dd107-8d39-4899-a0da-068651ad52b7))
|
||||
(model "${KICAD7_3DMODEL_DIR}/Package_QFP.3dshapes/LQFP-80-1EP_10x10mm_P0.4mm_EP5.3x4.5mm.wrl"
|
||||
(offset (xyz 0 0 0))
|
||||
(scale (xyz 1 1 1))
|
||||
(rotate (xyz 0 0 0))
|
||||
)
|
||||
)
|
||||
@@ -0,0 +1,121 @@
|
||||
|
||||
(footprint MODULE_ESP32_DEVKIT_V1 (layer F.Cu) (tedit 6381D09B)
|
||||
(descr "")
|
||||
(fp_text reference REF** (at -11.355 -27.36 0) (layer F.SilkS)
|
||||
(effects (font (size 1.0 1.0) (thickness 0.15)))
|
||||
)
|
||||
(fp_text value MODULE_ESP32_DEVKIT_V1 (at -0.56 27.36 0) (layer F.Fab)
|
||||
(effects (font (size 1.0 1.0) (thickness 0.15)))
|
||||
)
|
||||
(pad 1 thru_hole rect (at -12.7 -15.515) (size 2.0 2.0) (drill 1.02) (layers *.Cu *.Mask))
|
||||
(pad 2 thru_hole circle (at -12.7 -12.975) (size 2.0 2.0) (drill 1.02) (layers *.Cu *.Mask))
|
||||
(pad 3 thru_hole circle (at -12.7 -10.435) (size 2.0 2.0) (drill 1.02) (layers *.Cu *.Mask))
|
||||
(pad 4 thru_hole circle (at -12.7 -7.895) (size 2.0 2.0) (drill 1.02) (layers *.Cu *.Mask))
|
||||
(pad 5 thru_hole circle (at -12.7 -5.355) (size 2.0 2.0) (drill 1.02) (layers *.Cu *.Mask))
|
||||
(pad 6 thru_hole circle (at -12.7 -2.815) (size 2.0 2.0) (drill 1.02) (layers *.Cu *.Mask))
|
||||
(pad 7 thru_hole circle (at -12.7 -0.275) (size 2.0 2.0) (drill 1.02) (layers *.Cu *.Mask))
|
||||
(pad 8 thru_hole circle (at -12.7 2.265) (size 2.0 2.0) (drill 1.02) (layers *.Cu *.Mask))
|
||||
(pad 9 thru_hole circle (at -12.7 4.805) (size 2.0 2.0) (drill 1.02) (layers *.Cu *.Mask))
|
||||
(pad 10 thru_hole circle (at -12.7 7.345) (size 2.0 2.0) (drill 1.02) (layers *.Cu *.Mask))
|
||||
(pad 11 thru_hole circle (at -12.7 9.885) (size 2.0 2.0) (drill 1.02) (layers *.Cu *.Mask))
|
||||
(pad 12 thru_hole circle (at -12.7 12.425) (size 2.0 2.0) (drill 1.02) (layers *.Cu *.Mask))
|
||||
(pad 13 thru_hole circle (at -12.7 14.965) (size 2.0 2.0) (drill 1.02) (layers *.Cu *.Mask))
|
||||
(pad 14 thru_hole circle (at -12.7 17.505) (size 2.0 2.0) (drill 1.02) (layers *.Cu *.Mask))
|
||||
(pad 15 thru_hole circle (at -12.7 20.045) (size 2.0 2.0) (drill 1.02) (layers *.Cu *.Mask))
|
||||
(pad 30 thru_hole circle (at 12.7 -15.515) (size 2.0 2.0) (drill 1.02) (layers *.Cu *.Mask))
|
||||
(pad 29 thru_hole circle (at 12.7 -12.975) (size 2.0 2.0) (drill 1.02) (layers *.Cu *.Mask))
|
||||
(pad 28 thru_hole circle (at 12.7 -10.435) (size 2.0 2.0) (drill 1.02) (layers *.Cu *.Mask))
|
||||
(pad 27 thru_hole circle (at 12.7 -7.895) (size 2.0 2.0) (drill 1.02) (layers *.Cu *.Mask))
|
||||
(pad 26 thru_hole circle (at 12.7 -5.355) (size 2.0 2.0) (drill 1.02) (layers *.Cu *.Mask))
|
||||
(pad 25 thru_hole circle (at 12.7 -2.815) (size 2.0 2.0) (drill 1.02) (layers *.Cu *.Mask))
|
||||
(pad 24 thru_hole circle (at 12.7 -0.275) (size 2.0 2.0) (drill 1.02) (layers *.Cu *.Mask))
|
||||
(pad 23 thru_hole circle (at 12.7 2.265) (size 2.0 2.0) (drill 1.02) (layers *.Cu *.Mask))
|
||||
(pad 22 thru_hole circle (at 12.7 4.805) (size 2.0 2.0) (drill 1.02) (layers *.Cu *.Mask))
|
||||
(pad 21 thru_hole circle (at 12.7 7.345) (size 2.0 2.0) (drill 1.02) (layers *.Cu *.Mask))
|
||||
(pad 20 thru_hole circle (at 12.7 9.885) (size 2.0 2.0) (drill 1.02) (layers *.Cu *.Mask))
|
||||
(pad 19 thru_hole circle (at 12.7 12.425) (size 2.0 2.0) (drill 1.02) (layers *.Cu *.Mask))
|
||||
(pad 18 thru_hole circle (at 12.7 14.965) (size 2.0 2.0) (drill 1.02) (layers *.Cu *.Mask))
|
||||
(pad 17 thru_hole circle (at 12.7 17.505) (size 2.0 2.0) (drill 1.02) (layers *.Cu *.Mask))
|
||||
(pad 16 thru_hole circle (at 12.7 20.045) (size 2.0 2.0) (drill 1.02) (layers *.Cu *.Mask))
|
||||
(pad None np_thru_hole circle (at -12.28 23.475) (size 3.0 3.0) (drill 3.0) (layers *.Cu *.Mask))
|
||||
(pad None np_thru_hole circle (at 12.23 23.475) (size 3.0 3.0) (drill 3.0) (layers *.Cu *.Mask))
|
||||
(pad None np_thru_hole circle (at 12.23 -23.475) (size 3.0 3.0) (drill 3.0) (layers *.Cu *.Mask))
|
||||
(pad None np_thru_hole circle (at -12.28 -23.475) (size 3.0 3.0) (drill 3.0) (layers *.Cu *.Mask))
|
||||
(fp_line (start -14.28 -25.475) (end -3.211 -25.475) (layer F.Fab) (width 0.127))
|
||||
(fp_line (start -3.211 -25.475) (end 3.5 -25.475) (layer F.Fab) (width 0.127))
|
||||
(fp_line (start 3.5 -25.475) (end 14.23 -25.475) (layer F.Fab) (width 0.127))
|
||||
(fp_line (start 14.23 -25.475) (end 14.23 25.475) (layer F.SilkS) (width 0.127))
|
||||
(fp_line (start 14.23 25.475) (end -14.28 25.475) (layer F.SilkS) (width 0.127))
|
||||
(fp_line (start -14.28 25.475) (end -14.28 -25.475) (layer F.Fab) (width 0.127))
|
||||
(fp_line (start -14.28 -25.475) (end 14.23 -25.475) (layer F.SilkS) (width 0.127))
|
||||
(fp_line (start -14.28 25.475) (end -14.28 -25.475) (layer F.SilkS) (width 0.127))
|
||||
(fp_circle (center -14.85 -15.515) (end -14.75 -15.515) (layer F.SilkS) (width 0.2))
|
||||
(fp_circle (center -14.85 -15.515) (end -14.75 -15.515) (layer F.Fab) (width 0.2))
|
||||
(fp_line (start 14.23 -25.475) (end 14.23 25.475) (layer F.Fab) (width 0.127))
|
||||
(fp_line (start -14.28 25.475) (end -8.91 25.475) (layer F.Fab) (width 0.127))
|
||||
(fp_line (start -8.91 25.475) (end 8.78 25.475) (layer F.Fab) (width 0.127))
|
||||
(fp_line (start 8.78 25.475) (end 14.23 25.475) (layer F.Fab) (width 0.127))
|
||||
(fp_line (start -8.91 25.475) (end -8.91 18.985) (layer F.Fab) (width 0.127))
|
||||
(fp_line (start -8.91 18.985) (end -8.91 6.355) (layer F.Fab) (width 0.127))
|
||||
(fp_line (start -8.91 6.355) (end 8.78 6.355) (layer F.Fab) (width 0.127))
|
||||
(fp_line (start 8.78 6.355) (end 8.78 18.985) (layer F.Fab) (width 0.127))
|
||||
(fp_line (start 8.78 18.985) (end 8.78 25.475) (layer F.Fab) (width 0.127))
|
||||
(fp_line (start -8.91 18.985) (end 8.78 18.985) (layer F.Fab) (width 0.127))
|
||||
(fp_line (start 3.5 -25.475) (end 3.5 -21.585) (layer F.Fab) (width 0.127))
|
||||
(fp_line (start 3.5 -21.585) (end -3.211 -21.585) (layer F.Fab) (width 0.127))
|
||||
(fp_line (start -3.211 -21.585) (end -3.211 -25.475) (layer F.Fab) (width 0.127))
|
||||
(zone (net 0) (net_name "") (layer F.Cu) (hatch full 0.508)
|
||||
(connect_pads (clearance 0))
|
||||
(min_thickness 0.01)
|
||||
(keepout (tracks not_allowed) (vias not_allowed) (pads not_allowed ) (copperpour not_allowed) (footprints allowed))
|
||||
(fill (thermal_gap 0.508) (thermal_bridge_width 0.508))
|
||||
(polygon
|
||||
(pts
|
||||
(xy -8.91 18.985)
|
||||
(xy 8.78 18.985)
|
||||
(xy 8.78 25.475)
|
||||
(xy -8.91 25.475)
|
||||
)
|
||||
)
|
||||
)
|
||||
(zone (net 0) (net_name "") (layers *.Cu) (hatch full 0.508)
|
||||
(connect_pads (clearance 0))
|
||||
(min_thickness 0.01)
|
||||
(keepout (tracks allowed) (vias not_allowed) (pads allowed ) (copperpour allowed) (footprints allowed))
|
||||
(fill (thermal_gap 0.508) (thermal_bridge_width 0.508))
|
||||
(polygon
|
||||
(pts
|
||||
(xy -8.91 18.985)
|
||||
(xy 8.78 18.985)
|
||||
(xy 8.78 25.475)
|
||||
(xy -8.91 25.475)
|
||||
)
|
||||
)
|
||||
)
|
||||
(zone (net 0) (net_name "") (layer B.Cu) (hatch full 0.508)
|
||||
(connect_pads (clearance 0))
|
||||
(min_thickness 0.01)
|
||||
(keepout (tracks not_allowed) (vias not_allowed) (pads not_allowed ) (copperpour not_allowed) (footprints allowed))
|
||||
(fill (thermal_gap 0.508) (thermal_bridge_width 0.508))
|
||||
(polygon
|
||||
(pts
|
||||
(xy -8.91 18.985)
|
||||
(xy 8.78 18.985)
|
||||
(xy 8.78 25.475)
|
||||
(xy -8.91 25.475)
|
||||
)
|
||||
)
|
||||
)
|
||||
(fp_line (start -14.28 -25.475) (end -3.211 -25.475) (layer F.SilkS) (width 0.127))
|
||||
(fp_line (start -3.211 -25.475) (end 3.5 -25.475) (layer F.SilkS) (width 0.127))
|
||||
(fp_line (start 3.5 -25.475) (end 14.23 -25.475) (layer F.SilkS) (width 0.127))
|
||||
(fp_line (start -14.28 25.475) (end -14.28 -25.475) (layer F.SilkS) (width 0.127))
|
||||
(fp_line (start 14.23 -25.475) (end 14.23 25.475) (layer F.SilkS) (width 0.127))
|
||||
(fp_line (start -14.28 25.475) (end -8.91 25.475) (layer F.SilkS) (width 0.127))
|
||||
(fp_line (start -8.91 25.475) (end 8.78 25.475) (layer F.SilkS) (width 0.127))
|
||||
(fp_line (start 8.78 25.475) (end 14.23 25.475) (layer F.SilkS) (width 0.127))
|
||||
(fp_line (start -14.53 -25.725) (end -14.53 25.725) (layer F.CrtYd) (width 0.05))
|
||||
(fp_line (start -14.53 25.725) (end 14.48 25.725) (layer F.CrtYd) (width 0.05))
|
||||
(fp_line (start 14.48 25.725) (end 14.48 -25.725) (layer F.CrtYd) (width 0.05))
|
||||
(fp_line (start 14.48 -25.725) (end -14.53 -25.725) (layer F.CrtYd) (width 0.05))
|
||||
)
|
||||
@@ -0,0 +1,64 @@
|
||||
|
||||
(footprint MODULE_ESP32_NODEMCU (layer F.Cu) (tedit 6381D25E)
|
||||
(descr "")
|
||||
(fp_text reference REF** (at -11.075 -29.385 0) (layer F.SilkS)
|
||||
(effects (font (size 1.0 1.0) (thickness 0.15)))
|
||||
)
|
||||
(fp_text value MODULE_ESP32_NODEMCU (at -1.55 29.385 0) (layer F.Fab)
|
||||
(effects (font (size 1.0 1.0) (thickness 0.15)))
|
||||
)
|
||||
(pad J5_19 thru_hole circle (at -13.0 -22.86) (size 1.35 1.35) (drill 0.9) (layers *.Cu *.Mask))
|
||||
(pad J5_18 thru_hole circle (at -13.0 -20.32) (size 1.35 1.35) (drill 0.9) (layers *.Cu *.Mask))
|
||||
(pad J5_1 thru_hole rect (at -13.0 22.86) (size 1.35 1.35) (drill 0.9) (layers *.Cu *.Mask))
|
||||
(pad J5_17 thru_hole circle (at -13.0 -17.78) (size 1.35 1.35) (drill 0.9) (layers *.Cu *.Mask))
|
||||
(pad J5_16 thru_hole circle (at -13.0 -15.24) (size 1.35 1.35) (drill 0.9) (layers *.Cu *.Mask))
|
||||
(pad J5_15 thru_hole circle (at -13.0 -12.7) (size 1.35 1.35) (drill 0.9) (layers *.Cu *.Mask))
|
||||
(pad J5_14 thru_hole circle (at -13.0 -10.16) (size 1.35 1.35) (drill 0.9) (layers *.Cu *.Mask))
|
||||
(pad J5_13 thru_hole circle (at -13.0 -7.62) (size 1.35 1.35) (drill 0.9) (layers *.Cu *.Mask))
|
||||
(pad J5_12 thru_hole circle (at -13.0 -5.08) (size 1.35 1.35) (drill 0.9) (layers *.Cu *.Mask))
|
||||
(pad J5_11 thru_hole circle (at -13.0 -2.54) (size 1.35 1.35) (drill 0.9) (layers *.Cu *.Mask))
|
||||
(pad J5_10 thru_hole circle (at -13.0 0.0) (size 1.35 1.35) (drill 0.9) (layers *.Cu *.Mask))
|
||||
(pad J5_9 thru_hole circle (at -13.0 2.54) (size 1.35 1.35) (drill 0.9) (layers *.Cu *.Mask))
|
||||
(pad J5_8 thru_hole circle (at -13.0 5.08) (size 1.35 1.35) (drill 0.9) (layers *.Cu *.Mask))
|
||||
(pad J5_7 thru_hole circle (at -13.0 7.62) (size 1.35 1.35) (drill 0.9) (layers *.Cu *.Mask))
|
||||
(pad J5_6 thru_hole circle (at -13.0 10.16) (size 1.35 1.35) (drill 0.9) (layers *.Cu *.Mask))
|
||||
(pad J5_5 thru_hole circle (at -13.0 12.7) (size 1.35 1.35) (drill 0.9) (layers *.Cu *.Mask))
|
||||
(pad J5_4 thru_hole circle (at -13.0 15.24) (size 1.35 1.35) (drill 0.9) (layers *.Cu *.Mask))
|
||||
(pad J5_3 thru_hole circle (at -13.0 17.78) (size 1.35 1.35) (drill 0.9) (layers *.Cu *.Mask))
|
||||
(pad J5_2 thru_hole circle (at -13.0 20.32) (size 1.35 1.35) (drill 0.9) (layers *.Cu *.Mask))
|
||||
(pad J4_19 thru_hole circle (at 13.0 22.86) (size 1.35 1.35) (drill 0.9) (layers *.Cu *.Mask))
|
||||
(pad J4_18 thru_hole circle (at 13.0 20.32) (size 1.35 1.35) (drill 0.9) (layers *.Cu *.Mask))
|
||||
(pad J4_17 thru_hole circle (at 13.0 17.78) (size 1.35 1.35) (drill 0.9) (layers *.Cu *.Mask))
|
||||
(pad J4_16 thru_hole circle (at 13.0 15.24) (size 1.35 1.35) (drill 0.9) (layers *.Cu *.Mask))
|
||||
(pad J4_15 thru_hole circle (at 13.0 12.7) (size 1.35 1.35) (drill 0.9) (layers *.Cu *.Mask))
|
||||
(pad J4_14 thru_hole circle (at 13.0 10.16) (size 1.35 1.35) (drill 0.9) (layers *.Cu *.Mask))
|
||||
(pad J4_13 thru_hole circle (at 13.0 7.62) (size 1.35 1.35) (drill 0.9) (layers *.Cu *.Mask))
|
||||
(pad J4_12 thru_hole circle (at 13.0 5.08) (size 1.35 1.35) (drill 0.9) (layers *.Cu *.Mask))
|
||||
(pad J4_11 thru_hole circle (at 13.0 2.54) (size 1.35 1.35) (drill 0.9) (layers *.Cu *.Mask))
|
||||
(pad J4_10 thru_hole circle (at 13.0 0.0) (size 1.35 1.35) (drill 0.9) (layers *.Cu *.Mask))
|
||||
(pad J4_9 thru_hole circle (at 13.0 -2.54) (size 1.35 1.35) (drill 0.9) (layers *.Cu *.Mask))
|
||||
(pad J4_8 thru_hole circle (at 13.0 -5.08) (size 1.35 1.35) (drill 0.9) (layers *.Cu *.Mask))
|
||||
(pad J4_7 thru_hole circle (at 13.0 -7.62) (size 1.35 1.35) (drill 0.9) (layers *.Cu *.Mask))
|
||||
(pad J4_6 thru_hole circle (at 13.0 -10.16) (size 1.35 1.35) (drill 0.9) (layers *.Cu *.Mask))
|
||||
(pad J4_5 thru_hole circle (at 13.0 -12.7) (size 1.35 1.35) (drill 0.9) (layers *.Cu *.Mask))
|
||||
(pad J4_4 thru_hole circle (at 13.0 -15.24) (size 1.35 1.35) (drill 0.9) (layers *.Cu *.Mask))
|
||||
(pad J4_3 thru_hole circle (at 13.0 -17.78) (size 1.35 1.35) (drill 0.9) (layers *.Cu *.Mask))
|
||||
(pad J4_2 thru_hole circle (at 13.0 -20.32) (size 1.35 1.35) (drill 0.9) (layers *.Cu *.Mask))
|
||||
(pad J4_1 thru_hole rect (at 13.0 -22.86) (size 1.35 1.35) (drill 0.9) (layers *.Cu *.Mask))
|
||||
(pad None np_thru_hole circle (at -12.5 26.0) (size 2.25 2.25) (drill 2.25) (layers *.Cu *.Mask))
|
||||
(pad None np_thru_hole circle (at 12.5 26.0) (size 2.25 2.25) (drill 2.25) (layers *.Cu *.Mask))
|
||||
(pad None np_thru_hole circle (at -12.5 -26.0) (size 2.25 2.25) (drill 2.25) (layers *.Cu *.Mask))
|
||||
(pad None np_thru_hole circle (at 12.5 -26.0) (size 2.25 2.25) (drill 2.25) (layers *.Cu *.Mask))
|
||||
(fp_line (start -14.0 27.5) (end -14.0 -27.5) (layer F.Fab) (width 0.127))
|
||||
(fp_line (start -14.0 -27.5) (end 14.0 -27.5) (layer F.Fab) (width 0.127))
|
||||
(fp_line (start 14.0 -27.5) (end 14.0 27.5) (layer F.Fab) (width 0.127))
|
||||
(fp_line (start 14.0 27.5) (end -14.0 27.5) (layer F.Fab) (width 0.127))
|
||||
(fp_line (start -14.0 -27.5) (end -14.0 27.5) (layer F.SilkS) (width 0.127))
|
||||
(fp_line (start -14.0 -27.5) (end 14.0 -27.5) (layer F.SilkS) (width 0.127))
|
||||
(fp_line (start 14.0 -27.5) (end 14.0 27.5) (layer F.SilkS) (width 0.127))
|
||||
(fp_line (start -14.0 27.5) (end 14.0 27.5) (layer F.SilkS) (width 0.127))
|
||||
(fp_line (start -14.25 -27.75) (end -14.25 27.75) (layer F.CrtYd) (width 0.05))
|
||||
(fp_line (start -14.25 27.75) (end 14.25 27.75) (layer F.CrtYd) (width 0.05))
|
||||
(fp_line (start 14.25 27.75) (end 14.25 -27.75) (layer F.CrtYd) (width 0.05))
|
||||
(fp_line (start 14.25 -27.75) (end -14.25 -27.75) (layer F.CrtYd) (width 0.05))
|
||||
)
|
||||
@@ -0,0 +1,19 @@
|
||||
(footprint "PWM_module_ebay" (version 20211014) (generator pcbnew)
|
||||
(layer "F.Cu")
|
||||
(tedit 0)
|
||||
(attr smd)
|
||||
(fp_text reference "REF**" (at 0 -0.5 unlocked) (layer "F.SilkS")
|
||||
(effects (font (size 1 1) (thickness 0.15)))
|
||||
(tstamp c8121568-d3f5-48c8-9ecf-a54c1a1074ad)
|
||||
)
|
||||
(fp_text value "PWM_module_ebay" (at 0 1 unlocked) (layer "F.Fab")
|
||||
(effects (font (size 1 1) (thickness 0.15)))
|
||||
(tstamp dd8648e9-e72b-41af-ac5a-778a58f169b2)
|
||||
)
|
||||
(fp_rect (start -2 -8.5) (end 31.5 8.5) (layer "F.SilkS") (width 0.12) (fill none) (tstamp 544f39f6-64e8-4f0a-a78a-5e28b7872f5b))
|
||||
(pad "1" thru_hole roundrect (at 0 -1.27) (size 2.286 1.524) (drill 0.9) (layers *.Cu *.Mask) (roundrect_rratio 0.25) (tstamp 6b50b86c-f9d8-4912-a87b-9d561db19997))
|
||||
(pad "2" thru_hole roundrect (at 0 1.27) (size 2.286 1.524) (drill 0.9) (layers *.Cu *.Mask) (roundrect_rratio 0.25) (tstamp 5f68daa8-c144-4203-bee1-0e7dc9fd2d2a))
|
||||
(pad "3" thru_hole roundrect (at 27.94 -3.5) (size 2.286 1.524) (drill 0.9) (layers *.Cu *.Mask) (roundrect_rratio 0.25) (tstamp 109eb1d6-b156-437a-a163-7bcc6259259e))
|
||||
(pad "4" thru_hole roundrect (at 27.94 0) (size 2.286 1.524) (drill 0.9) (layers *.Cu *.Mask) (roundrect_rratio 0.25) (tstamp aae80b99-f5f7-4cee-b9d6-1e8589696882))
|
||||
(pad "5" thru_hole roundrect (at 27.94 3.5) (size 2.286 1.524) (drill 0.9) (layers *.Cu *.Mask) (roundrect_rratio 0.25) (tstamp 39d93395-0259-4e7b-9e15-e09f030e816a))
|
||||
)
|
||||
@@ -0,0 +1,103 @@
|
||||
(footprint "PulseJack JB0011D01BNL" (version 20221018) (generator pcbnew)
|
||||
(layer "F.Cu")
|
||||
(descr "1 Port RJ45 Magjack Connector Through Hole 10/100 Base-T, AutoMDIX, https://www.amphenol-cs.com/media/wysiwyg/files/drawing/rjmg1bd3b8k1anr.pdf")
|
||||
(tags "RJ45 Magjack")
|
||||
(attr through_hole)
|
||||
(fp_text reference "REF**" (at -4.445 5.49 180) (layer "F.SilkS")
|
||||
(effects (font (size 1 1) (thickness 0.15)))
|
||||
(tstamp e2f1695c-beea-4fcf-8b80-b8ca5ba8d340)
|
||||
)
|
||||
(fp_text value "PulseJack JB0011D01BNL" (at -4.445 -18.23 180) (layer "F.Fab")
|
||||
(effects (font (size 1 1) (thickness 0.15)))
|
||||
(tstamp ba8f000b-59da-4929-ac44-88846ac40828)
|
||||
)
|
||||
(fp_text user "${REFERENCE}" (at -4.445 -6.37 180) (layer "F.Fab")
|
||||
(effects (font (size 1 1) (thickness 0.15)))
|
||||
(tstamp 9ca336cd-ca2e-4358-bf36-988a1e93b470)
|
||||
)
|
||||
(fp_line (start -12.42 -17.33) (end 3.53 -17.33)
|
||||
(stroke (width 0.12) (type solid)) (layer "F.SilkS") (tstamp 6cc8c013-9c97-410e-8b52-798376aa06f9))
|
||||
(fp_line (start -12.42 -4.89) (end -12.42 -17.33)
|
||||
(stroke (width 0.12) (type solid)) (layer "F.SilkS") (tstamp dfe51a95-bf40-4283-8584-c3bd5cc9df9e))
|
||||
(fp_line (start -12.42 4.59) (end -12.42 -1.69)
|
||||
(stroke (width 0.12) (type solid)) (layer "F.SilkS") (tstamp 8246d8f2-1c6f-4b33-8d25-c618de02407e))
|
||||
(fp_line (start 3.53 -17.33) (end 3.53 -4.89)
|
||||
(stroke (width 0.12) (type solid)) (layer "F.SilkS") (tstamp f47c6b12-f626-45aa-9068-5767b95e0936))
|
||||
(fp_line (start 3.53 -1.69) (end 3.53 4.59)
|
||||
(stroke (width 0.12) (type solid)) (layer "F.SilkS") (tstamp 0777e883-a211-4ec6-83de-d3a434fd515e))
|
||||
(fp_line (start 3.53 4.59) (end -12.42 4.59)
|
||||
(stroke (width 0.12) (type solid)) (layer "F.SilkS") (tstamp 02396337-73e6-497a-8f0c-d054d6d0c6db))
|
||||
(fp_line (start 3.73 1) (end 3.73 -1)
|
||||
(stroke (width 0.12) (type solid)) (layer "F.SilkS") (tstamp 0c9cfb1c-8626-45ba-b8d0-0fa1d897dde5))
|
||||
(fp_line (start -14.02 -4.04) (end -12.82 -5.24)
|
||||
(stroke (width 0.05) (type default)) (layer "F.CrtYd") (tstamp 13cdb4cc-fea5-44e3-93ef-ac453a62464a))
|
||||
(fp_line (start -14.02 -2.54) (end -14.02 -4.04)
|
||||
(stroke (width 0.05) (type solid)) (layer "F.CrtYd") (tstamp a85fb57b-5bbf-4280-850d-8afa2455d39a))
|
||||
(fp_line (start -12.82 -5.24) (end -12.82 -17.73)
|
||||
(stroke (width 0.05) (type solid)) (layer "F.CrtYd") (tstamp e2c5f1ff-8df1-4236-b76c-300e04f8790c))
|
||||
(fp_line (start -12.82 -1.34) (end -14.02 -2.54)
|
||||
(stroke (width 0.05) (type default)) (layer "F.CrtYd") (tstamp ce6674fd-2fbe-4f69-89a7-10eb73acbd10))
|
||||
(fp_line (start -12.82 4.99) (end -12.82 -1.34)
|
||||
(stroke (width 0.05) (type solid)) (layer "F.CrtYd") (tstamp 60a05c14-e1f9-4ada-a1af-593963ac1586))
|
||||
(fp_line (start -12.82 4.99) (end 3.93 4.99)
|
||||
(stroke (width 0.05) (type solid)) (layer "F.CrtYd") (tstamp 4fdd4f36-1a01-4604-96b0-b2181006ea98))
|
||||
(fp_line (start 3.93 -17.73) (end -12.82 -17.73)
|
||||
(stroke (width 0.05) (type solid)) (layer "F.CrtYd") (tstamp bfd74dac-89ff-4170-b66a-da6e02ab8a10))
|
||||
(fp_line (start 3.93 -5.24) (end 3.93 -17.73)
|
||||
(stroke (width 0.05) (type solid)) (layer "F.CrtYd") (tstamp a7ea8871-0814-496d-bea8-76acf87a9f1d))
|
||||
(fp_line (start 3.93 -1.34) (end 5.13 -2.54)
|
||||
(stroke (width 0.05) (type default)) (layer "F.CrtYd") (tstamp ce9b9799-5a6e-4d3c-ad71-51ecb5f3226b))
|
||||
(fp_line (start 3.93 4.99) (end 3.93 -1.34)
|
||||
(stroke (width 0.05) (type solid)) (layer "F.CrtYd") (tstamp a7ea8871-0814-496d-bea8-76acf87a9f1d))
|
||||
(fp_line (start 5.13 -4.04) (end 3.93 -5.24)
|
||||
(stroke (width 0.05) (type default)) (layer "F.CrtYd") (tstamp 35eb9022-e801-4ec2-b75e-575993ae22a7))
|
||||
(fp_line (start 5.13 -2.54) (end 5.13 -4.04)
|
||||
(stroke (width 0.05) (type solid)) (layer "F.CrtYd") (tstamp 42f37172-575a-4e35-ab04-4207d00c9215))
|
||||
(fp_line (start -12.32 -17.23) (end 3.43 -17.23)
|
||||
(stroke (width 0.1) (type solid)) (layer "F.Fab") (tstamp 3bcf90ed-72cf-43f6-9200-1af27dc71125))
|
||||
(fp_line (start -12.32 4.49) (end -12.32 -17.23)
|
||||
(stroke (width 0.1) (type solid)) (layer "F.Fab") (tstamp 0e51847c-5550-4434-a920-3207f3b327a4))
|
||||
(fp_line (start 0 3.49) (end -1 4.49)
|
||||
(stroke (width 0.1) (type default)) (layer "F.Fab") (tstamp 2203cc90-7f47-4295-8157-870276d4dc86))
|
||||
(fp_line (start 0 3.49) (end 1 4.49)
|
||||
(stroke (width 0.1) (type default)) (layer "F.Fab") (tstamp aa2be614-88ae-4474-8f42-6dcd6743c3ee))
|
||||
(fp_line (start 3.43 -17.23) (end 3.43 4.49)
|
||||
(stroke (width 0.1) (type solid)) (layer "F.Fab") (tstamp 6433be6c-4de7-4dae-a169-d00a015d196a))
|
||||
(fp_line (start 3.43 4.49) (end -12.32 4.49)
|
||||
(stroke (width 0.1) (type solid)) (layer "F.Fab") (tstamp 98f93373-5da4-47b9-a4ca-c4dc9246ed79))
|
||||
(pad "" np_thru_hole circle (at -10.16 -6.35 180) (size 3.25 3.25) (drill 3.25) (layers "F&B.Cu" "*.Mask") (tstamp f48b1e8e-4538-458d-a65c-3138e85ea983))
|
||||
(pad "" np_thru_hole circle (at 1.27 -6.35 180) (size 3.25 3.25) (drill 3.25) (layers "F&B.Cu" "*.Mask") (tstamp 185b9caa-e029-4e3c-ac0d-88faa14dbe70))
|
||||
(pad "1" thru_hole rect (at 0 0 180) (size 1.9 1.9) (drill 0.9) (layers "*.Cu" "*.Mask") (tstamp e7b20907-2bab-4e95-a575-a415b5c81d21))
|
||||
(pad "2" thru_hole circle (at -1.27 2.54 180) (size 1.9 1.9) (drill 0.9) (layers "*.Cu" "*.Mask") (tstamp 795bd836-c6e1-4e60-8c0e-c390a64de36d))
|
||||
(pad "3" thru_hole circle (at -2.54 0 180) (size 1.9 1.9) (drill 0.9) (layers "*.Cu" "*.Mask") (tstamp e8ffc943-c00a-44ac-890a-53d47631b4ca))
|
||||
(pad "4" thru_hole circle (at -3.81 2.54 180) (size 1.9 1.9) (drill 0.9) (layers "*.Cu" "*.Mask") (tstamp 07a28928-313b-4940-b033-f561fb74708a))
|
||||
(pad "5" thru_hole circle (at -5.08 0 180) (size 1.9 1.9) (drill 0.9) (layers "*.Cu" "*.Mask") (tstamp f45e2541-d577-4c9c-b663-888b4be2cd9d))
|
||||
(pad "6" thru_hole circle (at -6.35 2.54 180) (size 1.9 1.9) (drill 0.9) (layers "*.Cu" "*.Mask") (tstamp c75da34c-c8bd-4693-b686-9e59682fd0df))
|
||||
(pad "7" thru_hole circle (at -7.62 0 180) (size 1.9 1.9) (drill 0.9) (layers "*.Cu" "*.Mask") (tstamp d93d30c2-35fb-434c-a82d-d583066fc83d))
|
||||
(pad "8" thru_hole circle (at -8.89 2.54 180) (size 1.9 1.9) (drill 0.9) (layers "*.Cu" "*.Mask") (tstamp df23d44a-7a80-4775-875f-744a84f07092))
|
||||
(pad "9" thru_hole circle (at 1.8796 -11.2522 180) (size 1.89 1.89) (drill 0.89) (layers "*.Cu" "*.Mask") (tstamp 31281c12-ca20-4a5f-84f9-96702a50100e))
|
||||
(pad "10" thru_hole circle (at -0.6604 -9.7282 180) (size 1.89 1.89) (drill 0.89) (layers "*.Cu" "*.Mask") (tstamp 1481ff80-5f30-4ef2-91da-ead74ebeaa80))
|
||||
(pad "11" thru_hole circle (at -8.2296 -11.2522 180) (size 1.89 1.89) (drill 0.89) (layers "*.Cu" "*.Mask") (tstamp 9804c560-faa5-4df3-9d54-539192cf2965))
|
||||
(pad "12" thru_hole circle (at -10.7696 -9.7282 180) (size 1.89 1.89) (drill 0.89) (layers "*.Cu" "*.Mask") (tstamp f7a2d297-559e-45fa-9e90-075150e8a9fa))
|
||||
(pad "SH" thru_hole circle (at -12.319 -3.302 180) (size 2.6 2.6) (drill 1.6) (layers "*.Cu" "*.Mask") (tstamp 3a4032e9-a391-42a8-8d46-37a6a669af39))
|
||||
(pad "SH" thru_hole circle (at 3.429 -3.302 180) (size 2.6 2.6) (drill 1.6) (layers "*.Cu" "*.Mask") (tstamp 9c410289-a5f6-43a2-b6d5-e00c7525c3d4))
|
||||
(zone (net 0) (net_name "") (layers "F&B.Cu" "F.SilkS") (tstamp 8504694f-c10f-4788-9961-ef566cd97e6b) (name "No trace zone") (hatch edge 0.5)
|
||||
(connect_pads (clearance 0))
|
||||
(min_thickness 0.25) (filled_areas_thickness no)
|
||||
(keepout (tracks not_allowed) (vias not_allowed) (pads not_allowed) (copperpour allowed) (footprints allowed))
|
||||
(fill (thermal_gap 0.5) (thermal_bridge_width 0.5))
|
||||
(polygon
|
||||
(pts
|
||||
(xy 3.683 -13.97)
|
||||
(xy -12.573 -13.97)
|
||||
(xy -12.573 -17.526)
|
||||
(xy 3.683 -17.526)
|
||||
)
|
||||
)
|
||||
)
|
||||
(model "${KICAD7_3DMODEL_DIR}/Connector_RJ.3dshapes/RJ45-01-J0011D01BNL.STEP"
|
||||
(offset (xyz -4.4 6.6 0))
|
||||
(scale (xyz 1 1 1))
|
||||
(rotate (xyz -90 0 180))
|
||||
)
|
||||
)
|
||||
@@ -0,0 +1,19 @@
|
||||
(footprint "Step-down_converter" (version 20211014) (generator pcbnew)
|
||||
(layer "F.Cu")
|
||||
(tedit 0)
|
||||
(attr smd)
|
||||
(fp_text reference "REF**" (at 1 -2 unlocked) (layer "F.SilkS")
|
||||
(effects (font (size 1 1) (thickness 0.15)))
|
||||
(tstamp 02961187-d897-402a-8be0-280efa86136e)
|
||||
)
|
||||
(fp_text value "Step-down_converter" (at 1 0 unlocked) (layer "F.Fab")
|
||||
(effects (font (size 1 1) (thickness 0.15)))
|
||||
(tstamp 86ce3e0b-05da-49e1-bbdd-4b8a82d57320)
|
||||
)
|
||||
(fp_rect (start 9.398 -6.35) (end -8.382 5.334) (layer "F.SilkS") (width 0.12) (fill none) (tstamp a74d3364-cf5e-4ce8-81ee-30303d1a2fff))
|
||||
(fp_rect (start -8.382 -6.35) (end 9.398 5.334) (layer "F.CrtYd") (width 0.12) (fill none) (tstamp 2dc45bff-1695-4e57-9525-90c2d17683f1))
|
||||
(pad "IN+" thru_hole rect (at -7 4) (size 2 2) (drill 1) (layers *.Cu *.Mask) (tstamp f9cef32a-df9e-484b-9b98-5c39bed8e59f))
|
||||
(pad "IN-" thru_hole rect (at -7 -5) (size 2 2) (drill 1) (layers *.Cu *.Mask) (tstamp b207658a-2d2d-4567-aa6a-a6939ed82d9a))
|
||||
(pad "OUT+" thru_hole rect (at 8 4) (size 2 2) (drill 1) (layers *.Cu *.Mask) (tstamp 57a92d72-08d9-4070-ae87-6de89c192f43))
|
||||
(pad "OUT-" thru_hole rect (at 8 -5) (size 2 2) (drill 1) (layers *.Cu *.Mask) (tstamp b3710e17-dffb-4214-b6d9-79b3e34fd05c))
|
||||
)
|
||||
@@ -0,0 +1,41 @@
|
||||
(footprint "TCA_9548A_module" (version 20211014) (generator pcbnew)
|
||||
(layer "F.Cu")
|
||||
(tedit 0)
|
||||
(attr through_hole)
|
||||
(fp_text reference "REF**" (at 0 -0.5 unlocked) (layer "F.SilkS")
|
||||
(effects (font (size 1 1) (thickness 0.15)))
|
||||
(tstamp a9653906-1f42-4915-a35e-72517899c891)
|
||||
)
|
||||
(fp_text value "TCA_9548A_module" (at 0 1 unlocked) (layer "F.Fab")
|
||||
(effects (font (size 1 1) (thickness 0.15)))
|
||||
(tstamp ff6d1b7e-1b2c-4d2a-931a-6d4d73547b13)
|
||||
)
|
||||
(fp_rect (start -10.16 -17.78) (end 12.7 15.24) (layer "F.SilkS") (width 0.12) (fill none) (tstamp 7f03ab9f-5309-46c6-b1be-aa712f875925))
|
||||
(fp_rect (start -10.668 -18.288) (end 13.208 15.748) (layer "F.CrtYd") (width 0.12) (fill none) (tstamp 833d74bc-b858-4355-8236-3621ff0bed70))
|
||||
(pad "" np_thru_hole circle (at 1.27 -15.24) (size 5 5) (drill 3.2) (layers F&B.Cu *.Mask) (tstamp 1dac12bb-e465-4161-9224-558817b46c3a))
|
||||
(pad "" np_thru_hole circle (at 1.27 12.7) (size 5 5) (drill 3.2) (layers F&B.Cu *.Mask) (tstamp d9f6a103-7845-443a-955a-fd7a87994ee3))
|
||||
(pad "1" thru_hole rect (at -7.62 -15.24) (size 1.524 1.524) (drill 0.762) (layers *.Cu *.Mask) (tstamp 4ac03bfa-d64a-4788-b2a5-b070c780ab91))
|
||||
(pad "2" thru_hole roundrect (at -7.62 -12.7) (size 1.524 1.524) (drill 0.762) (layers *.Cu *.Mask) (roundrect_rratio 0.25) (tstamp dc981262-75db-4d92-af08-03d80404fd21))
|
||||
(pad "3" thru_hole roundrect (at -7.62 -10.16) (size 1.524 1.524) (drill 0.762) (layers *.Cu *.Mask) (roundrect_rratio 0.25) (tstamp b3a63d9e-98fd-4df6-accc-60a5ff53ec03))
|
||||
(pad "4" thru_hole roundrect (at -7.62 -7.62) (size 1.524 1.524) (drill 0.762) (layers *.Cu *.Mask) (roundrect_rratio 0.25) (tstamp 84fb0130-160c-4ea1-9fbd-21df04542f72))
|
||||
(pad "5" thru_hole roundrect (at -7.62 -5.08) (size 1.524 1.524) (drill 0.762) (layers *.Cu *.Mask) (roundrect_rratio 0.25) (tstamp 6b46525f-9b03-4252-91ad-bd5bb1da540b))
|
||||
(pad "6" thru_hole roundrect (at -7.62 -2.54) (size 1.524 1.524) (drill 0.762) (layers *.Cu *.Mask) (roundrect_rratio 0.25) (tstamp 902e11cb-0aba-4bfd-8498-db20a1300fb2))
|
||||
(pad "7" thru_hole roundrect (at -7.62 0) (size 1.524 1.524) (drill 0.762) (layers *.Cu *.Mask) (roundrect_rratio 0.25) (tstamp 4ac83c5e-cd3c-45d0-9b2b-2352c7cc7bbb))
|
||||
(pad "8" thru_hole roundrect (at -7.62 2.54) (size 1.524 1.524) (drill 0.762) (layers *.Cu *.Mask) (roundrect_rratio 0.25) (tstamp c41cbd59-e088-4cb9-abf5-0f2ece40d145))
|
||||
(pad "9" thru_hole roundrect (at -7.62 5.08) (size 1.524 1.524) (drill 0.762) (layers *.Cu *.Mask) (roundrect_rratio 0.25) (tstamp 838a8ff9-57e5-4d8f-9074-564dbdcb1e60))
|
||||
(pad "10" thru_hole roundrect (at -7.62 7.62) (size 1.524 1.524) (drill 0.762) (layers *.Cu *.Mask) (roundrect_rratio 0.25) (tstamp c262cfc5-31e3-444a-aec4-8a6e79b57c0d))
|
||||
(pad "11" thru_hole roundrect (at -7.62 10.16) (size 1.524 1.524) (drill 0.762) (layers *.Cu *.Mask) (roundrect_rratio 0.25) (tstamp e03aa8f9-49e8-4331-9ae0-c600d010a7d0))
|
||||
(pad "12" thru_hole roundrect (at -7.62 12.7) (size 1.524 1.524) (drill 0.762) (layers *.Cu *.Mask) (roundrect_rratio 0.25) (tstamp e048d497-97c9-424b-b599-3cb2dd14dc82))
|
||||
(pad "13" thru_hole roundrect (at 10.16 12.7) (size 1.524 1.524) (drill 0.762) (layers *.Cu *.Mask) (roundrect_rratio 0.25) (tstamp 48e6fec1-2792-457f-9d81-2980b94f33bd))
|
||||
(pad "14" thru_hole roundrect (at 10.16 10.16) (size 1.524 1.524) (drill 0.762) (layers *.Cu *.Mask) (roundrect_rratio 0.25) (tstamp 71041c6e-ef70-4e01-90b1-876593a19699))
|
||||
(pad "15" thru_hole roundrect (at 10.16 7.62) (size 1.524 1.524) (drill 0.762) (layers *.Cu *.Mask) (roundrect_rratio 0.25) (tstamp dd299121-d1fc-45c2-9757-c34a748f5f5a))
|
||||
(pad "16" thru_hole roundrect (at 10.16 5.08) (size 1.524 1.524) (drill 0.762) (layers *.Cu *.Mask) (roundrect_rratio 0.25) (tstamp 13a0a00f-bf02-49b6-9651-f1124311b2dc))
|
||||
(pad "17" thru_hole roundrect (at 10.16 2.54) (size 1.524 1.524) (drill 0.762) (layers *.Cu *.Mask) (roundrect_rratio 0.25) (tstamp 600d6432-936e-444c-981a-00e5908475ae))
|
||||
(pad "18" thru_hole roundrect (at 10.16 0) (size 1.524 1.524) (drill 0.762) (layers *.Cu *.Mask) (roundrect_rratio 0.25) (tstamp cf975e27-2002-4acb-acfb-c5ceeee2ab70))
|
||||
(pad "19" thru_hole roundrect (at 10.16 -2.54) (size 1.524 1.524) (drill 0.762) (layers *.Cu *.Mask) (roundrect_rratio 0.25) (tstamp 32867613-7e95-40e0-a5e2-fdec80342970))
|
||||
(pad "20" thru_hole roundrect (at 10.16 -5.08) (size 1.524 1.524) (drill 0.762) (layers *.Cu *.Mask) (roundrect_rratio 0.25) (tstamp 7aadf216-889b-49f9-9450-f3202ed6213b))
|
||||
(pad "21" thru_hole roundrect (at 10.16 -7.62) (size 1.524 1.524) (drill 0.762) (layers *.Cu *.Mask) (roundrect_rratio 0.25) (tstamp 8dc3033e-c4c1-48b9-8ce5-522f131bdf3d))
|
||||
(pad "22" thru_hole roundrect (at 10.16 -10.16) (size 1.524 1.524) (drill 0.762) (layers *.Cu *.Mask) (roundrect_rratio 0.25) (tstamp 598aba67-4064-4582-940b-15dc2358a70c))
|
||||
(pad "23" thru_hole roundrect (at 10.16 -12.7) (size 1.524 1.524) (drill 0.762) (layers *.Cu *.Mask) (roundrect_rratio 0.25) (tstamp d394e805-e59f-4704-bcc0-fd7e52a23959))
|
||||
(pad "24" thru_hole roundrect (at 10.16 -15.24) (size 1.524 1.524) (drill 0.762) (layers *.Cu *.Mask) (roundrect_rratio 0.25) (tstamp c83cae79-a3e6-46dd-83e7-fe9b6c86a3f1))
|
||||
)
|
||||
@@ -0,0 +1,91 @@
|
||||
(footprint "USB_Micro-Hakan" (version 20221018) (generator pcbnew)
|
||||
(layer "F.Cu")
|
||||
(descr "Micro USB AB receptable, right-angle inverted (https://www.molex.com/pdm_docs/sd/475900001_sd.pdf)")
|
||||
(tags "Micro AB USB SMD")
|
||||
(attr smd)
|
||||
(fp_text reference "REF**" (at 0 -4.8 -180) (layer "F.SilkS")
|
||||
(effects (font (size 1 1) (thickness 0.15)))
|
||||
(tstamp 934339ec-1cb6-463e-8be7-53de8c8333c7)
|
||||
)
|
||||
(fp_text value "USB_Micro-Hakan" (at 0 3.5) (layer "F.Fab")
|
||||
(effects (font (size 1 1) (thickness 0.15)))
|
||||
(tstamp cbe7cf3e-519b-4cc6-bb14-9eb244b4d642)
|
||||
)
|
||||
(fp_text user "PCB Edge" (at 0 1.45) (layer "Dwgs.User")
|
||||
(effects (font (size 0.4 0.4) (thickness 0.04)))
|
||||
(tstamp bab58309-66f6-4101-abc0-1146c4c6eb53)
|
||||
)
|
||||
(fp_text user "${REFERENCE}" (at 0 -1.5) (layer "F.Fab")
|
||||
(effects (font (size 1 1) (thickness 0.15)))
|
||||
(tstamp 9a98430f-5a6a-4beb-9df6-2ff5de8ad42d)
|
||||
)
|
||||
(fp_line (start -3.87 -3.27) (end -3.87 -1.2)
|
||||
(stroke (width 0.12) (type solid)) (layer "F.SilkS") (tstamp 2d37630d-fc20-46e3-9f0a-37884fe92080))
|
||||
(fp_line (start -3.87 -3.27) (end -3 -3.27)
|
||||
(stroke (width 0.12) (type solid)) (layer "F.SilkS") (tstamp 7a091366-bda5-4ae9-b8bb-05ca09dde226))
|
||||
(fp_line (start -3.87 1.2) (end -3.87 1.45)
|
||||
(stroke (width 0.12) (type solid)) (layer "F.SilkS") (tstamp 0d46e52b-92f1-4829-89fc-4aaac518b86c))
|
||||
(fp_line (start 1 -3.8) (end 1.6 -3.8)
|
||||
(stroke (width 0.12) (type solid)) (layer "F.SilkS") (tstamp 2da27fd0-40d0-4d12-8acb-9b0c4746f591))
|
||||
(fp_line (start 1.3 -3.5) (end 1 -3.8)
|
||||
(stroke (width 0.12) (type solid)) (layer "F.SilkS") (tstamp ec3cbbc1-7abb-4a2b-9614-d47a3494480c))
|
||||
(fp_line (start 1.3 -3.5) (end 1.6 -3.8)
|
||||
(stroke (width 0.12) (type solid)) (layer "F.SilkS") (tstamp 35601a70-353f-406d-bbd0-8caf92f19c0b))
|
||||
(fp_line (start 3 -3.27) (end 3.87 -3.27)
|
||||
(stroke (width 0.12) (type solid)) (layer "F.SilkS") (tstamp 40a7b295-350d-4143-baec-c6f8ff9d76d2))
|
||||
(fp_line (start 3.87 -3.27) (end 3.87 -1.2)
|
||||
(stroke (width 0.12) (type solid)) (layer "F.SilkS") (tstamp 74dfe2ea-e3fd-4caa-b764-c1de0b7a69ff))
|
||||
(fp_line (start 3.87 1.2) (end 3.87 1.45)
|
||||
(stroke (width 0.12) (type solid)) (layer "F.SilkS") (tstamp 8ec0b9c7-7985-473b-bcc5-ddfb4408d2c9))
|
||||
(fp_line (start -3.75 1.45) (end -2.8 1.45)
|
||||
(stroke (width 0.1) (type solid)) (layer "Edge.Cuts") (tstamp 024d267c-18aa-4abd-a1d0-c92a6e485600))
|
||||
(fp_line (start -2.8 -0.125) (end -2.8 1.45)
|
||||
(stroke (width 0.1) (type solid)) (layer "Edge.Cuts") (tstamp 401e311c-0ca8-4584-8ff2-3f4f6b51d241))
|
||||
(fp_line (start -1.95 -0.125) (end -1.95 1.45)
|
||||
(stroke (width 0.1) (type solid)) (layer "Edge.Cuts") (tstamp 73d911a7-90a3-4d1d-a029-378744021085))
|
||||
(fp_line (start -1.95 1.45) (end 1.95 1.45)
|
||||
(stroke (width 0.1) (type solid)) (layer "Edge.Cuts") (tstamp ee5977e1-c184-40f7-a823-45eb668167aa))
|
||||
(fp_line (start 1.95 -0.125) (end 1.95 1.45)
|
||||
(stroke (width 0.1) (type solid)) (layer "Edge.Cuts") (tstamp 74b35cff-17e2-4b36-add6-6ec4112541a5))
|
||||
(fp_line (start 2.8 -0.125) (end 2.8 1.45)
|
||||
(stroke (width 0.1) (type solid)) (layer "Edge.Cuts") (tstamp 869611ae-d851-4622-abc5-aad71c6b09f1))
|
||||
(fp_line (start 2.8 1.45) (end 3.75 1.45)
|
||||
(stroke (width 0.1) (type solid)) (layer "Edge.Cuts") (tstamp 50bc56b1-3a29-4e1f-8652-d659f7d57da0))
|
||||
(fp_arc (start -2.8 -0.125) (mid -2.375 -0.55) (end -1.95 -0.125)
|
||||
(stroke (width 0.1) (type solid)) (layer "Edge.Cuts") (tstamp 7f5410bb-983e-4e57-b73a-0eb543c44190))
|
||||
(fp_arc (start 1.95 -0.125) (mid 2.375 -0.55) (end 2.8 -0.125)
|
||||
(stroke (width 0.1) (type solid)) (layer "Edge.Cuts") (tstamp 110f4d1a-d4c5-4e63-a5a9-f29f4fdc854e))
|
||||
(fp_line (start -5.18 -4.13) (end -5.18 2.65)
|
||||
(stroke (width 0.05) (type solid)) (layer "F.CrtYd") (tstamp 002ef12b-00f9-48b1-a279-9f817643f514))
|
||||
(fp_line (start -5.18 -4.13) (end 5.18 -4.13)
|
||||
(stroke (width 0.05) (type solid)) (layer "F.CrtYd") (tstamp 5e020143-41e5-42c6-808c-eb743d1d2f89))
|
||||
(fp_line (start -5.18 2.65) (end 5.18 2.65)
|
||||
(stroke (width 0.05) (type solid)) (layer "F.CrtYd") (tstamp 0a5b36ae-286f-405c-9ec9-aabba86c2fd8))
|
||||
(fp_line (start 5.18 -4.13) (end 5.18 2.65)
|
||||
(stroke (width 0.05) (type solid)) (layer "F.CrtYd") (tstamp 7b6c0121-e313-40f8-9310-831434e7c888))
|
||||
(fp_line (start -3.75 -3.15) (end -3.75 1.45)
|
||||
(stroke (width 0.1) (type solid)) (layer "F.Fab") (tstamp 0fb604fc-b92e-45b6-8bda-e4899a9d5c8b))
|
||||
(fp_line (start -3.75 -3.15) (end 3.75 -3.15)
|
||||
(stroke (width 0.1) (type solid)) (layer "F.Fab") (tstamp b12cf5c4-387b-4583-ac97-4f26bfd82512))
|
||||
(fp_line (start -3.75 1.45) (end 3.75 1.45)
|
||||
(stroke (width 0.1) (type solid)) (layer "F.Fab") (tstamp 736ab801-951d-47eb-856b-bbd96669fe85))
|
||||
(fp_line (start -3.75 2.15) (end 3.75 2.15)
|
||||
(stroke (width 0.1) (type solid)) (layer "F.Fab") (tstamp c70f2741-31b9-423c-a2a3-1fcfab4a62e2))
|
||||
(fp_line (start 3.75 -3.15) (end 3.75 1.45)
|
||||
(stroke (width 0.1) (type solid)) (layer "F.Fab") (tstamp a10d755e-b990-4a0f-8473-2fa6c925a77c))
|
||||
(pad "" smd rect (at -3.5 0) (size 0.3 0.85) (layers "F.Paste") (tstamp f6d16555-361c-45c0-b638-e30497582a0c))
|
||||
(pad "" smd rect (at 3.5 0) (size 0.3 0.85) (layers "F.Paste") (tstamp 098f3983-cc81-4561-b6b3-5fbeddabea75))
|
||||
(pad "1" smd rect (at 1.3 -2.675) (size 0.4 1.35) (layers "F.Cu" "F.Paste" "F.Mask") (tstamp f18640f9-bb70-4637-8b80-13ef4e4668f7))
|
||||
(pad "2" smd rect (at 0.65 -2.675) (size 0.4 1.35) (layers "F.Cu" "F.Paste" "F.Mask") (tstamp 14681c88-b094-46f2-ba05-0a108b5873e0))
|
||||
(pad "3" smd rect (at 0 -2.675) (size 0.4 1.35) (layers "F.Cu" "F.Paste" "F.Mask") (tstamp b99f8391-4192-462d-b63f-3c48dbc61c83))
|
||||
(pad "4" smd rect (at -0.65 -2.675) (size 0.4 1.35) (layers "F.Cu" "F.Paste" "F.Mask") (tstamp 80b1b826-b2d9-4a3f-a60f-983859b1fe2d))
|
||||
(pad "5" smd rect (at -1.3 -2.675) (size 0.4 1.35) (layers "F.Cu" "F.Paste" "F.Mask") (tstamp 7a5037d8-1adf-4802-9521-386cc4a58105))
|
||||
(pad "6" smd rect (at -3.7375 0) (size 0.875 1.9) (layers "F.Cu" "F.Mask") (tstamp 1e7c2782-72c9-4974-bc76-c1345656f1ec))
|
||||
(pad "6" smd rect (at 0 0) (size 2.9 1.9) (layers "F.Cu" "F.Paste" "F.Mask") (tstamp bbaf77de-f7e5-4a41-9e1b-9dddcbff5b82))
|
||||
(pad "6" smd rect (at 3.7375 0) (size 0.875 1.9) (layers "F.Cu" "F.Mask") (tstamp b23bb249-4cd3-40fc-8105-d0d7b8908f58))
|
||||
(model "${KICAD6_3DMODEL_DIR}/Connector_USB.3dshapes/USB_Micro-AB_Molex_47590-0001.wrl"
|
||||
(offset (xyz 0 0 0))
|
||||
(scale (xyz 1 1 1))
|
||||
(rotate (xyz 0 0 0))
|
||||
)
|
||||
)
|
||||
2230
Pcb-1-lan9252/Kicad/Ethercat-stm32/LAN9252.kicad_sch
Executable file
2230
Pcb-1-lan9252/Kicad/Ethercat-stm32/LAN9252.kicad_sch
Executable file
File diff suppressed because it is too large
Load Diff
4830
Pcb-1-lan9252/Kicad/Ethercat-stm32/LAN9252_diverse.kicad_sch
Executable file
4830
Pcb-1-lan9252/Kicad/Ethercat-stm32/LAN9252_diverse.kicad_sch
Executable file
File diff suppressed because it is too large
Load Diff
4914
Pcb-1-lan9252/Kicad/Ethercat-stm32/STM32F4.kicad_sch
Executable file
4914
Pcb-1-lan9252/Kicad/Ethercat-stm32/STM32F4.kicad_sch
Executable file
File diff suppressed because it is too large
Load Diff
2187
Pcb-1-lan9252/Kicad/Ethercat-stm32/Symbols/HakansLibrary.kicad_sym
Executable file
2187
Pcb-1-lan9252/Kicad/Ethercat-stm32/Symbols/HakansLibrary.kicad_sym
Executable file
File diff suppressed because it is too large
Load Diff
321
Pcb-1-lan9252/Kicad/Ethercat-stm32/Symbols/LAN9252_PT.kicad_sym
Executable file
321
Pcb-1-lan9252/Kicad/Ethercat-stm32/Symbols/LAN9252_PT.kicad_sym
Executable file
@@ -0,0 +1,321 @@
|
||||
(kicad_symbol_lib (version 20220914) (generator kicad_symbol_editor)
|
||||
(symbol "LAN9252_PT" (pin_names (offset 1.016)) (in_bom yes) (on_board yes)
|
||||
(property "Reference" "U" (at -60.96 59.69 0)
|
||||
(effects (font (size 1.27 1.27)) (justify left bottom))
|
||||
)
|
||||
(property "Value" "LAN9252_PT" (at -29.21 -60.96 0)
|
||||
(effects (font (size 1.27 1.27)) (justify left bottom))
|
||||
)
|
||||
(property "Footprint" "LAN9252_PT:QFP50P1200X1200X120-65N" (at -5.08 6.35 0)
|
||||
(effects (font (size 1.27 1.27)) (justify bottom) hide)
|
||||
)
|
||||
(property "Datasheet" "" (at 0 0 0)
|
||||
(effects (font (size 1.27 1.27)) hide)
|
||||
)
|
||||
(property "MF" "Microchip" (at -1.27 -13.97 0)
|
||||
(effects (font (size 1.27 1.27)) (justify bottom) hide)
|
||||
)
|
||||
(property "MAXIMUM_PACKAGE_HEIGHT" "1.2 mm" (at 0 -2.54 0)
|
||||
(effects (font (size 1.27 1.27)) (justify bottom) hide)
|
||||
)
|
||||
(property "Package" "TQFP-64 Microchip" (at -1.27 -11.43 0)
|
||||
(effects (font (size 1.27 1.27)) (justify bottom) hide)
|
||||
)
|
||||
(property "Price" "" (at 0 0 0)
|
||||
(effects (font (size 1.27 1.27)) (justify bottom) hide)
|
||||
)
|
||||
(property "Check_prices" "" (at 0 0 0)
|
||||
(effects (font (size 1.27 1.27)) (justify bottom) hide)
|
||||
)
|
||||
(property "STANDARD" "IPC 7351B" (at -1.27 -5.08 0)
|
||||
(effects (font (size 1.27 1.27)) (justify bottom) hide)
|
||||
)
|
||||
(property "PARTREV" "04-08-15" (at -1.27 -13.97 0)
|
||||
(effects (font (size 1.27 1.27)) (justify bottom) hide)
|
||||
)
|
||||
(property "SnapEDA_Link" "" (at 0 0 0)
|
||||
(effects (font (size 1.27 1.27)) (justify bottom) hide)
|
||||
)
|
||||
(property "MP" "LAN9252/PT" (at -2.54 3.81 0)
|
||||
(effects (font (size 1.27 1.27)) (justify bottom) hide)
|
||||
)
|
||||
(property "Purchase-URL" "" (at 0 0 0)
|
||||
(effects (font (size 1.27 1.27)) (justify bottom) hide)
|
||||
)
|
||||
(property "Description" "\nEthernet Controller 10/100 Base-FX/T/TX PHY SPI Interface 64-TQFP-EP (10x10)\n" (at -1.27 10.16 0)
|
||||
(effects (font (size 1.27 1.27)) (justify bottom) hide)
|
||||
)
|
||||
(property "Availability" "" (at 0 -2.54 0)
|
||||
(effects (font (size 1.27 1.27)) (justify bottom) hide)
|
||||
)
|
||||
(property "MANUFACTURER" "Microchip Technology" (at -1.27 -8.89 0)
|
||||
(effects (font (size 1.27 1.27)) (justify bottom) hide)
|
||||
)
|
||||
(symbol "LAN9252_PT_0_0"
|
||||
(rectangle (start -29.21 58.42) (end 60.96 -59.69)
|
||||
(stroke (width 0.254) (type default))
|
||||
(fill (type background))
|
||||
)
|
||||
(pin input line (at -34.29 -2.54 0) (length 5.08)
|
||||
(name "OSCI" (effects (font (size 1.016 1.016))))
|
||||
(number "1" (effects (font (size 1.016 1.016))))
|
||||
)
|
||||
(pin input line (at -34.29 12.7 0) (length 5.08)
|
||||
(name "FXSDB/FXLOSB/~{FXSDENB}" (effects (font (size 1.016 1.016))))
|
||||
(number "10" (effects (font (size 1.016 1.016))))
|
||||
)
|
||||
(pin input line (at -34.29 30.48 0) (length 5.08)
|
||||
(name "~{RST}" (effects (font (size 1.016 1.016))))
|
||||
(number "11" (effects (font (size 1.016 1.016))))
|
||||
)
|
||||
(pin bidirectional line (at 66.04 -10.16 180) (length 5.08)
|
||||
(name "D2/AD2/SOF/SIO2" (effects (font (size 1.016 1.016))))
|
||||
(number "12" (effects (font (size 1.016 1.016))))
|
||||
)
|
||||
(pin bidirectional line (at 66.04 -7.62 180) (length 5.08)
|
||||
(name "D1/AD1/EOF/SO/SIO1" (effects (font (size 1.016 1.016))))
|
||||
(number "13" (effects (font (size 1.016 1.016))))
|
||||
)
|
||||
(pin power_in line (at 66.04 59.69 180) (length 5.08)
|
||||
(name "VDDIO" (effects (font (size 1.016 1.016))))
|
||||
(number "14" (effects (font (size 1.016 1.016))))
|
||||
)
|
||||
(pin bidirectional line (at 66.04 -40.64 180) (length 5.08)
|
||||
(name "D14/AD14/DIGIO8/GPI8/GPO8/MII_TXD3/~{TX_SHIFT1}" (effects (font (size 1.016 1.016))))
|
||||
(number "15" (effects (font (size 1.016 1.016))))
|
||||
)
|
||||
(pin bidirectional line (at 66.04 -38.1 180) (length 5.08)
|
||||
(name "D13/AD13/DIGIO7/GPI7/GPO7/MII_TXD2/~{TX_SHIFT0}" (effects (font (size 1.016 1.016))))
|
||||
(number "16" (effects (font (size 1.016 1.016))))
|
||||
)
|
||||
(pin bidirectional line (at 66.04 -5.08 180) (length 5.08)
|
||||
(name "D0/AD0/WD_STATE/SI/SIO0" (effects (font (size 1.016 1.016))))
|
||||
(number "17" (effects (font (size 1.016 1.016))))
|
||||
)
|
||||
(pin bidirectional line (at -34.29 -25.4 0) (length 5.08)
|
||||
(name "SYNC1/LATCH1" (effects (font (size 1.016 1.016))))
|
||||
(number "18" (effects (font (size 1.016 1.016))))
|
||||
)
|
||||
(pin bidirectional line (at 66.04 -27.94 180) (length 5.08)
|
||||
(name "D9/AD9/LATCH_IN/SCK" (effects (font (size 1.016 1.016))))
|
||||
(number "19" (effects (font (size 1.016 1.016))))
|
||||
)
|
||||
(pin output line (at -34.29 -5.08 0) (length 5.08)
|
||||
(name "OSCO" (effects (font (size 1.016 1.016))))
|
||||
(number "2" (effects (font (size 1.016 1.016))))
|
||||
)
|
||||
(pin power_in line (at 66.04 60.96 180) (length 5.08)
|
||||
(name "VDDIO" (effects (font (size 1.016 1.016))))
|
||||
(number "20" (effects (font (size 1.016 1.016))))
|
||||
)
|
||||
(pin bidirectional line (at 66.04 -35.56 180) (length 5.08)
|
||||
(name "D12/AD12/DIGIO6/GPI6/GPO6/MII_TXD1" (effects (font (size 1.016 1.016))))
|
||||
(number "21" (effects (font (size 1.016 1.016))))
|
||||
)
|
||||
(pin bidirectional line (at 66.04 -33.02 180) (length 5.08)
|
||||
(name "D11/AD11/DIGIO5/GPI5/GPO5/MII_TXD0" (effects (font (size 1.016 1.016))))
|
||||
(number "22" (effects (font (size 1.016 1.016))))
|
||||
)
|
||||
(pin bidirectional line (at 66.04 -30.48 180) (length 5.08)
|
||||
(name "D10/AD10/DIGIO4/GPI4/GPO4/MII_TXEN" (effects (font (size 1.016 1.016))))
|
||||
(number "23" (effects (font (size 1.016 1.016))))
|
||||
)
|
||||
(pin power_in line (at 66.04 55.88 180) (length 5.08)
|
||||
(name "VDDCR" (effects (font (size 1.016 1.016))))
|
||||
(number "24" (effects (font (size 1.016 1.016))))
|
||||
)
|
||||
(pin bidirectional line (at -34.29 -35.56 0) (length 5.08)
|
||||
(name "A1/ALELO/OE_EXT/MII_CLK25" (effects (font (size 1.016 1.016))))
|
||||
(number "25" (effects (font (size 1.016 1.016))))
|
||||
)
|
||||
(pin bidirectional line (at -34.29 -40.64 0) (length 5.08)
|
||||
(name "A3/DIGIO11/GPI11/GPO11/MII_RXDV" (effects (font (size 1.016 1.016))))
|
||||
(number "26" (effects (font (size 1.016 1.016))))
|
||||
)
|
||||
(pin bidirectional line (at -34.29 -43.18 0) (length 5.08)
|
||||
(name "A4/DIGIO12/GPI12/GPO12/MII_RXD0" (effects (font (size 1.016 1.016))))
|
||||
(number "27" (effects (font (size 1.016 1.016))))
|
||||
)
|
||||
(pin bidirectional line (at -34.29 -30.48 0) (length 5.08)
|
||||
(name "CS/DIGIO13/GPI13/GPO13/MII_RXD1" (effects (font (size 1.016 1.016))))
|
||||
(number "28" (effects (font (size 1.016 1.016))))
|
||||
)
|
||||
(pin bidirectional line (at -34.29 -38.1 0) (length 5.08)
|
||||
(name "A2/ALEHI/DIGIO10/GPI10/GPO10/LINKACTLED2/~{MII_LINKPOL}" (effects (font (size 1.016 1.016))))
|
||||
(number "29" (effects (font (size 1.016 1.016))))
|
||||
)
|
||||
(pin power_in line (at 66.04 48.26 180) (length 5.08)
|
||||
(name "OSCVDD12" (effects (font (size 1.016 1.016))))
|
||||
(number "3" (effects (font (size 1.016 1.016))))
|
||||
)
|
||||
(pin bidirectional line (at 66.04 2.54 180) (length 5.08)
|
||||
(name "WR/ENB/DIGIO14/GPI14/GPO14/MII_RXD2" (effects (font (size 1.016 1.016))))
|
||||
(number "30" (effects (font (size 1.016 1.016))))
|
||||
)
|
||||
(pin bidirectional line (at 66.04 0 180) (length 5.08)
|
||||
(name "RD/RD_WR/DIGIO15/GPI15/GPO15/MII_RXD3" (effects (font (size 1.016 1.016))))
|
||||
(number "31" (effects (font (size 1.016 1.016))))
|
||||
)
|
||||
(pin power_in line (at 66.04 62.23 180) (length 5.08)
|
||||
(name "VDDIO" (effects (font (size 1.016 1.016))))
|
||||
(number "32" (effects (font (size 1.016 1.016))))
|
||||
)
|
||||
(pin bidirectional line (at 66.04 -43.18 180) (length 5.08)
|
||||
(name "A0/D15/AD15/DIGIO9/GPI9/GPO9/MII_RXER" (effects (font (size 1.016 1.016))))
|
||||
(number "33" (effects (font (size 1.016 1.016))))
|
||||
)
|
||||
(pin bidirectional line (at -34.29 -22.86 0) (length 5.08)
|
||||
(name "SYNC0/LATCH0" (effects (font (size 1.016 1.016))))
|
||||
(number "34" (effects (font (size 1.016 1.016))))
|
||||
)
|
||||
(pin bidirectional line (at 66.04 -12.7 180) (length 5.08)
|
||||
(name "D3/AD3/WD_TRIG/SIO3" (effects (font (size 1.016 1.016))))
|
||||
(number "35" (effects (font (size 1.016 1.016))))
|
||||
)
|
||||
(pin bidirectional line (at 66.04 -20.32 180) (length 5.08)
|
||||
(name "D6/AD6/DIGIO0/GPI0/GPO0/MII_RXCLK" (effects (font (size 1.016 1.016))))
|
||||
(number "36" (effects (font (size 1.016 1.016))))
|
||||
)
|
||||
(pin power_in line (at 66.04 63.5 180) (length 5.08)
|
||||
(name "VDDIO" (effects (font (size 1.016 1.016))))
|
||||
(number "37" (effects (font (size 1.016 1.016))))
|
||||
)
|
||||
(pin power_in line (at 66.04 54.61 180) (length 5.08)
|
||||
(name "VDDCR" (effects (font (size 1.016 1.016))))
|
||||
(number "38" (effects (font (size 1.016 1.016))))
|
||||
)
|
||||
(pin bidirectional line (at 66.04 -22.86 180) (length 5.08)
|
||||
(name "D7/AD7/DIGIO1/GPI1/GPO1/MII_MDC" (effects (font (size 1.016 1.016))))
|
||||
(number "39" (effects (font (size 1.016 1.016))))
|
||||
)
|
||||
(pin power_in line (at 66.04 -55.88 180) (length 5.08)
|
||||
(name "OSCVSS" (effects (font (size 1.016 1.016))))
|
||||
(number "4" (effects (font (size 1.016 1.016))))
|
||||
)
|
||||
(pin bidirectional line (at 66.04 -25.4 180) (length 5.08)
|
||||
(name "D8/AD8/DIGIO2/GPI2/GPO2/MII_MDIO" (effects (font (size 1.016 1.016))))
|
||||
(number "40" (effects (font (size 1.016 1.016))))
|
||||
)
|
||||
(pin input line (at 66.04 -48.26 180) (length 5.08)
|
||||
(name "TESTMODE" (effects (font (size 1.016 1.016))))
|
||||
(number "41" (effects (font (size 1.016 1.016))))
|
||||
)
|
||||
(pin bidirectional line (at -34.29 5.08 0) (length 5.08)
|
||||
(name "EESDA/TMS" (effects (font (size 1.016 1.016))))
|
||||
(number "42" (effects (font (size 1.016 1.016))))
|
||||
)
|
||||
(pin output clock (at -34.29 2.54 0) (length 5.08)
|
||||
(name "EESCL/TCK" (effects (font (size 1.016 1.016))))
|
||||
(number "43" (effects (font (size 1.016 1.016))))
|
||||
)
|
||||
(pin output line (at 66.04 30.48 180) (length 5.08)
|
||||
(name "IRQ" (effects (font (size 1.016 1.016))))
|
||||
(number "44" (effects (font (size 1.016 1.016))))
|
||||
)
|
||||
(pin bidirectional line (at -34.29 -17.78 0) (length 5.08)
|
||||
(name "RUNLED/~{E2PSIZE}" (effects (font (size 1.016 1.016))))
|
||||
(number "45" (effects (font (size 1.016 1.016))))
|
||||
)
|
||||
(pin input line (at -34.29 -12.7 0) (length 5.08)
|
||||
(name "LINKACTLED1/TDI/~{CHIP_MODE1}" (effects (font (size 1.016 1.016))))
|
||||
(number "46" (effects (font (size 1.016 1.016))))
|
||||
)
|
||||
(pin power_in line (at 66.04 58.42 180) (length 5.08)
|
||||
(name "VDDIO" (effects (font (size 1.016 1.016))))
|
||||
(number "47" (effects (font (size 1.016 1.016))))
|
||||
)
|
||||
(pin output line (at -34.29 -10.16 0) (length 5.08)
|
||||
(name "LINKACTLED0/TDO/~{CHIP_MODE0}" (effects (font (size 1.016 1.016))))
|
||||
(number "48" (effects (font (size 1.016 1.016))))
|
||||
)
|
||||
(pin bidirectional line (at 66.04 -15.24 180) (length 5.08)
|
||||
(name "D4/AD4/DIGIO3/GPI3/GPO3/MII_LINK" (effects (font (size 1.016 1.016))))
|
||||
(number "49" (effects (font (size 1.016 1.016))))
|
||||
)
|
||||
(pin power_in line (at 66.04 50.8 180) (length 5.08)
|
||||
(name "VDD33" (effects (font (size 1.016 1.016))))
|
||||
(number "5" (effects (font (size 1.016 1.016))))
|
||||
)
|
||||
(pin bidirectional line (at 66.04 -17.78 180) (length 5.08)
|
||||
(name "D5/AD5/OUTVALID/SCS#" (effects (font (size 1.016 1.016))))
|
||||
(number "50" (effects (font (size 1.016 1.016))))
|
||||
)
|
||||
(pin power_in line (at 66.04 38.1 180) (length 5.08)
|
||||
(name "VDD33TXRX1" (effects (font (size 1.016 1.016))))
|
||||
(number "51" (effects (font (size 1.016 1.016))))
|
||||
)
|
||||
(pin bidirectional line (at 66.04 22.86 180) (length 5.08)
|
||||
(name "TXNA" (effects (font (size 1.016 1.016))))
|
||||
(number "52" (effects (font (size 1.016 1.016))))
|
||||
)
|
||||
(pin bidirectional line (at 66.04 25.4 180) (length 5.08)
|
||||
(name "TXPA" (effects (font (size 1.016 1.016))))
|
||||
(number "53" (effects (font (size 1.016 1.016))))
|
||||
)
|
||||
(pin bidirectional line (at 66.04 17.78 180) (length 5.08)
|
||||
(name "RXNA" (effects (font (size 1.016 1.016))))
|
||||
(number "54" (effects (font (size 1.016 1.016))))
|
||||
)
|
||||
(pin bidirectional line (at 66.04 20.32 180) (length 5.08)
|
||||
(name "RXPA" (effects (font (size 1.016 1.016))))
|
||||
(number "55" (effects (font (size 1.016 1.016))))
|
||||
)
|
||||
(pin power_in line (at 66.04 45.72 180) (length 5.08)
|
||||
(name "VDD12TX1" (effects (font (size 1.016 1.016))))
|
||||
(number "56" (effects (font (size 1.016 1.016))))
|
||||
)
|
||||
(pin passive line (at -34.29 -48.26 0) (length 5.08)
|
||||
(name "RBIAS" (effects (font (size 1.016 1.016))))
|
||||
(number "57" (effects (font (size 1.016 1.016))))
|
||||
)
|
||||
(pin power_in line (at 66.04 40.64 180) (length 5.08)
|
||||
(name "VDD33BIAS" (effects (font (size 1.016 1.016))))
|
||||
(number "58" (effects (font (size 1.016 1.016))))
|
||||
)
|
||||
(pin power_in line (at 66.04 43.18 180) (length 5.08)
|
||||
(name "VDD12TX2" (effects (font (size 1.016 1.016))))
|
||||
(number "59" (effects (font (size 1.016 1.016))))
|
||||
)
|
||||
(pin power_in line (at 66.04 53.34 180) (length 5.08)
|
||||
(name "VDDCR" (effects (font (size 1.016 1.016))))
|
||||
(number "6" (effects (font (size 1.016 1.016))))
|
||||
)
|
||||
(pin bidirectional line (at 66.04 10.16 180) (length 5.08)
|
||||
(name "RXPB" (effects (font (size 1.016 1.016))))
|
||||
(number "60" (effects (font (size 1.016 1.016))))
|
||||
)
|
||||
(pin bidirectional line (at 66.04 7.62 180) (length 5.08)
|
||||
(name "RXNB" (effects (font (size 1.016 1.016))))
|
||||
(number "61" (effects (font (size 1.016 1.016))))
|
||||
)
|
||||
(pin bidirectional line (at 66.04 15.24 180) (length 5.08)
|
||||
(name "TXPB" (effects (font (size 1.016 1.016))))
|
||||
(number "62" (effects (font (size 1.016 1.016))))
|
||||
)
|
||||
(pin bidirectional line (at 66.04 12.7 180) (length 5.08)
|
||||
(name "TXNB" (effects (font (size 1.016 1.016))))
|
||||
(number "63" (effects (font (size 1.016 1.016))))
|
||||
)
|
||||
(pin power_in line (at 66.04 35.56 180) (length 5.08)
|
||||
(name "VDD33TXRX2" (effects (font (size 1.016 1.016))))
|
||||
(number "64" (effects (font (size 1.016 1.016))))
|
||||
)
|
||||
(pin power_in line (at 66.04 -53.34 180) (length 5.08)
|
||||
(name "VSS" (effects (font (size 1.016 1.016))))
|
||||
(number "65" (effects (font (size 1.016 1.016))))
|
||||
)
|
||||
(pin input line (at -34.29 25.4 0) (length 5.08)
|
||||
(name "REG_EN" (effects (font (size 1.016 1.016))))
|
||||
(number "7" (effects (font (size 1.016 1.016))))
|
||||
)
|
||||
(pin input line (at -34.29 17.78 0) (length 5.08)
|
||||
(name "~{FXLOSEN}" (effects (font (size 1.016 1.016))))
|
||||
(number "8" (effects (font (size 1.016 1.016))))
|
||||
)
|
||||
(pin input line (at -34.29 15.24 0) (length 5.08)
|
||||
(name "FXSDA/FXLOSA/~{FXSDENA}" (effects (font (size 1.016 1.016))))
|
||||
(number "9" (effects (font (size 1.016 1.016))))
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
1928
Pcb-1-lan9252/Kicad/Ethercat-stm32/peripherals.kicad_sch
Executable file
1928
Pcb-1-lan9252/Kicad/Ethercat-stm32/peripherals.kicad_sch
Executable file
File diff suppressed because it is too large
Load Diff
233
Pcb-1-lan9252/LAN9252_eeprom_store_valid/LAN9252_eeprom_store_valid.ino
Executable file
233
Pcb-1-lan9252/LAN9252_eeprom_store_valid/LAN9252_eeprom_store_valid.ino
Executable file
@@ -0,0 +1,233 @@
|
||||
// Write a valid eeprom for LAN9252.
|
||||
// Uses https://github.com/RobTillaart/I2C_EEPROM
|
||||
//
|
||||
// Wiring:
|
||||
// 4 GND
|
||||
// 5 SDA
|
||||
// 6 SCL
|
||||
// 8 Vcc
|
||||
// (1,2,3,7) A0,A1,A2,WP unconnected => write-enabled at address 0x50
|
||||
//
|
||||
#include <Wire.h>
|
||||
#include <I2C_eeprom.h>
|
||||
const uint8_t eeprom_data[] = {
|
||||
0x80, 0x06, 0x03, 0x44, 0x64, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x14, 0x00, 0xe1, 0x10, 0x00, 0x00, 0xd2, 0x04, 0x00, 0x00,
|
||||
0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x10, 0x80, 0x00, 0x80, 0x10, 0x80, 0x00, 0x04, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x01, 0x00, 0x0a, 0x00, 0x21, 0x00,
|
||||
0x04, 0x0c, 0x45, 0x61, 0x73, 0x65, 0x72, 0x43, 0x41, 0x54, 0x32, 0x30,
|
||||
0x30, 0x30, 0x09, 0x6d, 0x79, 0x45, 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x72,
|
||||
0x06, 0x49, 0x4d, 0x47, 0x43, 0x42, 0x59, 0x22, 0x4d, 0x65, 0x74, 0x61,
|
||||
0x6c, 0x4d, 0x75, 0x73, 0x69, 0x6e, 0x67, 0x73, 0x20, 0x45, 0x61, 0x73,
|
||||
0x65, 0x72, 0x43, 0x41, 0x54, 0x20, 0x32, 0x30, 0x30, 0x30, 0x20, 0x65,
|
||||
0x6e, 0x63, 0x6f, 0x64, 0x65, 0x72, 0x1e, 0x00, 0x10, 0x00, 0x02, 0x03,
|
||||
0x01, 0x04, 0x00, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x28, 0x00, 0x02, 0x00, 0x01, 0x02,
|
||||
0x03, 0x00, 0x29, 0x00, 0x10, 0x00, 0x00, 0x10, 0x80, 0x00, 0x26, 0x00,
|
||||
0x01, 0x01, 0x80, 0x10, 0x80, 0x00, 0x22, 0x00, 0x01, 0x02, 0x00, 0x16,
|
||||
0x00, 0x00, 0x24, 0x00, 0x01, 0x03, 0x00, 0x1a, 0x00, 0x00, 0x20, 0x00,
|
||||
0x01, 0x04, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
|
||||
};
|
||||
|
||||
|
||||
// 512 kbit bytes
|
||||
#define EEPROM_MAXBYTES 32 * 1024 / 8
|
||||
|
||||
// the address of your EEPROM
|
||||
// 0x50 when A0,A1,A2 are left unconnected
|
||||
#define DEVICEADDRESS (0x50)
|
||||
|
||||
I2C_eeprom eeprom(DEVICEADDRESS, EEPROM_MAXBYTES);
|
||||
|
||||
void setup() {
|
||||
Serial.begin(115200);
|
||||
while (!Serial)
|
||||
;
|
||||
Serial.println("WAIT FOR IT");
|
||||
delay(3000);
|
||||
Serial.println("IT IS BEGINNING");
|
||||
|
||||
Wire.begin();
|
||||
eeprom.begin();
|
||||
#if 0
|
||||
Serial.println("----------------------------------------------");
|
||||
Serial.printf("Writing %d long data\n", sizeof(eeprom_data));
|
||||
uint8_t ok;
|
||||
ok = eeprom.writeBlockVerify(0, eeprom_data, sizeof(eeprom_data));
|
||||
if (ok) {
|
||||
Serial.printf("Success writeBlockVerify\n");
|
||||
} else {
|
||||
Serial.printf("Failed writeBlockVerify\n");
|
||||
}
|
||||
#endif
|
||||
Serial.println("----------------------------------------------");
|
||||
Serial.printf("\n VERIFYING\n");
|
||||
for (uint16_t adr = 0; adr < sizeof(eeprom_data); adr++) {
|
||||
uint8_t rB = eeprom.readByte(adr);
|
||||
if (rB != eeprom_data[adr]) {
|
||||
Serial.printf("Not same at addr=%u, read=%u should be %u\n", adr, rB, eeprom_data[adr]);
|
||||
}
|
||||
}
|
||||
Serial.println("----------------------------------------------");
|
||||
Serial.printf("\n VERIFYING DONE\n");
|
||||
}
|
||||
|
||||
|
||||
void loop() {
|
||||
// Nothing to do during loop
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user