Keiang's electronics hobby side

This website deals with the topics of electronics, digital signal processing and embedded programming.

flag-english flag-german
 

Digitale, temperaturabhängige Lüfterregelung mit USB-Interface - USB Datenpakete

Structure of the USB data packets


 

USB-Interface settings



data direction: Microcontroller -> PC



Pipe 1 / Bulk Endpoint 2 IN
array byte description valid values data organisation
[0] - [7]

Alarm temperatures

( sensor 1 - 8 ) for each sensor 1 byte

0x32 - 0x82 value * 0.5 = xx.x °C
[8] - [15]

sensor-fan configuration ( sensor 1 - 8 )

for each sensor 1 byte

0x00 - 0x07

bit 0 = "Fan 1"
bit 1 = "Fan 2"
bit 2 = "Fan 3"

[16] - [18]

fan acceleration

for each fan 1 byte

  ( signed-byte )
[19] regulating hysteresis 0x01 - 0x14 value * 0.5 = xx.x Kelvin
[20] regulating speed 0x02 - 0x1e value * 2 = xx sec.
[21] fan status( active / inactive )

high = active

low = inactive

bit 0 = "Fan 1"
bit 1 = "Fan 2"
bit 2 = "Fan 3"
[22] control mode 0x00 - 0x02 0x00 = "night mode"
0x01 = "regulated"
0x02 = "full power"
[23]

night mode request

( awaiting "night mode" )

0x00 - 0x01 0x00 = normal ( look -> [22] )
0x01 = changing to "night mode"
[24]

failure message

indicate if an error occour

0x00 - 0x09 0x00 = "no failure"
0x01 = "no sensor connected"
0x02 = "sensor failure"
0x03 = "no active sensor"
0x04 = "eeprom error"
0x05 = "LCD error"
0x06 = "temperatures to high"
0x07 = "flow sensor alarm"
0x08 = "sensor crc failure"
0x09 = "sensor power supply"
[25] overtemp 0x06 - 0x28 value * 0.5 = xx.x Kelvin
[26]

sensor alarm ( with hysteresis )

Shows on whether the current temperature

over or under the adjusted goal temperature is.

high = "over"

low = "under"

[ bit wise ]
bit 0 = sensor 1
bit 1 = sensor 2
...
[27]

sens status

Shows which sensors are active

high = active

low = inactive

[ bit wise ]
bit 0 = sensor 1
bit 1 = sensor 2
...
[28]

sensor alarm ( without hysteresis )

Shows on whether the current temperature

over or under the adjusted goal temperature is.

high = "over"
low = "under"
[ bit wise ]
bit 0 = sensor 1
bit 1 = sensor 2
...
[29] - - -
[30]

resent sensor

Momentarily sensor worked on by the regulation.

 

[ bit wise ]

bit 0 = sensor 1
bit 1 = sensor 2
...

[31]

last sensor

shows which sensor is the last one

 

[ bit wise ]

bit 0 = sensor 1
bit 1 = sensor 2
...

[32 - 35] sensor 1 raw data

for temperature caculation

please look datasheet of "DS18S20"

[32] = Temperature LSB
[33] = Temperature MSB
[34] = Count Remain
[35] = Count per °C

[36 - 39] sensor 2 raw data    
[40 - 43] sensor 3 raw data    
[44 - 47] sensor 4 raw data    
[48 - 51] sensor 5 raw data    
[52 - 55] sensor 6 raw data    
[56 - 59] sensor 7 raw data    
[60 - 63] sensor 8 raw data    

 

Pipe 3 / Bulk Endpoint 4 IN
array byte description valid values data organisation
[ 0 - 2 ]

Fan speed

( for each fan 1 byte )

  value * 15 = rpm
[ 3 - 10 ]

target temperatures deviation

( for each sensor 1 byte )

 

( signed-byte )

value * 0.5 = xx.x Kelvin

[ 11 - 13 ]

Fan PWM duty cycle ( automatic )

( for each fan 1 byte )

0x00 - 0x31

0x00 = 1:0
0x01 = 1:1
0x02 = 1:2
...

[ 14 - 16 ]

Fan PWM duty cycle ( manually )

( for each fan 1 byte )

0x00 - 0x32

0x00 = automatic activated
0x01 = 1:0
0x02 = 1:1
0x03 = 1:2
...

[17] next PWM update in...   value * 2 = xx sec.
[ 18 - 25 ]

temperature sensor I-Factor

( for each sensor 1 byte )

  ( signed-byte )
[26] speed of flowsensor   value * 15 = rpm
[27] alarm value of flowsensor 0x00 - 0xfe

value * 15 = rpm

0x00 = deactivated

[28]

light channels

high = "on"

low = "off"

[ bit wise ]

bit 0 = channel 1
bit 1 = channel 2
...

[29] pump Voltage 0x00 - 0xff value * 0,05 = xx,xV
[ 30 - 32 ]

lower fan limit

lower rpm delimitation of the fans

( for each fan 1 byte )

0x0a - 0x32 0x0a = 1:10
0x0b = 1:11
0x0c = 1:12
...
[33] startup puls for Fan 0x00 - 0x07 bit 0 = "Fan 1"
bit 1 = "Fan 2"
bit 2 = "Fan 3"
[ 34 ]

LCD Type

( supported controller by Firmware )

 

0x01 : HD44780 ( single )
0x02 : HD44780 ( double )
0x03 : KS0066
0x04 : KS0073
0x05 : KS0076
0x06 : HDLR-2416

0x10 : T6963C
0x20 : SED1565
0x30 : SED1520

[ 35 ] LCD Type ( graphic columns )
If cLCD is used this value is set to 0x00.
   
