Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: alarm_slave alarm_master lora_p2p lorawan1v1 ... more
Revision 21:96db08266089, committed 2021-02-05
- Comitter:
- Wayne Roberts
- Date:
- Fri Feb 05 16:35:05 2021 -0800
- Parent:
- 20:75635d50262e
- Commit message:
- lr1110: handle tcxo when hf-xosc fails to start
Changed in this revision
radio.h | Show annotated file Show diff for this revision Revisions of this file |
radio_lr1110.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/radio.h Fri Jul 10 10:52:39 2020 -0700 +++ b/radio.h Fri Feb 05 16:35:05 2021 -0800 @@ -164,6 +164,10 @@ static void txDoneBottom(void); static void timeout_callback(bool); #endif /* SX128x_H */ +#if defined(SX1265_H) + static void my_irq_handler(void); + static bool init_irq; +#endif /* SX1265_H */ static void chipModeChange(void); static void rfsw_callback(void); static void ocp(uint8_t ma);
--- a/radio_lr1110.cpp Fri Jul 10 10:52:39 2020 -0700 +++ b/radio_lr1110.cpp Fri Feb 05 16:35:05 2021 -0800 @@ -188,6 +188,13 @@ } } +bool Radio::init_irq; +void Radio::my_irq_handler() +{ + /* radio irq immediately after hardware reset: hf_xosc start due to TCXO */ + init_irq = true; +} + void Radio::dio9_top_half() { irqAt = lpt.read_us(); @@ -228,6 +235,7 @@ void Radio::Init(const RadioEvents_t* e, unsigned spi_hz) { + uint64_t a, b; /* initialize payload length to zero in packet params */ lora_pp_buf[3] = 0; gfsk_pp_buf[6] = 0; @@ -236,14 +244,26 @@ radio.rxDone = rx_done; radio.timeout = timeout_callback; //radio.chipModeChange = chipModeChange; - radio.dio9_topHalf = dio9_top_half; RadioEvents = e; lpt.start(); spi.frequency(spi_hz); + radio.dio9_topHalf = my_irq_handler; + init_irq = false; radio.hw_reset(); + a = Kernel::get_ms_count(); + do { + b = Kernel::get_ms_count(); + /* wait for radio interrupt at hardware reset, failure to start hf_xosc */ + if (init_irq) { + radio.service(); + break; + } + } while ((b - a) < 30); + + radio.dio9_topHalf = dio9_top_half; initRfSwDIO(); }