gfroerli / firmware

Firmware for the water temperature sensor project
GNU General Public License v3.0
6 stars 1 forks source link

Add basic support for RN2483 #71

Closed dbrgn closed 3 years ago

dbrgn commented 4 years ago

Based on #70.

dbrgn commented 3 years ago

Updated, based on #78 and #77.

dbrgn commented 3 years ago

Right now the frame counter is not persisted, so it starts at 0 after every reset.

dbrgn commented 3 years ago

Resetting the RN works at power-up, but when doing "power off" and "power on" in JLinkExe, for some reason it gets stuck after GPIO reset.

Furthermore, while experimenting, with this diff:

--- a/src/main.rs
+++ b/src/main.rs
@@ -182,11 +182,13 @@ const APP: () = {
         // Initialize RN2xx3
         writeln!(debug, "Init RN2483…").unwrap();
         let mut rn = rn2483_868(lpuart1);
-        writeln!(debug, "RN2483: Hard reset…").unwrap();
+        writeln!(debug, "RN2483: Hard reset via reset pin…").unwrap();
         let mut rn_reset_pin = gpioa.pa4.into_push_pull_output();
         rn_reset_pin.set_low().expect("Could not set RN reset pin");
-        delay.delay_us(1000); // TODO: How long?
+        delay.delay_ms(100); // TODO: How long?
         rn_reset_pin.set_high().expect("Could not set RN reset pin");
+        delay.delay_ms(1000); // TODO: How long?
+        writeln!(debug, "RN2483: Soft reset…").unwrap();
         let version = rn.reset().expect("Could not soft reset");
         writeln!(debug, "RN2483: Version {}", version).unwrap();

...it doesn't even work at all after flashing.

We probably need to use a logic analyzer (on the RN serial pins) to see what's going on.

dbrgn commented 3 years ago

Rebased against current master.