[ 36 ] LCD Type ( graphic rows )
If cLCD is used this value is set to 0x00.
   
[ 37 ] LCD Type ( chars per line)    
[ 38 ] LCD Type ( text lines )    

 

Pipe 5 / Bulk Endpoint 6 IN
array byte description valid values data organisation
[0 - 12] char array which contains sensor name    
[20] index number of received sensor name 0x00 - 0x07 0x00 = name of sensor 1 received
0x01 = name of sensor 2 received
0x02 = name of sensor 3 received
... 
[21 - 40] char array which contains "firmware version"    

 



data direction: PC -> Microcontroller


Pipe 2 / Bulk Endpoint 2 OUT (configuration data )
array byte description valid values data organisation
[0] data type 0x01 - 0x02 0x01 = configuration data, save to RAM
0x02 = configuration data, save to EEPROM
[1] - [8] Alarm temperatures ( sensor 1 - 8 )
for each sensor 1 Byte

 

0x32 - 0x82 value * 0.5 = xx.x °C
[9] - [16] sensor-fan configuration ( sensor 1 - 8 )
for each sensor 1 Byte<
0x00 - 0x07 bit 0 = "Fan 1"
bit 1 = "Fan 2"
bit 2 = "Fan 3"
[17] - [19] Fan PWM duty cycle
( for each fan 1 Byte )
0x0a - 0x32 0x00 = automatic activated
0x01 = 1:0
0x02 = 1:1
0x03 = 1:2
...
[20] - [22]

lower fan limit

lower rpm delimitation of the fans

( for each fan 1 Byte )

0x0a - 0x32 0x0a = 1:10
0x0b = 1:11
0x0c = 1:12
...
[23] regulating hysteresis 0x01 - 0x14 value * 0.5 = xx.x Kelvin
[24] regulating speed 0x02 - 0x1e value * 2 = xx sec.
[25] overtemp 0x06 - 0x28 value * 0.5 = xx.x Kelvin
[26] alarm value of flowsensor   0x00 - 0xfe value * 15 = rpm
0x00 = deactivated
[27] pump voltage 0x00 - 0xff 0x00 = 0,00V
0x01 = 0,05V
...
[28] startup puls for Fan 0x00 - 0x07 bit 0 = "Fan 1"
bit 1 = "Fan 2"
bit 2 = "Fan 3"
[29] control mode 0x00 - 0x02 0x00 = "night mode"
0x01 = "regulated"
0x02 = "full power"
[30] night mode request
( awaiting "night mode" )
0x00 - 0x01 0x00 = normal ( look -> [22] )
0x01 = changing to "night mode"
[31 - 62] dummy bytes
init empty data segments with = 0x00 !
( need for correct CRC-8 calculation )
0x00  
[63] CRC-8 ( checksum byte from [0 - 62] )   order = 8; direct = 1; polynom = 0x131;
crcinit = 0x0; crcxor = 0; refin = 1; refout = 1;

 

Pipe 2 / Bulk Endpoint 2 OUT (light modul data )
array byte description valid values data organisation
[0] data type 0x03 0x03 = data for light modul
[1] step time of light sequence 0x01 - 0xff value * 50 = xx ms
[2] step deep 0x01 - 0x30 0x01 = no sequence -> static
0x02 = 2 steps
0x03 = 3 steps
...
[ 3 - 50 ] light data
each step 1 byte
high = active
low = inactive
[ bit wise ]
bit 0 = channel 1
bit 1 = channel 2
...
[ 51 - 62 ] dummy bytes
init empty data segments with = 0x00 !
( need for correct CRC-8 calculation )
0x00  
[63] CRC-8 ( checksum byte from [0 - 62] )   order = 8; direct = 1; polynom = 0x131;
crcinit = 0x0; crcxor = 0; refin = 1; refout = 1;

 

Pipe 2 / Bulk Endpoint 2 OUT ( cLCD data )
array byte description valid values data organisation
[0] data type 0x04 0x04 = text data for LCD
[1]

number of datablock

Only with the last block all data on the LCD are draw.

Needed blocks depends on used LCD.

for example:

SED1520 GLCD -> 20 * 4 chars

-> 80byte -> 80 / 60 = 1,33

-> 2 blocks needed

  0x00 = block 1
0x01 = block 2
0x02 = block 3
...
[ 2 - 61 ] chars to draw on LCD
( each char 1 byte, 60 byte per block )
   
[ 62 ] - - -
[63] CRC-8 ( checksum byte from [0 - 62] )   order = 8; direct = 1; polynom = 0x131;
crcinit = 0x0; crcxor = 0; refin = 1; refout = 1;

 

Pipe 2 / Bulk Endpoint 2 OUT (gLCD data )
array byte description< valid values data organisation
[0] data type 0x05 0x05 = graphic data for LCD
[1]

number of datablock

Only with the last block all data on the LCD are draw.

Needed blocks depends on used LCD.

 

for example:

SED1520 GLCD -> 122 * 32 dot

-> 3904dots -> 3904 / 8 = 488byte -> 488 / 60 = 8,133

-> 9 blocks needed

  0x00 = block 1
0x01 = block 2
0x02 = block 3
...
[ 2 - 61 ] graphic data to draw on LCD
( 60 byte per block )
   
[ 62 ] - - -
[63] CRC-8 ( checksum byte from [ 0 - 62] )   order = 8; direct = 1; polynom = 0x131;
crcinit = 0x0; crcxor = 0; refin = 1; refout = 1;

KeiAng

Published on: Monday, November 07 2011 (2450 reads)
Copyright © by Keiang's electronics hobby side

[ Go back ]

 

Electronic Projects