Presentation is loading. Please wait.

Presentation is loading. Please wait.

Tiny EPICS CAS in NetBurner MOD5282 National Synchrotron Radiation Research Center (NSRRC) Te-Hui Lee, 2009/11/11.

Similar presentations


Presentation on theme: "Tiny EPICS CAS in NetBurner MOD5282 National Synchrotron Radiation Research Center (NSRRC) Te-Hui Lee, 2009/11/11."— Presentation transcript:

1 Tiny EPICS CAS in NetBurner MOD5282 National Synchrotron Radiation Research Center (NSRRC) Te-Hui Lee, lee.robert@nsrrc.org.tw 2009/11/11

2 Preface This is an incomplete but workable CAS solution. (ShanZhai EPICS) This is an incomplete but workable CAS solution. (ShanZhai EPICS) The cheapest EPICS CAS. The cheapest EPICS CAS. For MOD5270, USD 79 ~ USD 59 (1000) For MOD5270, USD 79 ~ USD 59 (1000) Good CA protocol tutorial material. Good CA protocol tutorial material. Small code size for low-end microcontroller porting. Small code size for low-end microcontroller porting.

3 Limitation Only DOUBLE and STRING PV are supported so far. Only DOUBLE and STRING PV are supported so far. Alarm is not correctly specified. Alarm is not correctly specified. Severity is not correctly specified. Severity is not correctly specified.

4 Ethernet Module CPUSWURL ArcturusNetworks Inc. uC5282 Freescale MCF5282 uClinux http://www.arcturusnetworks. com/products/uc5282/ http://www.arcturusnetworks. com/products/uc5282/ USD 200 ~ 220 NetburnerMOD5282 Freescale MCF5282 uCOS http://www.netburner.com/p roducts/core_modules/mod5 282.html http://www.netburner.com/p roducts/core_modules/mod5 282.html USD 145 ~105 (100) ~ 89 (1000) RabitCoreRCM4300 RabbitCore 4000 Dynamic C http://www.rabbit.com/prod ucts/rcm4300/ http://www.rabbit.com/prod ucts/rcm4300/ USD 99 ~ 81 (100)

5 Netburner Performance

6 NetBurner MOD5282 uC/OS Multitask RTOS uC/OS Multitask RTOS Freescale MCF5282 ColdFire Microcontroller @ 66 MHz Freescale MCF5282 ColdFire Microcontroller @ 66 MHz 8 10-bit on-chip analog inputs, 0 ~ 3.3 volts 8 10-bit on-chip analog inputs, 0 ~ 3.3 volts 4-digit 7 segment LED display 4-digit 7 segment LED display 8-bit DIP SW digital input 8-bit DIP SW digital input 8-bit LED display digital output 8-bit LED display digital output 2 RS-232 serial ports 2 RS-232 serial ports SD card FAT32 file system SD card FAT32 file system RTC chip on board RTC chip on board

7 NetBurner NNDK-MOD5282-KIT www.netburner.com www.netburner.com www.netburner.com

8 NNDK-MOD5282-KIT

9 NNDK-MOD5282-KIT

10 NNDK-MOD52XX-KIT Network in 1 day: easy to learn Network in 1 day: easy to learn Well documented Well documented Good technical support Good technical support Plenty sample codes Plenty sample codes Plenty network support. HTTP, email, FTP … Plenty network support. HTTP, email, FTP …

11 Firmware Architecture

12 How To Change Code Hardware PV control code is located at ioc.cpp and pv.h. Hardware PV control code is located at ioc.cpp and pv.h. Three wrapper functions need to be maintained to accommodate different hardware. Three wrapper functions need to be maintained to accommodate different hardware. IOC_Init(): PV initialization IOC_Init(): PV initialization IOC_GetData(): get new value from hardware IOC_GetData(): get new value from hardware IOC_SetData(): set new setting to hardware IOC_SetData(): set new setting to hardware

13 On Board Signal Converter EPICS to DIO converter EPICS to DIO converter EPICS to A/D, D/A converter EPICS to A/D, D/A converter EPICS to RS-232 converter EPICS to RS-232 converter

14 IP 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 not 0.0.0.0. Assigned fixed IP will be used if it is not 0.0.0.0. Netmask is used for beacon broadcast Netmask is used for beacon broadcast Default is 255.255.0.0, broadcast address is 172.16.255.255 Default is 255.255.0.0, broadcast address is 172.16.255.255

