sabas1080 / Arduino_Core_STM32

STM32 core support for Arduino
Other
0 stars 0 forks source link

Problem with pines LNA and PA (CRF3 ANT_SWITCH_TX_BOOST, CRF2 HF ANT_SWITCH_TX_RFO, RADIO_RF_CTX_PA) #2

Open sabas1080 opened 6 years ago

sabas1080 commented 6 years ago

I am trying to port the RAK811 to the Arduino Core, but I am having some problems wanting to use the module Lora with the Lmic (https://github.com/mcci-catena/arduino-lmic) or Lora (https://github.com/sandeepmistry/arduino-LoRa) libraries with pins

For LNA and PA

I have added the pines extras in my pullrequest and example with lora libraries

Example sender https://gist.github.com/sabas1080/b65299bac722df0ab57f01cc3bf6a3d7

Example for lorawan with library lmic mod

https://gist.github.com/sabas1080/ff4a8ed8327cba2c6aeed8c82bfa8dd8

Communication SPI ok, but not send o receiver data for lora o lorawan

I am using the board RAK811 tracker https://es.aliexpress.com/item/RAK811-LoRa-perseguidor-junta-MAX-7Q-m-dulo-GPS-y-MEMS-Sensor-remoto-inal-mbrico-soluci/32844470946.html

Schematic RAK811 RAK811 SCH.pdf

Does anyone know how to make these pines?

jpmeijers commented 6 years ago

LMIC has a function in radio.c, that looks as follows. I think we should either never use the PA_boost output and ignore that switch pin, or we have to change this function in LMIC.

static void configPower () {
#ifdef CFG_sx1276_radio
    // no boost used for now
    s1_t pw = (s1_t)LMIC.txpow;
    if(pw >= 17) {
        pw = 15;
    } else if(pw < 2) {
        pw = 2;
    }
    // check board type for BOOST pin
    writeReg(RegPaConfig, (u1_t)(0x80|(pw&0xf)));
    writeReg(RegPaDac, readReg(RegPaDac)|0x4);

#elif CFG_sx1272_radio
    // set PA config (2-17 dBm using PA_BOOST)
    s1_t pw = (s1_t)LMIC.txpow;
    if(pw > 17) {
        pw = 17;
    } else if(pw < 2) {
        pw = 2;
    }
    writeReg(RegPaConfig, (u1_t)(0x80|(pw-2)));
#else
#error Missing CFG_sx1272_radio/CFG_sx1276_radio
#endif /* CFG_sx1272_radio */
}
chaolue commented 6 years ago

@sabas1080

I think you have those pins around the wrong way.

PB_6 -> RADIO_RF_CRX_RX - this is the RX/TX switch pin PA_4 -> RADIO_RF_CTX_PA - this is the TX (PA) Boost pin

Although it doesn't seem to make any difference as it still doesn't work.

You may want to compare your pin definitions to mbed's version here - https://github.com/ARMmbed/mbed-os/blob/master/targets/TARGET_STM/TARGET_STM32L1/TARGET_MTB_RAK811/PeripheralPins.c

Keep up the good work.