21
Wilga 2006 ‘Pi of the Sky’ data transmission Janusz Użycki Faculty of Physics Warsaw University of Technology

Wilga 2006 Pi of the Sky data transmission Janusz Użycki Faculty of Physics Warsaw University of Technology

Embed Size (px)

Citation preview

Page 1: Wilga 2006 Pi of the Sky data transmission Janusz Użycki Faculty of Physics Warsaw University of Technology

Wilga 2006

‘Pi of the Sky’data transmission

Janusz Użycki

Faculty of Physics

Warsaw University of Technology

Page 2: Wilga 2006 Pi of the Sky data transmission Janusz Użycki Faculty of Physics Warsaw University of Technology

2

Wilga 2006

Agenda

• First camera’s data exchanging interface

• New needs, reasons of Ethernet usage

• Problems with full TCP/IP stack

• Solutions, basic protocols of the stack

• Our own protocol – NUDP (in details)

• Simulator of the camera and driver

• Results

Page 3: Wilga 2006 Pi of the Sky data transmission Janusz Użycki Faculty of Physics Warsaw University of Technology

3

Wilga 2006

Data streaming

By a medium we need to:• send commands into camera• get and set parameters• read values from sensors• receive data (i.e., send it from camera’s

RAM to computer)

cam era com puter

Page 4: Wilga 2006 Pi of the Sky data transmission Janusz Użycki Faculty of Physics Warsaw University of Technology

4

Wilga 2006

Beginning

• Only 2 cameras for data/photos acquisition• Every computer (one of two) controls

one camera• USB interface, 3 endpoints: commands

from computer (EP1), data input / output• Mainly 1...4 bytes long command structure

for example:focus motor control cmd, steps number in left direction, MSB and LSB value, repsectively

0x04 | 0x01 | 0x00 | 0x05

Page 5: Wilga 2006 Pi of the Sky data transmission Janusz Użycki Faculty of Physics Warsaw University of Technology

5

Wilga 2006

Needs to obtain

• Several cameras (4x4 matrix x 2)

• Parrarel work and processing

• More computers for analysis(something like a cluster of computers)

• Independence cameras from computers during accidental failure of our system

• Computers and cameras require unique addressing – ‘personality’

Page 6: Wilga 2006 Pi of the Sky data transmission Janusz Użycki Faculty of Physics Warsaw University of Technology

6

Wilga 2006

• MAC address for every device

• 1Gbit/s data flow rate possible

• Low cost of connections and infrastructure

• Good availabity network deviceslike switches

• Checked technology, reliability

• Ready chips on the market,eg. Realtek chipsets

Ethernet

Ethernetnetwork

USB

PC

Camera

FPGAAltera

8051Cypress

CCDblock

motors

DRAM

NICRealtek

sensors

EEPROM

power system

Page 7: Wilga 2006 Pi of the Sky data transmission Janusz Użycki Faculty of Physics Warsaw University of Technology

7

Wilga 2006

Ethernet in practice

• Ethernet allows to transmit own packets• Absence of packet receiving control

mechanism• The best solution for compatibility with

network switches (not hubs) IP protocol needed

• IP makes a way for TCP and UDP transport protocols – full TCP/IP stack needed?

Page 8: Wilga 2006 Pi of the Sky data transmission Janusz Użycki Faculty of Physics Warsaw University of Technology

8

Wilga 2006

TCP/IP stack

• First solution: usage minimalized TCP/IP stack with TCP, but camera is based on 8051 microcontroller (slow) and FPGA

• A second: giving up TCP, only UDP protocol which is very simple

• Used ethernet controller in the camera automatically calculates not only CRCof ethernet packets but checksums of IP, TCP and UDP protocols in their header!

Page 9: Wilga 2006 Pi of the Sky data transmission Janusz Użycki Faculty of Physics Warsaw University of Technology

9

Wilga 2006

Our simple stack model

• Blocks of data stream: 8248 packets filled by 1024 bytes of RAW data every – a photo

• Ethernet frames (MAC address)• IP frames (IP address) and ICMP packets

(only echo supported – ping)• UDP packets as transport layer

E thernet IPIC M P

U D P N U D P data

TC P

Page 10: Wilga 2006 Pi of the Sky data transmission Janusz Użycki Faculty of Physics Warsaw University of Technology

10

Wilga 2006

UDP limitations

Advantages:

• One from plenty UDP ports under one IP

• Optional data checksum available

Disadvantages:

• UDP datagram does not ensure receiving one by recipient

• A sequence of received packets can be accidental and depends on network traffic

Page 11: Wilga 2006 Pi of the Sky data transmission Janusz Użycki Faculty of Physics Warsaw University of Technology

11

Wilga 2006

NUDP advantages

• Simple sensor network model, simplicited camera controller (‘everything’ in driver)

• Achieved packet receiving controlby camera’s acknowledgements

• It allows to save an order of packets• There is possible retransmission

of lost packets• Close to compatibility with USB

commands structure in EP1

Page 12: Wilga 2006 Pi of the Sky data transmission Janusz Użycki Faculty of Physics Warsaw University of Technology

12

Wilga 2006

The latest NUDP structure(rev. 1.045)

NUDP header always contains 8 bytes:• Identification field• Type field of NUDP frame• NUDP header checksum• Number field – it is multi-function field

}ID