15 Time NTP client function NTP client function NTP server IP is assigned in configuration file. NTP server IP is assigned in configuration file. NTP server synchronization interval is configurable in configuration file. NTP server synchronization interval is configurable in configuration file. If NTP server time correction fails, on board RTC chip time will be used. If NTP server time correction fails, on board RTC chip time will be used. NTP server compatibility NTP server compatibility PresenTense Time Server, Meinberg NTP server PresenTense Time Server, Meinberg NTP server

16 EPICS PVs Test Analog input Analog input #caget nbcas255ai0 #caget nbcas255ai0 … #caget nbcas255:ai7 #caget nbcas255:ai7 Digital input Digital input #caget nbcas255:di #caget nbcas255:di Digital output Digital output #caput nbcas255:do x55 #caput nbcas255:do x55 #caput nbcas255:do 85 #caput nbcas255:do 85 7-segment 4-digit LED display 7-segment 4-digit LED display #caput nbcas255:seg 1234 #caput nbcas255:seg 1234 RS-232 serial port #0 RS-232 serial port #0 #caput nbcas255:s0 abcdefghijk #caput nbcas255:s0 abcdefghijk RS-232 serial port #1 RS-232 serial port #1 #caput nbcas255:s1 abcdefghijk #caput nbcas255:s1 abcdefghijk

17 Parameter Initialization Configuration file cassetup.ini is stored at the root directory of SD card Configuration file cassetup.ini is stored at the root directory of SD card The configurations parameters are loaded during power on process. The configurations parameters are loaded during power on process. Parameters include Parameters include Device name Device name NTP server IP address, sync interval NTP server IP address, sync interval Authorized access IP group Authorized access IP group Authorized access host and user group Authorized access host and user group Log format (None, binary, text) Log format (None, binary, text) Log Interval Log Interval Log file auto deletion function. Log file auto deletion function.

18 Example cassetup.ini DeviceName=nbcas255//device name DeviceName=nbcas255//device name NTP=172.16.1.201//NTP server IP address NTP=172.16.1.201//NTP server IP address NTPInterval=1440//NTP sync interval in minutes NTPInterval=1440//NTP sync interval in minutes NetMask=255.255.0.0 NetMask=255.255.0.0 LogFormat=1//log format: binary, 0:none,1:binary,2:test LogFormat=1//log format: binary, 0:none,1:binary,2:test LogInterval=1//log interval 1 s LogInterval=1//log interval 1 s //RW 1:read,2:write,3:read/write //RW 1:read,2:write,3:read/write AuIP1=172.16.1.201 AuIP1=172.16.1.201 AuRW1=3 AuRW1=3 AuIP2=172.16.1.210 AuIP2=172.16.1.210 AuRW2=3 AuRW2=3 AuIP3=172.16.255.210//172.16.xxx.210 group are allowed AuIP3=172.16.255.210//172.16.xxx.210 group are allowed AuRW4=3//access read and write AuRW4=3//access read and write Host1=host1:user1,user2//user1 and user2 at host1 have access rights Host1=host1:user1,user2//user1 and user2 at host1 have access rights Host2=host2:user1,user3//user1 and user3 at host2 have access rights Host2=host2:user1,user3//user1 and user3 at host2 have access rights TimeZone=480//Taipei, Beijing. Unit in minutes TimeZone=480//Taipei, Beijing. Unit in minutes SOUT=0//continuous serial output to RS-232 SOUT=0//continuous serial output to RS-232 AutoDel=1//Auto deletion for log file enabled AutoDel=1//Auto deletion for log file enabled

19 Security Control by IP Only authorized IP or IP group can access the device. Only authorized IP or IP group can access the device. The authorized IPs are loaded from NOR flash during power on process. The authorized IPs are loaded from NOR flash during power on process. If the authorized IPs in module are different from those in cassetup.ini, they will be updated from the card and then saved into NOR flash. If the authorized IPs in module are different from those in cassetup.ini, they will be updated from the card and then saved into NOR flash. Security privileges include Security privileges include Read only access Read only access Read and write access Read and write access

20 Security Control by User and Host Name Host1=host1:user1,user2 Host1=host1:user1,user2 user1 and user2 at host1 can read and write the device. user1 and user2 at host1 can read and write the device. Case sensitive Case sensitive

21 Host and Client Name in Windows

