Browse Source

base-station: Fix NRF24L01 initialization errors.

The power cycling needs to be performed with CS high.
Mathias Gottschlag 5 years ago
parent
commit
d0b4b5b256
1 changed files with 4 additions and 2 deletions
  1. 4
    2
      base-station/software/src/radio.rs

+ 4
- 2
base-station/software/src/radio.rs View File

131
 
131
 
132
         // HACK: Cycle power until transfers to the module seem to work.
132
         // HACK: Cycle power until transfers to the module seem to work.
133
         loop {
133
         loop {
134
+            cs.set_high()?;
134
             pwr.set_high()?;
135
             pwr.set_high()?;
135
-            delay_for(Duration::from_millis(10)).await;
136
+            delay_for(Duration::from_millis(100)).await;
136
             pwr.set_low()?;
137
             pwr.set_low()?;
137
-            delay_for(Duration::from_millis(10)).await;
138
+            delay_for(Duration::from_millis(50)).await;
139
+
138
             cs.set_low()?;
140
             cs.set_low()?;
139
             let mut read_aw = [0x03, 0x00];
141
             let mut read_aw = [0x03, 0x00];
140
             if spi.transfer(&mut read_aw).is_ok() {
142
             if spi.transfer(&mut read_aw).is_ok() {

Loading…
Cancel
Save