Browse Source

added NUCLEO L073RZ board, minimal-printf

nvstore
Anthony Hinsinger 7 years ago
parent
commit
e333e16041
  1. 2
      .clang-format
  2. 8
      .mbedignore
  3. 18
      README.md
  4. 60
      lora_radio_helper.h
  5. 11
      main.cpp
  6. 0
      mbed-lora-radio-drv.lib
  7. 48
      mbed_app.json
  8. 2706
      mbedtls_lora_config.h
  9. 1
      minimal-printf.lib

2
.clang-format

@ -72,7 +72,7 @@ PenaltyExcessCharacter: 1000000 @@ -72,7 +72,7 @@ PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 60
PointerAlignment: Left
ReflowComments: true
SortIncludes: true
SortIncludes: false
SpaceAfterCStyleCast: false
SpaceAfterTemplateKeyword: false
SpaceBeforeAssignmentOperators: true

8
.mbedignore

@ -0,0 +1,8 @@ @@ -0,0 +1,8 @@
mbed-os/features/netsocket/*
mbed-os/features/cellular/*
mbed-os/features/frameworks/greentea-client/*
mbed-os/features/frameworks/utest/*
mbed-os/features/frameworks/unity/*
mbed-os/features/nanostack/*
mbed-os/features/lwipstack/*
mbed-os/components/wifi/esp8266-driver/*

18
README.md

@ -36,3 +36,21 @@ From STlink CN4 Connector to RAK811 "shortest" connector (pin 1 at the same side @@ -36,3 +36,21 @@ From STlink CN4 Connector to RAK811 "shortest" connector (pin 1 at the same side
4 -> 4 (DATA)
5 -> 2 (RST)
```
### rewire STLink on a cutted Nucleo board
From STlink CN4 Connector to Nucleo CN7
```
2 -> 15 (CLK)
3 -> 19,20,22 (GND)
4 -> 13 (DATA)
5 -> 14 (RST)
```
From STLink CN3 Connector to Nucleo CN7 (stdio through USB)
```
rx -> 1 (USART4_TX)
tx -> 2 (USART4_RX)
```

60
lora_radio_helper.h

@ -20,44 +20,56 @@ @@ -20,44 +20,56 @@
#ifndef APP_LORA_RADIO_HELPER_H_
#define APP_LORA_RADIO_HELPER_H_
#if MBED_CONF_APP_LORAWAN_ENABLED
#ifdef DEVICE_SPI
#include "SX1272_LoRaRadio.h"
#include "SX1276_LoRaRadio.h"
#define SX1272 0xFF
#define SX1276 0xEE
#if(MBED_CONF_APP_LORA_RADIO == SX1272)
#if (MBED_CONF_APP_LORA_RADIO == SX1272)
SX1272_LoRaRadio radio(MBED_CONF_APP_LORA_SPI_MOSI, MBED_CONF_APP_LORA_SPI_MISO,
MBED_CONF_APP_LORA_SPI_SCLK, MBED_CONF_APP_LORA_CS, MBED_CONF_APP_LORA_RESET,
MBED_CONF_APP_LORA_DIO0, MBED_CONF_APP_LORA_DIO1, MBED_CONF_APP_LORA_DIO2,
MBED_CONF_APP_LORA_DIO3, MBED_CONF_APP_LORA_DIO4, MBED_CONF_APP_LORA_DIO5,
MBED_CONF_APP_LORA_RF_SWITCH_CTL1, MBED_CONF_APP_LORA_RF_SWITCH_CTL2,
MBED_CONF_APP_LORA_TXCTL, MBED_CONF_APP_LORA_RXCTL,
MBED_CONF_APP_LORA_ANT_SWITCH, MBED_CONF_APP_LORA_PWR_AMP_CTL,
SX1272_LoRaRadio radio(MBED_CONF_APP_LORA_SPI_MOSI,
MBED_CONF_APP_LORA_SPI_MISO,
MBED_CONF_APP_LORA_SPI_SCLK,
MBED_CONF_APP_LORA_CS,
MBED_CONF_APP_LORA_RESET,
MBED_CONF_APP_LORA_DIO0,
MBED_CONF_APP_LORA_DIO1,
MBED_CONF_APP_LORA_DIO2,
MBED_CONF_APP_LORA_DIO3,
MBED_CONF_APP_LORA_DIO4,
MBED_CONF_APP_LORA_DIO5,
MBED_CONF_APP_LORA_RF_SWITCH_CTL1,
MBED_CONF_APP_LORA_RF_SWITCH_CTL2,
MBED_CONF_APP_LORA_TXCTL,
MBED_CONF_APP_LORA_RXCTL,
MBED_CONF_APP_LORA_ANT_SWITCH,
MBED_CONF_APP_LORA_PWR_AMP_CTL,
MBED_CONF_APP_LORA_TCXO);
#elif(MBED_CONF_APP_LORA_RADIO == SX1276)
#elif (MBED_CONF_APP_LORA_RADIO == SX1276)
SX1276_LoRaRadio radio(MBED_CONF_APP_LORA_SPI_MOSI, MBED_CONF_APP_LORA_SPI_MISO,
MBED_CONF_APP_LORA_SPI_SCLK, MBED_CONF_APP_LORA_CS, MBED_CONF_APP_LORA_RESET,
MBED_CONF_APP_LORA_DIO0, MBED_CONF_APP_LORA_DIO1, MBED_CONF_APP_LORA_DIO2,
MBED_CONF_APP_LORA_DIO3, MBED_CONF_APP_LORA_DIO4, MBED_CONF_APP_LORA_DIO5,
MBED_CONF_APP_LORA_RF_SWITCH_CTL1, MBED_CONF_APP_LORA_RF_SWITCH_CTL2,
MBED_CONF_APP_LORA_TXCTL, MBED_CONF_APP_LORA_RXCTL,
MBED_CONF_APP_LORA_ANT_SWITCH, MBED_CONF_APP_LORA_PWR_AMP_CTL,
SX1276_LoRaRadio radio(MBED_CONF_APP_LORA_SPI_MOSI,
MBED_CONF_APP_LORA_SPI_MISO,
MBED_CONF_APP_LORA_SPI_SCLK,
MBED_CONF_APP_LORA_CS,
MBED_CONF_APP_LORA_RESET,
MBED_CONF_APP_LORA_DIO0,
MBED_CONF_APP_LORA_DIO1,
MBED_CONF_APP_LORA_DIO2,
MBED_CONF_APP_LORA_DIO3,
MBED_CONF_APP_LORA_DIO4,
MBED_CONF_APP_LORA_DIO5,
MBED_CONF_APP_LORA_RF_SWITCH_CTL1,
MBED_CONF_APP_LORA_RF_SWITCH_CTL2,
MBED_CONF_APP_LORA_TXCTL,
MBED_CONF_APP_LORA_RXCTL,
MBED_CONF_APP_LORA_ANT_SWITCH,
MBED_CONF_APP_LORA_PWR_AMP_CTL,
MBED_CONF_APP_LORA_TCXO);
#else
#error "Unknown LoRa radio specified (SX1272,SX1276 are valid)"
#endif
#endif // DEVICE_SPI
#endif // MBED_CONF_APP_LORAWAN_ENABLED
#endif /* APP_LORA_RADIO_HELPER_H_ */

