Use 8 MHz buffered radio SPI on RAK3401

This commit is contained in:
mikecarper committed 2026-10-23 01:39:08 -07:00
1 parent 258b37dff5
commit b8b7880a48
3 files changed
+5 -5

No files matched your search

+2 -2
View File
@@ -60,7 +60,7 @@ struct Module {
Module(ArduinoHal* adapter, unsigned cs, unsigned irq, unsigned rst, unsigned busy)
: hal(adapter) {
assert(cs==1 && irq==2 && rst==3 && busy==4);
assert(hal->spi == &SPI1 && hal->spiSettings.hz == 2000000);
assert(hal->spi == &SPI1 && hal->spiSettings.hz == 8000000);
}
};
struct Radio {
@@ -97,7 +97,7 @@ int main() {
class Rak3401BufferedRadioHalTests(unittest.TestCase):
def test_actual_target_uses_one_transfer_per_command_on_same_2mhz_spi1(self):
def test_actual_target_uses_one_transfer_per_command_on_same_spi1_at_8mhz(self):
target = (ROOT / "variants/rak3401/target.cpp").read_text(encoding="ascii")
construction = "\n".join(re.findall(
r"^(?:static Nrf52BufferedRadioHal radioHal\([^;]+;|"
+1 -1
View File
@@ -471,7 +471,7 @@ class Rak3401OnboardRadioTests(unittest.TestCase):
self.assertIn("P_LORA_RESET, P_LORA_BUSY, SPI)", target)
# External-radio construction and retry must retain their SPI1 owner.
external_target = (VARIANT / "target.cpp").read_text()
self.assertIn("Nrf52BufferedRadioHal radioHal(SPI1, 2000000)", external_target)
self.assertIn("Nrf52BufferedRadioHal radioHal(SPI1, 8000000)", external_target)
self.assertIn("new Module(&radioHal, P_LORA_NSS, P_LORA_DIO_1, "
"P_LORA_RESET, P_LORA_BUSY)", external_target)
external_init = extract_braced(external_target, "bool radio_init()")
+2 -2
View File
@@ -126,9 +126,9 @@ RAK3401Board board;
// controller instance for startup and watchdog recovery; resetting the radio
// must not replace or tear down the SPI object used by its Module.
// Batch each RadioLib command into one SPIM transfer rather than starting a
// transfer per byte. Retain the existing 2 MHz clock and RadioLib's BUSY,
// transfer per byte. Use the SPI1-supported 8 MHz clock and retain RadioLib's BUSY,
// chip-select, command status, and IRQ handling.
static Nrf52BufferedRadioHal radioHal(SPI1, 2000000);
static Nrf52BufferedRadioHal radioHal(SPI1, 8000000);
RADIO_CLASS radio = new Module(&radioHal, P_LORA_NSS, P_LORA_DIO_1, P_LORA_RESET, P_LORA_BUSY);
WRAPPER_CLASS radio_driver(radio, board);