(FYI: @BoRRoZ is not active on the forum lately.)
“Trying to use but no success”. What have you tried? What does work and what does not?
MCCI LoRaWAN LMIC library should work with bluepill if you apply the library patch/workaround that was discussed just above (but instead of the LMIC-Arduino library patch the source of the MCCI LoRaWAN LMIC library).
It is preferred to use the ‘Arduino Core STM32’ Aduino core. This one is actively maintained by STMicroelectronics.
In the Arduino IDE Boards Manager the ‘Arduino Core STM32’ Arduino core is called ‘STM32 Cores’ by STMicroelectronics. (Names of Arduino cores for STM32 are not always used consistently.)
I use the following pin mapping for the bluepill:
(Values between brackets are standard Arduino pin definition names for this board)
SPI/LoRa module GPIO
MOSI <----------> PA7 / 27 (MOSI)
MISO <----------> PA6 / 26 (MISO)
SCK <----------> PA5 / 25 (SCK)
NSS <----------> PA4 / 24 (SS)
RST <----------> PB0 / 28
DIO0 <----------> PA3 / 23
DIO1 <----------> PA2 / 22
DIO2 - Not needed for LoRa.
Serial port GPIO
RX <----------> PA10 / 10 (PIN_SERIAL_RX)
TX <----------> PA9 / 11 (PIN_SERIAL_TX)
The bluepill can be programmed via serial/UART but I use a STLINK v2 programmer for the flashing instead and use a separate USB to Serial connection for the serial monitor.
(Using STLink automatically puts the boarding into firmware upload mode and automatically resets it afterwards and the serial monitor stays working. This saves from having to change a BOOT jumper and do manual resets).
Code:
#define LORA_NSS SS // 24
#define LORA_RST PB0 // 28
#define LORA_DIO0 PA3 // 23
#define LORA_DIO1 PA2 // 22
// Set LoRa module pin mappings.
const lmic_pinmap lmic_pins = {
.nss = LORA_NSS,
.rxtx = LMIC_UNUSED_PIN,
.rst = LORA_RST,
.dio = { LORA_DIO0, LORA_DIO1, LMIC_UNUSED_PIN }
};
Serial port issue:
My experience with Arduino Core STM32 is that anything printed to the Serial port within the first +/- 2 seconds after calling Serial.begin() will get lost (but the length of that period is not always the same).
The common procedure for checking if the serial port is ready:
Serial.begin(115200);
while (!Serial) { /* wait until serial port is ready */ }
Serial.println("Started");
does not help because Serial indicates that it is ready but the first printed output will get lost anyway. As a workaround a +/- 2 second delay can be added after Serial.begin().