Subversion Repositories FlightCtrl

Rev

Rev 1152 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1152 Rev 1208
Line 33... Line 33...
33
    The UART parameters are
33
    The UART parameters are
34
    38400 Baud, 8-N-1
34
    38400 Baud, 8-N-1
Line 35... Line 35...
35
   
35
   
Line -... Line 36...
-
 
36
    If you have any questions, feel free to send me an e-mail.
-
 
37
 
-
 
38
Connection of DSL to SV1 of FC:
-
 
39
( DSL Pin1 is on side of channel 4 )
-
 
40
 
-
 
41
1. GND <--> pin 7 (GND)
-
 
42
2. TXD <--> pin 3 (RXD1 Atmega644p)
-
 
43
3. RXD <--> pin 4 (TXD1 Atmega644p) optional
-
 
44
4. 5V  <--> pin 2 (5V)
-
 
45
 
-
 
46
Do not connect the receiver via PPM-Sumsignal output the same time.
-
 
47
 
-
 
48
Data are send at 38400baud8n1
-
 
49
 
-
 
50
Data Frame: |0xFF|0xFF|0x1F|FREQALLOC|??|RSSI|VBAT|??|CRC|10|CH0D1|CH0D0|CH1D1|CH1D0|CRC| ...etc
-
 
51
 
-
 
52
FREQALLOC = 35, 40, 72
-
 
53
RSSI = 0.. 255 // Received signal strength indicator
-
 
54
VBAT = 0...255 // supply voltage (0.0V.. 8.2V)
-
 
55
 
-
 
56
Servo Pair:   |0x1X|CHXD1|CHXD0|CHX+1D1|CHX+1D0|CRC|
-
 
57
X is channel index of 1 servo value
-
 
58
D1D0 is servo value as u16 in range of 7373 (1ms) to 14745 (2ms)
-
 
59
there are 8 channels submitted, i.e 4 servo pairs
-
 
60
 
-
 
61
 
-
 
62
Frame examples with signel received
-
 
63
 
-
 
64
FFFF 1F23F079A304AD 1036012B1E6F 122AFB2AECB2 142B4D2B4404 1636872B33CE
-
 
65
FFFF 1F23F079A304AD 1036002B1F6F 122AFE2AEBB0 142B4B2B4406 1636872B33CE
-
 
66
FFFF 1F23F079A304AD 1035FF2B226E 122AFC2AEAB3 142B4E2B4304 1636882B33CD
-
 
67
FFFF 1F23F079A304AD 1036022B1E6E 122AFB2AEEB0 142B4A2B4506 1636872B33CE
-
 
68
FFFF 1F23F079A304AD 1036022B1E6E 122AFE2AEBB0 142B4B2B4406 1636882B33CD
-
 
69
FFFF 1F23F079A304AD 1036012B1E6F 122AFD2AEAB2 142B4E2B4403 1636862B33CF
-
 
70
FFFF 1F23F079A304AD 1036032B1D6E 122AFD2AEBB1 142B4C2B4504 1636862B33CF
-
 
71
 
-
 
72
Frame examples with no signal received
-
 
73
 
-
 
74
FFFF 1F23F000A30426
-
 
75
FFFF 1F23F000A30426
-
 
76
FFFF 1F23F000A30426
-
 
77
FFFF 1F23F000A30426
-
 
78
FFFF 1F23F000A30426
36
    If you have any questions, feel free to send me an e-mail.
79
FFFF 1F23F000A30426
Line 37... Line 80...
37
 
80
FFFF 1F23F000A30426
Line 38... Line 81...
38
*/
81
*/
Line 47... Line 90...
47
unsigned char paket_len      = 0;
90
unsigned char paket_len      = 0;
Line 48... Line 91...
48
 
91
 
Line 49... Line 92...
49
#define UART1_BAUDRATE 38400
92
#define UART1_BAUDRATE 38400
50
 
93
 
51
volatile uint8_t rcdsl_RSSI = 0;
94
volatile uint8_t rcdsl_RSSI = 0;
52
uint8_t rcdsl_battery=0;
95
volatile uint8_t rcdsl_battery=0;
Line 53... Line 96...
53
uint8_t rcdsl_allocation=0;
96
volatile uint8_t rcdsl_allocation=0;
54
uint8_t data[6];
97
volatile uint8_t data[6];
55
 
98
 
56
typedef union {
99
typedef union {
Line -... Line 100...
-
 
100
        uint16_t pos[2];
57
        uint16_t pos[2];
101
        uint8_t dat[4];
Line 58... Line 102...
58
        uint8_t dat[4];
102
} servos_t;
59
} servos_t;
103
 
60
 
104
 
Line 81... Line 125...
81
    UCSR1A = (1 << RXC1) | (1 << TXC1);
125
    UCSR1A = (1 << RXC1) | (1 << TXC1);
Line 82... Line 126...
82
 
126
 
83
    // Reactive interrupts, if they were active before
127
    // Reactive interrupts, if they were active before
Line -... Line 128...
-
 
128
    SREG = sreg;
-
 
129
 
84
    SREG = sreg;
130
    printf("\n\rUART 1 initialized.");
Line 85... Line 131...
85
 
131
 
86
}
132
}
87
 
133
 
88
void rcdsl_new_signal(uint8_t channel, int16_t signal)
134
void rcdsl_new_signal(uint8_t channel, int16_t signal)
89
// This function is called, when a new servo signal is properly received.
135
// This function is called, when a new servo signal is properly received.
90
// Parameters: servo  - servo number (0-9)
136
// Parameters: servo  - servo number (0-9)
91
//             signal - servo signal between 7373 (1ms) and 14745 (2ms)
137
//             signal - servo signal between 7373 (1ms) and 14745 (2ms)
Line 92... Line 138...
92
{  
138
{
Line 130... Line 176...
130
    static servos_t servos;
176
    static servos_t servos;
131
    // Look for status headers
177
    // Look for status headers
132
    if ((data[0])==0x1F) {
178
    if ((data[0])==0x1F) {
133
        // Get frequency allocation
179
        // Get frequency allocation
134
        rcdsl_allocation = data[0+1];
180
        rcdsl_allocation = data[0+1];
135
        // Get signal quality
181
        // Get signal quality 
136
        rcdsl_RSSI = data[2+1];
182
        rcdsl_RSSI = data[2+1];
-
 
183
        SenderOkay = (212 * (uint16_t) rcdsl_RSSI) / 128; // have to be scaled approx. by a factor of 1.66 to get 200 at full level
-
 
184
        if(SenderOkay > 255) SenderOkay = 255;
137
        // Get voltage of battery supply
185
        // Get voltage of battery supply
138
        rcdsl_battery = data[3+1];
186
        rcdsl_battery = data[3+1];
139
    }
187
    }
Line 140... Line 188...
140
 
188