11
main.cpp

@ -17,14 +17,14 @@ uint8_t rx_buffer[LORAMAC_PHY_MAXPAYLOAD]; @@ -17,14 +17,14 @@ uint8_t rx_buffer[LORAMAC_PHY_MAXPAYLOAD];
* Sets up an application dependent transmission timer in ms. Used only when Duty Cycling is off for
* testing
*/
#define TX_TIMER 600000
#define TX_TIMER 30000 //600000
/**
* Maximum number of events for the event queue.
* 16 is the safe number for the stack events, however, if application
* also uses the queue for whatever purposes, this number should be increased.c
*/
#define MAX_NUMBER_OF_EVENTS 16
#define MAX_NUMBER_OF_EVENTS 10
/**
* Maximum number of retries for CONFIRMED messages before giving up
@ -45,9 +45,10 @@ AnalogIn bat(MBED_CONF_APP_BATTERY_ADC); @@ -45,9 +45,10 @@ AnalogIn bat(MBED_CONF_APP_BATTERY_ADC);
DHT dht(MBED_CONF_APP_DHT_DATA, MBED_CONF_APP_DHT_TYPE);
#endif
DigitalOut led(LED1, 1);
//DigitalOut led(LED1, 1);
int main(void) {
lorawan_status_t retcode;
// Initialize LoRaWAN stack
if(lorawan.initialize(&ev_queue) != LORAWAN_STATUS_OK) {
@ -76,7 +77,7 @@ int main(void) { @@ -76,7 +77,7 @@ int main(void) {
printf("\r\n Adaptive data rate (ADR) - Enabled \r\n");
led = 0;
//led = 0;
retcode = lorawan.connect();
@ -161,7 +162,7 @@ static void receive_message() { @@ -161,7 +162,7 @@ static void receive_message() {
static void lora_event_handler(lorawan_event_t event) {
switch(event) {
case CONNECTED:
led = 1;
//led = 1;
printf("\r\n Connection - Successful \r\n");
if(MBED_CONF_LORA_DUTY_CYCLE_ON) {
send_message();

0
mbed-semtech-lora-rf-drivers.lib → mbed-lora-radio-drv.lib

48
mbed_app.json

@ -5,9 +5,6 @@ @@ -5,9 +5,6 @@
"value": "SX1276"
},
"main_stack_size": { "value": 4096 },
"lorawan-enabled": { "value": false},
"lora-spi-mosi": { "value": "NC" },
"lora-spi-miso": { "value": "NC" },
"lora-spi-sclk": { "value": "NC" },
@ -26,28 +23,27 @@ @@ -26,28 +23,27 @@
"lora-ant-switch": { "value": "NC" },
"lora-pwr-amp-ctl": { "value": "NC" },
"lora-tcxo": { "value": "NC" },
"battery-enabled": { "value": "false" },
"battery-adc": { "value": "NC" },
"dht-enabled": { "value": "false" },
"dht-type": { "value": "DHT::DHT22" },
"dht-data": { "value": "NC" }
},
"target_overrides": {
"*": {
"platform.stdio-convert-newlines": true,
"platform.stdio-baud-rate": 115200,
"platform.default-serial-baud-rate": 115200,
"lora.app-port": 3,
"lora.over-the-air-activation": true,
"lora.duty-cycle-on": false,
"lora.phy": 0,
"lora.device-eui": "{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }",
"lora.application-eui": "{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }",
"lora.application-key": "{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }"
"lora.device-eui": "{ 0x00, 0xC0, 0xE1, 0xC8, 0x1E, 0xFE, 0xBA, 0xA7 }",
"lora.application-eui": "{ 0x70, 0xB3, 0xD5, 0x7E, 0xF0, 0x00, 0x40, 0x5D }",
"lora.application-key": "{ 0x15, 0x8A, 0x34, 0x3B, 0xCC, 0x3E, 0xDE, 0xEC, 0xD2, 0x93, 0x45, 0xB4, 0xD3, 0x64, 0xA4, 0x37 }"
},
"K64F": {
"lorawan-enabled": true,
"lora-spi-mosi": "D11",
"lora-spi-miso": "D12",
"lora-spi-sclk": "D13",
@ -70,7 +66,6 @@ @@ -70,7 +66,6 @@
"DISCO_L072CZ_LRWAN1": {
"main_stack_size": 3072,
"lorawan-enabled": true,
"lora-radio": "SX1276",
"lora-spi-mosi": "PA_7",
@ -94,8 +89,6 @@ @@ -94,8 +89,6 @@
},
"MTB_MURATA_ABZ": {
"lorawan-enabled": true,
"lora-radio": "SX1276",
"lora-spi-mosi": "PA_7",
"lora-spi-miso": "PA_6",
@ -118,8 +111,6 @@ @@ -118,8 +111,6 @@
},
"XDOT_L151CC": {
"lorawan-enabled": true,
"lora-radio": "SX1272",
"lora-spi-mosi": "LORA_MOSI",
"lora-spi-miso": "LORA_MISO",
@ -142,8 +133,6 @@ @@ -142,8 +133,6 @@
},
"MTB_MTS_XDOT": {
"lorawan-enabled": true,
"lora-radio": "SX1272",
"lora-spi-mosi": "LORA_MOSI",
"lora-spi-miso": "LORA_MISO",
@ -166,8 +155,6 @@ @@ -166,8 +155,6 @@
},
"LTEK_FF1705": {
"lorawan-enabled": true,
"lora-radio": "SX1272",
"lora-spi-mosi": "LORA_MOSI",
"lora-spi-miso": "LORA_MISO",
@ -190,8 +177,6 @@ @@ -190,8 +177,6 @@
},
"MTS_MDOT_F411RE": {
"lorawan-enabled": true,
"lora-radio": "SX1272",
"lora-spi-mosi": "LORA_MOSI",
"lora-spi-miso": "LORA_MISO",
@ -214,8 +199,6 @@ @@ -214,8 +199,6 @@
},
"MTB_ADV_WISE_1510": {
"lorawan-enabled": true,
"lora-radio": "SX1276",
"lora-spi-mosi": "SPI_RF_MOSI",
"lora-spi-miso": "SPI_RF_MISO",
@ -238,8 +221,6 @@ @@ -238,8 +221,6 @@
},
"MTB_RAK811": {
"lorawan-enabled": true,
"lora-radio": "SX1276",
"lora-spi-mosi": "SPI_RF_MOSI",
"lora-spi-miso": "SPI_RF_MISO",
@ -259,18 +240,19 @@ @@ -259,18 +240,19 @@
"lora-ant-switch": "NC",
"lora-pwr-amp-ctl": "NC",
"lora-tcxo": "RF_TCXO_EN",
"battery-enabled": true,
"battery-adc": "PA_2",
"dht-enabled": true,
"dht-data": "PA_1",
"dht-type": "DHT::DHT22"
},
"NUCLEO_L073RZ": {
"lorawan-enabled": true,
"main_stack_size": 1024,
"target.lpticker_lptim": 0,
"target.clock_source": "USE_PLL_HSI",
"target.stdio_uart_tx": "PC_10",
"target.stdio_uart_rx": "PC_11",
"lora-radio": "SX1272",
"lora-spi-mosi": "D11",
"lora-spi-miso": "D12",
@ -281,8 +263,8 @@ @@ -281,8 +263,8 @@
"lora-dio1": "D3",
"lora-dio2": "D4",
"lora-dio3": "D5",
"lora-dio4": "D8",
"lora-dio5": "D9",
"lora-dio4": "NC",
"lora-dio5": "NC",
"lora-rf-switch-ctl1": "NC",
"lora-rf-switch-ctl2": "NC",
"lora-txctl": "NC",
@ -290,12 +272,10 @@ @@ -290,12 +272,10 @@
"lora-ant-switch": "A4",
"lora-pwr-amp-ctl": "NC",
"lora-tcxo": "NC",
"battery-enabled": false,
"battery-adc": "PA_2",
"dht-enabled": true,
"dht-data": "PA_1",
"dht-data": "D8",
"dht-type": "DHT::DHT22"
}
},

2706
mbedtls_lora_config.h

File diff suppressed because it is too large Load Diff

1
minimal-printf.lib

@ -0,0 +1 @@ @@ -0,0 +1 @@
https://github.com/ARMmbed/minimal-printf/#7a57a3e36a227a3e412cec55b0eeaf649b9fa7c9
Loading…
Cancel
Save