22 Log File System The log data will be saved in the SD card The log data will be saved in the SD card Log format: binary or text Log format: binary or text Log interval is configurable by initialization file cassetup.ini on SD card. Log interval is configurable by initialization file cassetup.ini on SD card. If AutoDel flag is enabled, device will delete the oldest directory automatically when disk data is full. If AutoDel flag is enabled, device will delete the oldest directory automatically when disk data is full. Filename Filename Text: \YYYYMM\YYMMDD.txt Text: \YYYYMM\YYMMDD.txt Binary: \YYYYMM\YYMMDD.bin Binary: \YYYYMM\YYMMDD.bin

23 Binary Log File Format OffsetDataContents 0 ~ 127 Header, Device name, PV1 name\tPV2 name\t … 128 ~ 131 Data 1 TimeStamp (unsigned long) 132 ~ 135 Data 1 PV1 (float) 136 ~ 139 Data 1 PV2 (float) … Data 1 … 132 + (N-1)*4 Data 1 PVN(float) 132 + N*4 = A Data 2 TimeStamp (unsigned long) A+4 Data 2 PV1 (float) A+8 Data 2 PV2 (float) … Timestamp is saved as unsigned long. It is equal to the second since 1990/1/1 12:00:00. Data are saved as 4-byte float.

24 Text Log File Format LineContents 1 Device name PV1 name,PV2 name, … \r\n 2TimeStamp,PV1,PV2,PV3..\r\n 3TimeStamp,PV1,PV2,PV3..\r\n Timestamp is saved as unsigned long. It is equal to the second since 1990/1/1 12:00:00. Data are saved as 4-byte float.

25 FTP Log File Access Log file and directory in SD card are read-only through FTP transfer.

26 Channel Access in One Slide CA Server CA 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 request” or “search 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” or “caPut” “get” or “caGet” “set a monitor” “post an event” or “post a monitor” “put complete” or or

27 CA Protocol Analyzer - Wireshark Where is it? Extension  Wireshark Where is it? Extension  Wireshark http://www.aps.anl.gov/epics/extensions/index.php http://www.aps.anl.gov/epics/extensions/index.php http://www.aps.anl.gov/epics/extensions/index.php CA protocol document CA protocol document http://epics.cosylab.com/cosyjava/JCA-Common/Documentation/CAproto.htm http://epics.cosylab.com/cosyjava/JCA-Common/Documentation/CAproto.htm http://epics.cosylab.com/cosyjava/JCA-Common/Documentation/CAproto.htm Wireshark CA plugin support Wireshark CA plugin support http://www-linac.kek.jp/cont/epics/wireshark/ http://www-linac.kek.jp/cont/epics/wireshark/ http://www-linac.kek.jp/cont/epics/wireshark/

28 CA Protocol Example for caget CA Protocol CIDSIDCSIDIOIO CA_PROTO_VERSIONCA_PROTO_SEARCHUDPbroadcast  CAS 5064 0x010xFFFFFFFF CA_PROTO_VERSIONCA_PROTO_SEARCHUDP  CAS 5064 0x010xFFFFFFFF CA_PROTO_VERSIONCA_PROTO_CLIENT_NAMECA_PROTO_HOST_NAMECA_PROTO_CREATE_CHANTCP  CAS 5064 0x01 CA_PROTO_VERSIONCA_PROTO_ACCESS_RIGHTSCA_PROTO_CREATE_CHANTCP  CAS 5064 0x010x010x01 CA_PROTO_READ_NOTIFYTCP  CAS 5064 0x010x01 CA_PROTO_READ_NOTIFYTCP  CAS 5064 0x010x01 CID: Channel ID, SID: Server ID, CSID: client provided subscription ID, IOID: client provided IO ID

29 #caget Process Captured by Wireshark

30 CA Protocol Example for caput CA Protocol CIDSIDCSIDIOIO CA_PROTO_VERSIONCA_PROTO_SEARCHUDP  CAS 5064 0x010xFFFFFFFF CA_PROTO_VERSIONCA_PROTO_SEARCHUDP  CAS 5064 0x010xFFFFFFFF CA_PROTO_VERSIONCA_PROTO_CLIENT_NAMECA_PROTO_HOST_NAMECA_PROTO_CREATE_CHANTCP  CAS 5064 0x01 CA_PROTO_VERSIONCA_PROTO_ACCESS_RIGHTSCA_PROTO_CREATE_CHANTCP  CAS 5064 0x010x010x01 CA_PROTO_READ_NOTIFYTCP  CAS 5064 0x010x01 CA_PROTO_READ_NOTIFYTCP  CAS 5064 0x010x01 CA_PROTO_WRITECA_PROTO_READ_NOTIFYTCP  CAS 5064 0x010x010x010x02 CA_PROTO_READ_NOTIFYTCP  CAS 5064 0x010x02 CID: Channel ID, SID: Server ID, CSID: client provided subscription ID, IOID: client provided IO ID

