`Pi of the Sky` data transmission

Download Report

Transcript `Pi of the Sky` data transmission

Wilga 2006
‘Pi of the Sky’
data transmission
Janusz Użycki
Faculty of Physics
Warsaw University of Technology
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
2
Wilga 2006
Data streaming
camera
computer
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)
3
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 (EP0), data input / output
• Mainly 1...4 bytes long command structure
for example: 0x04 | 0x01 | 0x00 | 0x05
focus motor control cmd, steps number in left
direction, MSB and LSB value, repsectively
4
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’
5
Wilga 2006
Ethernet
•
•
•
•
MAC address
for every device
Camera
CCD
1Gbit/s
data flow rate possible
block
NIC
Ethernet
FPGA
Realtek network
Altera
Low
cost
of
connections
and infrastructure
sensors
PC
Good availabity network devices
EEPROM
DRAM
like switches
8051
USB
• Checked
technology, reliability
motors
Cypress
power system
• Ready chips on the market,
eg. Realtek chipsets
6
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?
7
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 CRC
of ethernet packets but checksums of IP,
TCP and UDP protocols in their header!
8
Wilga 2006
Our simple stack model
Ethernet IP
ICMP
TCP
UDP NUDP data
• 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
9
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
10
Wilga 2006
NUDP advantages
• Simple sensor network model, simplicited
camera controller (‘everything’ in driver)
• Achieved packet receiving control
by camera’s acknowledgements
• It allows to save an order of packets
• There is possible retransmission
of lost packets
• Close to compatybility with USB
commands structure in EP0
11
Wilga 2006
The latest NUDP structure
(rev. 1.045)
NUDP header
{
A
}
B
in UDP
Lo
ID
number
checksum number
field
type
Hi
optional
data field
NUDP header always contains 8 bytes:
• Identification field
• Type field of NUDP frame
• NUDP header checksum
• Number field – it is multi-function field
12
Wilga 2006
NUDP type field
type
bits
ACK bit
can be set to 1
only by camera
protocol
version
type of packet (top)
(0 for this implementation)
0 - for top=7
1 - for all other
camera responses
13
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 acknowledged
and generated by camera only
• Other numbers of type are reserved (RFU)
14
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
15
Wilga 2006
How is NUDP working? (2)
• Watchdog reset
PC: 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 0x00
Camera: 0xFF 0x00 | 0x80 | 0x7D | 0x03 0x00 0x00 0x00
• Transmission demand (start RAW data dumping)
PC: 0xFF 0x00 | 0x00 | 0xF8 | 0x08 0x00 0x00 0x00
Camera: 0xFF 0x00 | 0x80 | 0x78 | 0x08 0x00 0x00 0x00
16
Wilga 2006
How is NUDP working? (3)
• Transmission of RAW data
8248 packets with the following structure:
Camera: 0xFF 0x00 | 0x07 | 0xF7 | 0x02 0x00 0x00 0x00
| <1024 bytes of data>
• Retransmission of RAW data packet
PC: 0xFF 0x00 | 0x06 | 0xF8 | 0x02 0x00 0x00 0x00
Camera: 0xFF 0x00 | 0x86 | 0x78 | 0x02 0x00 0x00 0x00
| <1024 bytes of data>
17
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 code
of the simulator
18
Wilga 2006
Results
Camera 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
19
Wilga 2006
Summary
• USB wasCamera
maintained next to Ethernet
CCD
block commands from USB were given up
• Some
NIC
Ethernet
FPGA
Realtek network
Altera implementation
insensors
the NUDP
(eg. flashing)
PC
EEPROM
motors
DRAM
8051
Cypress
USB
power system
20
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 longer
period of the time in practice
• The future: an implementation a TCP
protocol by usage NIOS (Altera core)
at FPGA chip and a RTOS
21