optionaldata fie ld

num bernum ber fieldtype

N U D P header

in UDP{ A B

L o H i

checksum

Page 13: Wilga 2006 Pi of the Sky data transmission Janusz Użycki Faculty of Physics Warsaw University of Technology

13

Wilga 2006

NUDP type field

A C K b itcan be set to 1only by cam era0 - for top=71 - for a ll other camera responses

protoco lvers ion(0 for this im plem entation)

type o f packet (top)

bits

type

Page 14: Wilga 2006 Pi of the Sky data transmission Janusz Użycki Faculty of Physics Warsaw University of Technology

14

Wilga 2006

Types of NUDP packet

• 0 – command,it is starting from number field

• 4 – set a 16-bits register (RFU)• 5 – read a 16-bits register (RFU)• 6 – retransmission of RAW data packet• 7 – transmission of RAW data packet,

it is never acknowledgedand generated by camera only

• Other numbers of type are reserved (RFU)

Page 15: Wilga 2006 Pi of the Sky data transmission Janusz Użycki Faculty of Physics Warsaw University of Technology

15

Wilga 2006

How is NUDP working? (1)

Selected examples of commands in practice,the most popular types of NUDP frames:

• Parameter setting(shutter time setting to 10s: 10000ms / 10ms = 0x3E8)

PC: 0xFF 0x00 | 0x00 | 0x13 | 0x02 0x03 0xE8 0x00

Camera: 0xFF 0x00 | 0x80 | 0x93 | 0x02 0x03 0xE8 0x00

• Parameter reading, device recognizing etc.(status and temperatures reading)

PC: 0xFF 0x00 | 0x00 | 0xF6 | 0x0A 0x00 0x00 0x00

Camera: 0xFF 0x00 | 0x80 | 0x76 | 0x0A 0x00 0x00 0x00 | 0x1E 0x00 0x51 0x4C

Page 16: Wilga 2006 Pi of the Sky data transmission Janusz Użycki Faculty of Physics Warsaw University of Technology

16

Wilga 2006

How is NUDP working? (2)

• Watchdog resetPC: 0xFF 0x00 | 0x00 | 0x04 | 0xFC 0x00 0x00 0x00

Camera: 0xFF 0x00 | 0x80 | 0x84 | 0xFC 0x00 0x00 0x00

• A photo making (start CCD readout)

PC: 0xFF 0x00 | 0x00 | 0xFD | 0x03 0x00 0x00 0x00Camera: 0xFF 0x00 | 0x80 | 0x7D | 0x03 0x00 0x00 0x00

• Transmission demand (start RAW data dumping)

PC: 0xFF 0x00 | 0x00 | 0xF8 | 0x08 0x00 0x00 0x00Camera: 0xFF 0x00 | 0x80 | 0x78 | 0x08 0x00 0x00 0x00

Page 17: Wilga 2006 Pi of the Sky data transmission Janusz Użycki Faculty of Physics Warsaw University of Technology

17

Wilga 2006

How is NUDP working? (3)

• Transmission of RAW data8248 packets with the following structure:

Camera: 0xFF 0x00 | 0x07 | 0xF7 | 0x02 0x00 0x00 0x00| <1024 bytes of data>

• Retransmission of RAW data packetPC: 0xFF 0x00 | 0x06 | 0xF8 | 0x02 0x00 0x00 0x00

Camera: 0xFF 0x00 | 0x86 | 0x78 | 0x02 0x00 0x00 0x00 | <1024 bytes of data>

Page 18: Wilga 2006 Pi of the Sky data transmission Janusz Użycki Faculty of Physics Warsaw University of Technology

18

Wilga 2006

Simulator and driver

• Linux system was chosen naturally

• NUDPSIM simulator was created for making and testings a new driver faster before camera with Ethernet was made

• For documentation and idea of the NUDP protocol checking programmers of the driver have not seen a source codeof the simulator

Page 19: Wilga 2006 Pi of the Sky data transmission Janusz Użycki Faculty of Physics Warsaw University of Technology

19

Wilga 2006

ResultsCamera with the driver testings

• Ethernet network infrastructure: 1Gbit/s• Achieved performance: about 100Mbits/s• Under Windows all packets were received• Under Linux not, a feasible reason is the driver

which is not a part or module of the kernel;some packets are losing between layers(kernel UDP timeout), even after debugging off

• The transfer depends on a network traffic– the loading has an important influence

Page 20: Wilga 2006 Pi of the Sky data transmission Janusz Użycki Faculty of Physics Warsaw University of Technology

20

Wilga 2006

Summary

• USB was maintained next to Ethernet

• Some commands from USB were given up in the NUDP implementation (eg. flashing)

Ethernetnetwork

USB

PC

Camera

FPGAAltera

8051Cypress

CCDblock

motors

DRAM

NICRealtek

sensors

EEPROM

power system

Page 21: Wilga 2006 Pi of the Sky data transmission Janusz Użycki Faculty of Physics Warsaw University of Technology

21

Wilga 2006

Summary

• USB was maintained next to Ethernet• Some commands from USB were given up

in the NUDP implementation (eg. flashing)• Main aims were achieved

but it will be checked in longerperiod of the time in practice

• The future: an implementation a TCP protocol by NIOS usage (Altera core) at FPGA chip and a RTOS