31 #caput Process Captured by Wireshark

32 CA Protocol Example for camonitor CA Protocol CIDSIDCSIDIOIO CA_PROTO_VERSIONCA_PROTO_SEARCHUDPbroadcast  CAS 5064 0x010xFFFFFFFF CA_PROTO_VERSIONCA_PROTO_SEARCHUDP  CAS 5064 0x010xFFFFFFFF CA_PROTO_VERSIONCA_PROTO_CLIENT_NAMECA_PROTO_HOST_NAMECA_PROTO_CREATE_CHANTCP  CAS 5064 0x01 CA_PROTO_VERSIONCA_PROTO_ACCESS_RIGHTSCA_PROTO_CREATE_CHANTCP  CAS 5064 0x010x010x01 CA_PROTO_EVENT_ADDTCP  CAS 5064 0x010x01 CA_PROTO_EVENT_ADDTCP  CAS 5064 0x010x01 CA_PROTO_EVENT_ADDTCP 0x010x01 CA_PROTO_EVENT_ADDTCP 0x010x01 CID: Channel ID, SID: Server ID, CSID: client provided subscription ID, IOID: client provided IO ID

33 #camonitor Process Captured by Wireshark

34 CA Protocol Example for MEDM (2 PVs) CA Protocol CIDSIDCSIDIOIO CA_PROTO_VERSIONCA_PROTO_SEARCH UDP broadcast  CAS 5064 0x010xFFFFFFFF CA_PROTO_VERSIONCA_PROTO_SEARCHUDPResponse  CAS 5064 0x010xFFFFFFFF CA_PROTO_VERSIONCA_PROTO_CLIENT_NAMECA_PROTO_HOST_NAMECA_PROTO_CREATE_CHANCA_PROTO_CREATE_CHANTCP  CAS 5064 0x1d0x1e CA_PROTO_VERSIONCA_PROTO_ACCESS_RIGHTSCA_PROTO_CREATE_CHANCA_PROTO_ACCESS_RIGHTSCA_PROTO_CREATE_CHANTCP  CAS 5064 0x1d0x1d0x1e0x1e0x010x02 CA_PROTO_READ_NOTIFYCA_PROTO_EVENT_ADDCA_PROTO_READ_NOTIFYCA_PROTO_EVENT_ADDTCP  CAS 5064 0x010x010x020x020x0e0x100x0d0x0f CA_PROTO_EVENT_ADDCA_PROTO_EVENT_ADDTCP  CAS 5064 0x0e0x10 CA_PROTO_EVENT_ADDTCP 0x0e

35 Payload 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_tstatus; /* status of value */ dbr_short_tstatus; /* status of value */ dbr_short_tseverity;/* severity of alarm */ dbr_short_tseverity;/* severity of alarm */ epicsTimeStampstamp;/* time stamp since 1990/1/1 12:00 AM*/ epicsTimeStampstamp;/* time stamp since 1990/1/1 12:00 AM*/ dbr_long_tRISC_pad;/* RISC alignment */ dbr_long_tRISC_pad;/* RISC alignment */ dbr_double_tvalue;/* current value */ dbr_double_tvalue;/* current value */ }; };

36 MEDM Test Program DIP SW status LED display 7-seg LED display Serial0 Output Serial1 Output

37 Channel Archive Compatibility DBE_LOG data processing for CA_PROTO_EVENT_ADD DBE_LOG data processing for CA_PROTO_EVENT_ADD

38 UDP Port 5066 GETDATA GETDATA GETNAME GETNAME

39 Next Step Hardware module development Hardware module development DIO, A/D, D/A DIO, A/D, D/A Photon BPM controller Photon BPM controller Archive viewer Archive viewer smarter and user-friendly GUI smarter and user-friendly GUI PV correlation analysis PV correlation analysis Galil motor controller Galil motor controller X-ray detector controller X-ray detector controller

40 Thank you for your attention.


Download ppt "Tiny EPICS CAS in NetBurner MOD5282 National Synchrotron Radiation Research Center (NSRRC) Te-Hui Lee, 2009/11/11."

Similar presentations


Ads by Google