Tiny EPICS CAS i Tiny EPICS CAS i n n NetBurner MOD528 NetBurner MOD528 2 2 National Synchrotron Radiation Research Center National Synchrotron Radiation Research Center ( ( NS NS RRC RRC ) ) Te-Hui Lee, [email protected]Te-Hui Lee, [email protected]2009/11/11 2009/11/11
40
Embed
Tiny EPICS CAS in NetBurner MOD5282 National Synchrotron Radiation Research Center (NSRRC) Te-Hui Lee, [email protected] 2009/11/11.
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Tiny EPICS CAS in Tiny EPICS CAS in NetBurner MOD528NetBurner MOD528
22National Synchrotron Radiation Research CenterNational Synchrotron Radiation Research Center
r @ 66 MHzr @ 66 MHz 8 10-bit on-chip analog inputs, 0 ~ 3.3 volts8 10-bit on-chip analog inputs, 0 ~ 3.3 volts 4-digit 7 segment LED display4-digit 7 segment LED display 8-bit DIP SW digital input8-bit DIP SW digital input 8-bit LED display digital output8-bit LED display digital output 2 RS-232 serial ports2 RS-232 serial ports SD card FAT32 file systemSD card FAT32 file system RTC chip on boardRTC chip on board
Network in 1 day: easy to learnNetwork in 1 day: easy to learn Well documentedWell documented Good technical supportGood technical support Plenty sample codesPlenty sample codes Plenty network support. HTTP, email, Plenty network support. HTTP, email,
FTP…FTP…
Firmware ArchitectureFirmware Architecture
UDP Listening TaskCA_SERVER_PORT
TCP Listening TaskCA_SERVER_PORT
UDP2 Listening TaskPort 5066
Beacon ServerCA_REPEATER_PORT
PV Check Taskcamonitor, channel archiver
response
Main Task
Serial0 Task Serial1 Task
How To Change CodeHow To Change Code
Hardware PV control code is located at ioHardware PV control code is located at ioc.cpp and pv.h.c.cpp and pv.h.
Three wrapper functions need to be maiThree wrapper functions need to be maintained to accommodate different hardwntained to accommodate different hardware.are. IOC_Init(): PV initializationIOC_Init(): PV initialization IOC_GetData(): get new value from hardwareIOC_GetData(): get new value from hardware IOC_SetData(): set new setting to hardwareIOC_SetData(): set new setting to hardware
On Board Signal On Board Signal ConverterConverter
EPICS to DIO converterEPICS to DIO converter EPICS to A/D, D/A converterEPICS to A/D, D/A converter EPICS to RS-232 converterEPICS to RS-232 converter
IP AddressIP Address
DHCP will be used if initial IP is 0.0.0.0.DHCP will be used if initial IP is 0.0.0.0. Assigned fixed IP will be used if it is noAssigned fixed IP will be used if it is no
t 0.0.0.0.t 0.0.0.0. Netmask is used for beacon broadcastNetmask is used for beacon broadcast
Default is 255.255.0.0, broadcast address iDefault is 255.255.0.0, broadcast address is 172.16.255.255s 172.16.255.255
TimeTime
NTP client functionNTP client function NTP server IP is assigned in configuration fNTP server IP is assigned in configuration f
ile.ile. NTP server synchronization interval is confNTP server synchronization interval is conf
igurable in configuration file.igurable in configuration file. If NTP server time correction fails, on boarIf NTP server time correction fails, on boar
d RTC chip time will be used.d RTC chip time will be used. NTP server compatibilityNTP server compatibility
PresenTense Time Server, Meinberg NTP serverPresenTense Time Server, Meinberg NTP server
EPICS PVs TestEPICS PVs Test Analog inputAnalog input
7-segment 4-digit LED display7-segment 4-digit LED display #caput nbcas255:seg 1234#caput nbcas255:seg 1234
RS-232 serial port #0RS-232 serial port #0 #caput nbcas255:s0 abcdefghijk#caput nbcas255:s0 abcdefghijk
RS-232 serial port #1RS-232 serial port #1 #caput nbcas255:s1 abcdefghijk#caput nbcas255:s1 abcdefghijk
Parameter InitializationParameter Initialization Configuration file Configuration file cassetup.inicassetup.ini is stored at this stored at th
e root directory of SD carde root directory of SD card The configurations parameters are loaded dThe configurations parameters are loaded d
uring power on process.uring power on process. Parameters includeParameters include
Device nameDevice name NTP server IP address, sync intervalNTP server IP address, sync interval Authorized access IP groupAuthorized access IP group Authorized access host and user groupAuthorized access host and user group Log format (None, binary, text)Log format (None, binary, text) Log IntervalLog Interval Log file auto deletion function.Log file auto deletion function.
Example cassetup.ini Example cassetup.ini DeviceName=nbcas255DeviceName=nbcas255 //device name//device name NTP=172.16.1.201NTP=172.16.1.201 //NTP server IP address//NTP server IP address NTPInterval=1440NTPInterval=1440 //NTP sync interval in minutes//NTP sync interval in minutes NetMask=255.255.0.0NetMask=255.255.0.0 LogFormat=1LogFormat=1 //log format: binary, 0:none,1:binary,2:test//log format: binary, 0:none,1:binary,2:test LogInterval=1LogInterval=1 //log interval 1 s//log interval 1 s //RW 1:read,2:write,3:read/write//RW 1:read,2:write,3:read/write AuIP1=172.16.1.201AuIP1=172.16.1.201 AuRW1=3AuRW1=3 AuIP2=172.16.1.210AuIP2=172.16.1.210 AuRW2=3AuRW2=3 AuIP3=172.16.255.210AuIP3=172.16.255.210 //172.16.xxx.210 group are allowed//172.16.xxx.210 group are allowed AuRW4=3AuRW4=3 //access read and write//access read and write Host1=host1:user1,user2Host1=host1:user1,user2 //user1 and user2 at host1 have access rights//user1 and user2 at host1 have access rights Host2=host2:user1,user3Host2=host2:user1,user3 //user1 and user3 at host2 have access rights//user1 and user3 at host2 have access rights TimeZone=480TimeZone=480 //Taipei, Beijing. Unit in minutes//Taipei, Beijing. Unit in minutes SOUT=0SOUT=0 //continuous serial output to RS-232//continuous serial output to RS-232 AutoDel=1AutoDel=1 //Auto deletion for log file enabled//Auto deletion for log file enabled
Security Control by IPSecurity Control by IP
Only authorized IP or IP group can access the Only authorized IP or IP group can access the device.device.
The authorized IPs are loaded from NOR flash The authorized IPs are loaded from NOR flash during power on process.during power on process.
If the authorized IPs in module are different fIf the authorized IPs in module are different from those in cassetup.ini, they will be updaterom those in cassetup.ini, they will be updated from the card and then saved into NOR flash.d from the card and then saved into NOR flash.
Security privileges includeSecurity privileges include Read only accessRead only access Read and write accessRead and write access
Security Control by Security Control by User and Host NameUser and Host Name
Host1=host1:user1,user2Host1=host1:user1,user2 user1 and user2 at host1 can read and user1 and user2 at host1 can read and
write the device.write the device. Case sensitiveCase sensitive
Host and Client Name in Host and Client Name in WindowsWindows
Log File SystemLog File System
The log data will be saved in the SD cardThe log data will be saved in the SD card Log format: binary or textLog format: binary or text Log interval is configurable by initialization fiLog interval is configurable by initialization fi
le cassetup.ini on SD card.le cassetup.ini on SD card. If AutoDel flag is enabled, device will delete tIf AutoDel flag is enabled, device will delete t
he oldest directory automatically when disk dhe oldest directory automatically when disk data is full.ata is full.
Data 2Data 2 TimeStamp (unsigned long)TimeStamp (unsigned long)
A+4A+4 Data 2Data 2 PV1 (float)PV1 (float)
A+8A+8 Data 2Data 2 PV2 (float)PV2 (float)
……Timestamp is saved as unsigned long. It is equal to the second since Timestamp is saved as unsigned long. It is equal to the second since 1990/1/1 12:00:00.1990/1/1 12:00:00.Data are saved as 4-byte float.Data are saved as 4-byte float.
Timestamp is saved as unsigned long. It is equal to the second since Timestamp is saved as unsigned long. It is equal to the second since 1990/1/1 12:00:00.1990/1/1 12:00:00.Data are saved as 4-byte float.Data are saved as 4-byte float.
FTP Log File AccessFTP Log File AccessLog file and directory in SD card are read-only through Log file and directory in SD card are read-only through FTP transfer.FTP transfer.
Channel Access in One Channel Access in One SlideSlide
CA ServerCA Server
CA ClientCA Client
Process Variables:
Channel Access Server
S1A:H1:CurrentAO
S1:P1:x
S1:P1:y
S1:G1:vacuum
Channel Access Client
Who has a PV named
“S1A:H1:CurrentAO”?
I do.
What is its value?
25.5 AMPS
Change its value to
30.5
““connection connection request” or “search request” or “search
request”request”
OK, it is now 30.5
30.5 is too high. It is now
set to the maximum
value of 27.5.You are not
authorized to change this
value
Notify me when the
value changes
It is now 20.5
AMPS
It is now 10.5
AMPS
It is now -0.0023
AMPS
““put” put” or or
““caPutcaPut””
““get” get” or or
““caGetcaGet””
““set a set a monitor”monitor”
““post an event”post an event”
or or
““post a monitor”post a monitor”
““put complete”put complete”
oror
oror
CA Protocol Analyzer - WireshCA Protocol Analyzer - Wiresharkark
Where is it? Extension Where is it? Extension Wireshark Wireshark http://http://www.aps.anl.gov/epics/extensions/index.phpwww.aps.anl.gov/epics/extensions/index.php
CA protocol documentCA protocol document http://epics.cosylab.com/cosyjava/JCA-Common/Documentation/CAproto.http://epics.cosylab.com/cosyjava/JCA-Common/Documentation/CAproto.
htmhtm
Wireshark CA plugin supportWireshark CA plugin support http://www-linac.kek.jp/cont/epics/wireshark/http://www-linac.kek.jp/cont/epics/wireshark/
CA Protocol Example for cagetCA Protocol Example for cagetCA ProtocolCA Protocol CIDCID SIDSID CSIDCSID IOIOIOIO
CA_PROTO_EVENT_ADDCA_PROTO_EVENT_ADD TCPTCP CAS 5064CAS 5064 0x0e0x0e
Payload Data StructurePayload Data Structure \base-3.14.9\include\db_access.h\base-3.14.9\include\db_access.h /* structure for a double time field *//* structure for a double time field */ struct dbr_time_double {struct dbr_time_double { dbr_short_tdbr_short_t status;status; /* status of value *//* status of value */ dbr_short_tdbr_short_t severity;severity; /* severity of alarm *//* severity of alarm */ epicsTimeStampepicsTimeStamp stamp;stamp; /* time stamp since 1990/1/1 12:00 AM*//* time stamp since 1990/1/1 12:00 AM*/ dbr_long_tdbr_long_t RISC_pad;RISC_pad; /* RISC alignment *//* RISC alignment */ dbr_double_tdbr_double_t value;value; /* current value *//* current value */ };};