Giter Site home page Giter Site logo

grumpyoldpizza / arduinocore-stm32l0 Goto Github PK

View Code? Open in Web Editor NEW
125.0 21.0 67.0 65.56 MB

Arduino Core for STM32L0

C 94.69% C++ 5.02% Makefile 0.06% Batchfile 0.01% Assembly 0.12% Shell 0.01% Tcl 0.10%
arduino lora lorawan tlera-corp-boards stm32l0 stm32l082 sx1276 cmwx1zzabz

arduinocore-stm32l0's Introduction

Arduino Core for STM32L0 based boards

What is it ?

ArduinoCore-stm32l0 is targeted at ultra low power scenarios, sensor hubs, with LoRaWAN connectivity.

Supported boards

Tlera Corp

STMicroelectronics

Installing

Board Manager

  1. Download and install the Arduino IDE (at least version v1.6.8)
  2. Start the Arduino IDE
  3. Go into Preferences
  4. Add https://grumpyoldpizza.github.io/ArduinoCore-stm32l0/package_stm32l0_boards_index.json as an "Additional Board Manager URL"
  5. Open the Boards Manager from the Tools -> Board menu and install "Tlera Corp STM32L0 Boards"
  6. Select your STM32L0 board from the Tools -> Board menu

OS Specific Setup

Linux
  1. Go to ~/.arduino15/packages/TleraCorp/hardware/stm32l0/<VERSION>/drivers/linux/
  2. sudo cp *.rules /etc/udev/rules.d
  3. reboot
Windows
STM32 BOOTLOADER driver setup for Tlera Corp boards
  1. Download Zadig
  2. Plugin STM32L0 board and toggle the RESET button while holding down the BOOT button
  3. Let Windows finish searching for drivers
  4. Start Zadig
  5. Select Options -> List All Devices
  6. Select STM32 BOOTLOADER from the device dropdown
  7. Select WinUSB (v6.1.7600.16385) as new driver
  8. Click Replace Driver
USB Serial driver setup for Tlera Corp boards (Window XP / Windows 7 only)
  1. Go to ~/AppData/Local/Arduino15/packages/TleraCorp/hardware/stm32l0/<VERSION>/drivers/windows
  2. Right-click on dpinst_x86.exe (32 bit Windows) or dpinst_amd64.exe (64 bit Windows) and select Run as administrator
  3. Click on Install this driver software anyway at the Windows Security popup as the driver is unsigned
ST-LINK V2.1 driver setup for STMicroelectronics boards
  1. Plugin STMicroelectronics board
  2. Download and install ST-Link USB Drivers

From git

  1. Follow steps from Board Manager section above
  2. cd <SKETCHBOOK>, where <SKETCHBOOK> is your Arduino Sketch folder:
  • OS X: ~/Documents/Arduino
  • Linux: ~/Arduino
  • Windows: ~/Documents/Arduino
  1. Create a folder named hardware, if it does not exist, and change directories to it
  2. Clone this repo: git clone https://github.com/grumpyoldpizza/ArduinoCore-stm32l0.git TleraCorp/stm32l0
  3. Restart the Arduino IDE

Recovering from a faulty sketch for Tlera Corp Boards

Sometimes a faulty sketch can render the normal USB Serial based integration into the Arduindo IDE not working. In this case plugin the STM32L0 board and toggle the RESET button while holding down the BOOT button and program a known to be working sketch to go back to a working USB Serial setup.

Credits

This core is based on and compatible with the Arduino SAMD Core

arduinocore-stm32l0's People

Contributors

altaga avatar grumpyoldpizza avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

arduinocore-stm32l0's Issues

OTAA join not working after session save

Not sure if this is intentional behavior or not, but, after I perform setSaveSession(true) and joint the network the first time, subsequent joinOTAA's have no effect, ie. no MAC commands are sent to a network server and no onJoin event is triggered. It looks that uplinks continue with the previous frame count value.
So, in effect, joinOTAA acts like rejoinOTAA which is unexpected and undesirable.

The reason I'd like joinOTAA to start a fresh join process with the server is allow for recovery from potential state corruption in either a node or in a network server without waiting very long time for the MAC stack to determine no gateways are connected. Additionally, on the system reboot, I perform join and wait for onJoin event before proceeding further. If it never happens, it causes some issues.

Firmware update utility?

Will you be providing a utility to read firmware version and to allow to re-flash of new firmware version as they become available from muRata or ST-Micro??

I do see a FWUpdaterBridge.ino in the Arduino MRKWAN examples for the MRK1300 board..

Use of TimerMillis seems to interfere with LoRaWAN join

I have a TimerMillis that I'm using to blink LEDs -- it triggers every 100ms. If I do not activate this timer, the the join seems to occur immediately. When it's in use, join can take several minutes.

Having the timer > 1000 ms helps considerably.

Is there some sort of timer contention on the STM32L0?

new pin define in variant.cpp

Hi, i use B-L072Z-LRWAN1 board. And i want to use PH1/A4, PH0/A5.(i connect SB1 and SB10) i modify the pin define in viriant.cpp as below. But the pin not work as i wish. Can you have a look for these?
`extern const PinDescription g_APinDescription[PINS_COUNT] =
{
// 0..13 - Digital pins
{ GPIOA, STM32L0_GPIO_PIN_MASK(STM32L0_GPIO_PIN_PA3), STM32L0_GPIO_PIN_PA3, (PIN_ATTR_EXTI), PWM_INSTANCE_NONE, PWM_CHANNEL_NONE, ADC_CHANNEL_NONE },
{ GPIOA, STM32L0_GPIO_PIN_MASK(STM32L0_GPIO_PIN_PA2), STM32L0_GPIO_PIN_PA2, (PIN_ATTR_EXTI), PWM_INSTANCE_NONE, PWM_CHANNEL_NONE, ADC_CHANNEL_NONE },
{ GPIOA, STM32L0_GPIO_PIN_MASK(STM32L0_GPIO_PIN_PA10), STM32L0_GPIO_PIN_PA10, (PIN_ATTR_EXTI), PWM_INSTANCE_NONE, PWM_CHANNEL_NONE, ADC_CHANNEL_NONE },
{ NULL, 0, STM32L0_GPIO_PIN_NONE, 0, PWM_INSTANCE_NONE, PWM_CHANNEL_NONE, ADC_CHANNEL_NONE },
{ GPIOB, STM32L0_GPIO_PIN_MASK(STM32L0_GPIO_PIN_PB5), STM32L0_GPIO_PIN_PB5, (PIN_ATTR_EXTI), PWM_INSTANCE_NONE, PWM_CHANNEL_NONE, ADC_CHANNEL_NONE },
{ GPIOB, STM32L0_GPIO_PIN_MASK(STM32L0_GPIO_PIN_PB7), STM32L0_GPIO_PIN_PB7, (PIN_ATTR_EXTI), PWM_INSTANCE_NONE, PWM_CHANNEL_NONE, ADC_CHANNEL_NONE },
{ GPIOB, STM32L0_GPIO_PIN_MASK(STM32L0_GPIO_PIN_PB2), STM32L0_GPIO_PIN_PB2, (PIN_ATTR_EXTI), PWM_INSTANCE_NONE, PWM_CHANNEL_NONE, ADC_CHANNEL_NONE },
{ GPIOA, STM32L0_GPIO_PIN_MASK(STM32L0_GPIO_PIN_PA8), STM32L0_GPIO_PIN_PA8, (PIN_ATTR_EXTI), PWM_INSTANCE_NONE, PWM_CHANNEL_NONE, ADC_CHANNEL_NONE },
{ GPIOA, STM32L0_GPIO_PIN_MASK(STM32L0_GPIO_PIN_PA9), STM32L0_GPIO_PIN_PA9, (PIN_ATTR_EXTI), PWM_INSTANCE_NONE, PWM_CHANNEL_NONE, ADC_CHANNEL_NONE },
{ GPIOB, STM32L0_GPIO_PIN_MASK(STM32L0_GPIO_PIN_PB12), STM32L0_GPIO_PIN_PB12, (PIN_ATTR_EXTI), PWM_INSTANCE_NONE, PWM_CHANNEL_NONE, ADC_CHANNEL_NONE },
{ GPIOB, STM32L0_GPIO_PIN_MASK(STM32L0_GPIO_PIN_PB6), STM32L0_GPIO_PIN_PB6, (PIN_ATTR_EXTI), PWM_INSTANCE_NONE, PWM_CHANNEL_NONE, ADC_CHANNEL_NONE },
{ GPIOB, STM32L0_GPIO_PIN_MASK(STM32L0_GPIO_PIN_PB15), STM32L0_GPIO_PIN_PB15, (PIN_ATTR_EXTI), PWM_INSTANCE_NONE, PWM_CHANNEL_NONE, ADC_CHANNEL_NONE },
{ GPIOB, STM32L0_GPIO_PIN_MASK(STM32L0_GPIO_PIN_PB14), STM32L0_GPIO_PIN_PB14, (PIN_ATTR_EXTI), PWM_INSTANCE_NONE, PWM_CHANNEL_NONE, ADC_CHANNEL_NONE },
{ GPIOB, STM32L0_GPIO_PIN_MASK(STM32L0_GPIO_PIN_PB13), STM32L0_GPIO_PIN_PB13_TIM21_CH1, (PIN_ATTR_EXTI), PWM_INSTANCE_TIM21, PWM_CHANNEL_1, ADC_CHANNEL_NONE },

// 14..15 - I2C pins (SDA,SCL)
{ GPIOB, STM32L0_GPIO_PIN_MASK(STM32L0_GPIO_PIN_PB9),  STM32L0_GPIO_PIN_PB9,            (PIN_ATTR_EXTI),                               PWM_INSTANCE_NONE,  PWM_CHANNEL_NONE, ADC_CHANNEL_NONE },
{ GPIOB, STM32L0_GPIO_PIN_MASK(STM32L0_GPIO_PIN_PB8),  STM32L0_GPIO_PIN_PB8,            (PIN_ATTR_EXTI),                               PWM_INSTANCE_NONE,  PWM_CHANNEL_NONE, ADC_CHANNEL_NONE },

// 16..21 - Analog pins
{ GPIOA, STM32L0_GPIO_PIN_MASK(STM32L0_GPIO_PIN_PA0),  STM32L0_GPIO_PIN_PA0,            (PIN_ATTR_WKUP1),                              PWM_INSTANCE_NONE,  PWM_CHANNEL_NONE, ADC_CHANNEL_0    },
{ NULL,  0,                                            STM32L0_GPIO_PIN_NONE,           0,                                             PWM_INSTANCE_NONE,  PWM_CHANNEL_NONE, ADC_CHANNEL_NONE },
{ GPIOA, STM32L0_GPIO_PIN_MASK(STM32L0_GPIO_PIN_PA4),  STM32L0_GPIO_PIN_PA4,            0,                                             PWM_INSTANCE_NONE,  PWM_CHANNEL_NONE, ADC_CHANNEL_4    },
{ NULL,  0,                                            STM32L0_GPIO_PIN_NONE,           0,                                             PWM_INSTANCE_NONE,  PWM_CHANNEL_NONE, ADC_CHANNEL_NONE },
{ GPIOH, STM32L0_GPIO_PIN_MASK(STM32L0_GPIO_PIN_PH1),  STM32L0_GPIO_PIN_PH1,             (PIN_ATTR_EXTI),                               PWM_INSTANCE_NONE,  PWM_CHANNEL_NONE, ADC_CHANNEL_NONE },
{ GPIOH, STM32L0_GPIO_PIN_MASK(STM32L0_GPIO_PIN_PH0),  STM32L0_GPIO_PIN_PH0,             (PIN_ATTR_EXTI),                               PWM_INSTANCE_NONE,  PWM_CHANNEL_NONE, ADC_CHANNEL_NONE },

};`

PB6 digital write issue ?

Hi !
Finally received my boards with Murata ABZ module. I have a strange problem : the led I attached on pin PB6 doesn't light on. I checked with my voltmeter , nothings comes out. With pins around it, no problem. I checked in variant.cpp and nothing seems wrong.

Before going deeper, if you have any idea I take it ... Or if someone could check on his board and confirm it just mine which has the problem he's welcome :)

Regards

binary size questions

I've been playing with this core for a few days using a custom L082 board and I'm a bit shocked at the resulting binary (upload) sizes. A hello world takes just under 20KB, adding I2C brings it to ~30KB. Yes, the device has plenty of flash but the size affects the edit/compile/debug cycle. I'm using a BMP and it takes ~10 seconds to upload the 30KB. I looked at the map and the main culprits in the I2C case are the stm32l0 device drivers (in particular the interrupt handlers), malloc (is that really required?), and aeabi float arithmetic.

I'm curious what you are finding. Do you use LoRaWAN all the time and so the code size is gigantic anyway? Does the USB DFU bootloader make this irrelevant, i.e. super-fast? Do you find that the complex device drivers with DMA and all that are actually worth it?

Here are the functions >1KB using nm --print-size --size-sort:

080043bc 00000108 t stm32l0_uart_dma_receive    /home/thomas/ArduinoCore-stm32l0/system/STM32L0xx/Source/stm32l0_uart.c:111
08005d84 0000010a T __udivsi3
080033b0 00000114 T RTC_IRQHandler      /home/thomas/ArduinoCore-stm32l0/system/STM32L0xx/Source/stm32l0_rtc.c:1305
08001a3c 0000013c T stm32l0_gpio_pin_configure  /home/thomas/ArduinoCore-stm32l0/system/STM32L0xx/Source/stm32l0_gpio.c:87
08006e18 00000140 t stm32l0_rtc_bcd_year_to_days        /home/thomas/ArduinoCore-stm32l0/system/STM32L0xx/Source/stm32l0_rtc.c:83
08003098 00000144 t stm32l0_rtc_timer_alarm     /home/thomas/ArduinoCore-stm32l0/system/STM32L0xx/Source/stm32l0_rtc.c:574
080044f0 00000158 t stm32l0_uart_stop   /home/thomas/ArduinoCore-stm32l0/system/STM32L0xx/Source/stm32l0_uart.c:469
080034c4 0000015c T SystemInit  /home/thomas/ArduinoCore-stm32l0/system/STM32L0xx/Source/stm32l0_system.c:195
08004e14 00000170 T stm32l0_uart_configure      /home/thomas/ArduinoCore-stm32l0/system/STM32L0xx/Source/stm32l0_uart.c:1121
08000a60 00000174 T _ZN4Uart5writeEPKhj
08001d7c 00000178 t stm32l0_i2c_start   /home/thomas/ArduinoCore-stm32l0/system/STM32L0xx/Source/stm32l0_i2c.c:101
080060b0 00000182 T __udivmoddi4
08004648 00000184 t stm32l0_uart_start  /home/thomas/ArduinoCore-stm32l0/system/STM32L0xx/Source/stm32l0_uart.c:347
20001438 0000018c b armv6m_pendsv_control       /home/thomas/ArduinoCore-stm32l0/system/STM32L0xx/Source/armv6m_pendsv.c:48
08002ef4 000001a4 T stm32l0_rtc_calendar_offset /home/thomas/ArduinoCore-stm32l0/system/STM32L0xx/Source/stm32l0_rtc.c:1120
08001290 000001b8 T stm32l0_adc_read    /home/thomas/ArduinoCore-stm32l0/system/STM32L0xx/Source/stm32l0_adc.c:179
08002754 000001bc T stm32l0_i2c_configure       /home/thomas/ArduinoCore-stm32l0/system/STM32L0xx/Source/stm32l0_i2c.c:1167
08006ba4 000001c8 T g_APinDescription
08005e98 000001cc T __divsi3
08004184 000001d0 T stm32l0_timer_channel       /home/thomas/ArduinoCore-stm32l0/system/STM32L0xx/Source/stm32l0_timer.c:428
08005364 000001d4 T _free_r
08006568 00000224 T __aeabi_fdiv
0800678c 00000264 T __aeabi_fmul
08006234 00000334 T __aeabi_fadd
08003ce8 000003f4 T stm32l0_system_initialize   /home/thomas/ArduinoCore-stm32l0/system/STM32L0xx/Source/stm32l0_system.c:294
20000c38 00000408 D __malloc_av_
20000810 00000428 d impure_data
08004894 0000047c t stm32l0_uart_interrupt      /home/thomas/ArduinoCore-stm32l0/system/STM32L0xx/Source/stm32l0_uart.c:584
08003620 000004d0 T stm32l0_system_sysclk_configure     /home/thomas/ArduinoCore-stm32l0/system/STM32L0xx/Source/stm32l0_system.c:647
08005580 00000554 T _malloc_r
08001fa4 0000069c t stm32l0_i2c_interrupt       /home/thomas/ArduinoCore-stm32l0/system/STM32L0xx/Source/stm32l0_i2c.c:542

Several channels appear on one up-link

Hi
First, very appreciate this great job(Lorawan library).
My code is shown below. I am using ABP.
void setup( void )
{
LoRaWAN.begin(EU868);
for (unsigned int i = 3; i <16; i++)
{
LoRaWAN.disableChannel(i);
}
LoRaWAN.setADR(false);
LoRaWAN.setDataRate(0);
LoRaWAN.joinABP(appEui, appKey, devEui);
while(!LoRaWAN.joined()) { };
}
void loop( void )
{
if (!LoRaWAN.busy() && LoRaWAN.joined())
{
LoRaWAN.beginPacket(25);
//-------------------
use LoRaWAN.write() to write 9 data bytes
//-------------------
LoRaWAN.endPacket();
}
STM32L0.stop(120000);
}
And i found a very strange thing on the TTN gateway as below picture.
s__6234215
At the same time, not only one channel but also another channel with 867.7 or 867.5 MHz.
................does it the frequency hoping???
Thank you very much
Ross

LoRaWAN.disableChannel() not working?

Hi,

I am trying to setup a single channel node, so that I can combine it with a single channel gateway. I am using the Add B-L072Z-LRWAN1 in combination with your (great!) library.

I found LoRaWAN.disableChannel() by snooping into the source coude and figured I could use this to, well, disable channels. So that I end up with a single channel gateway. So my setup now looks like this:

void setup( void )
{
LoRaWAN.begin(EU868);

for (unsigned int x = 1; x <=15; x++)
{
LoRaWAN.disableChannel(x);
}
// LoRaWAN.setADR(false);
LoRaWAN.setDataRate(0);
LoRaWAN.setTxPower(10);
LoRaWAN.setSubBand(2); // for TTN
LoRaWAN.joinOTAA(appEui, appKey, devEui);
}

But... There are still transmissions on other channels than 0 as well, as you can see on the screenshot below.

image

Am I using disableChannel() wrong, or could it be something else is wrong?

Thanks,

David

STM32L0.stop and timers

Hi,

Not exactly clear on how device comes out of stop() mode. Would you kindly explain what is going on in this small attached code sample.

Why am I seeing the following print statements ?

Serial enabled!
Hello World
Going to sleep
Do callback Loratx
Do callback Loratx
Do callback Loratx
Do callback Loratx
Do callback Loratx
Do callback Loratx

I would have expected to see the loop execute until the following sleep... and I can only assume the reason this code works at all is that the timer callback also wakes up the device ?

Kind thanks,
Serge

Code Sample

#include <Arduino.h>
#include <STM32L0.h>
#include "TimerMillis.h"

TimerMillis LoRaTimer;

void setup() {
    
  Serial.begin(115200);
  delay(4000);
  Serial.println("Serial enabled!");
 
  LoRaTimer.start(callbackLoRaTx,  5000, 35000);  
}

void loop() {

    Serial.println("Hello World");
    delay(500);
    
    Serial.println("Going to sleep");
    STM32L0.stop();        // Enter STOP mode and wait for an interrupt
    delay(1000);
}

void callbackLoRaTx(void)
{           
    Serial.println("Do callback Loratx");    
}

Additional Board Manager URL FAILURE

Hi
I am not sure why, but i dont think the additional board manager link goes anywhere. I tried to add it through arduino preferences, but none of the boards pop up in the board manager. So I cant add them.

Would love to get some help on this is possible

Thanks
Matt

I Nucleo LRWAN1 standalone.

I am new to STM32 world! But I am interested to port a Sprinkler controller SW to USI Lorawan module.

The code is now written for Arduino uno and a Semteck module. I think that using your core library , porting should be easy.
Now I don't use LORAWAN but point to point RadioHead library to communicate between modules.
I can probably move to LORAWAN or port the RadioHead library to STM32...booth are valid alternatives!

To have a good low power profile is a must.I have now an average drain of 500uA.
To minimize power I need to use the I NUCLEO LRWAN1 as a standalone unit, final device will be based upon USI module.

Interrupts

Hi,
Do the interrupts work?
I am trying to find out which pins are enabled for using them.

Thank
Riccardo

Change i2c pins or Wire1 available ?

Hi,

First thanks for your Arduino Core and libraries, it's very powerful !!

I'm trying to play with STM32L082 but in LQFP32 package, which has not PB8 and PB9 for i2c. But as PB7 and PB6 are available, would it be difficult to implement Wire1 on this pin ? Or switch Wire to this pins ? Based on what I understood, almost everything seems ready to do it, it just seems to miss pins definition, but as it's my first time playing with STM32 I don't know if it would be enough ...

Thanks

[core] UART 'Callback' has not been declared

The following library fails to compile for this core but works well on others (AVR, ESP8266) although it appears to use only standard Wire and Serial functions: https://github.com/Ralim/BQ34Z100

Traceback below shows that:

Uart.h:69:52: error: 'Callback' has not been declared

repeated a number of times. I have not started digging into details on this to know more. TO reproduce, install library and run the provided example.

In file included from C:\Users\Uporabnik\AppData\Local\Arduino15\packages\TleraCorp\hardware\stm32l0\0.0.7\variants\B-L072Z-LRWAN1/variant.h:48:0,

                 from C:\Users\Uporabnik\AppData\Local\Arduino15\packages\TleraCorp\hardware\stm32l0\0.0.7\libraries\Wire\src/Wire.h:24,

                 from C:\Users\Uporabnik\Documents\Arduino\libraries\bq34z100\bq34z100.h:4,

                 from C:\Users\Uporabnik\Documents\Arduino\libraries\bq34z100\bq34z100.cpp:13:

C:\Users\Uporabnik\AppData\Local\Arduino15\packages\TleraCorp\hardware\stm32l0\0.0.7\cores\arduino/Uart.h:69:52: error: 'Callback' has not been declared

     bool write(const uint8_t *buffer, size_t size, Callback callback);

                                                    ^

C:\Users\Uporabnik\AppData\Local\Arduino15\packages\TleraCorp\hardware\stm32l0\0.0.7\cores\arduino/Uart.h:82:20: error: 'Callback' has not been declared

     void onReceive(Callback callback);

                    ^

C:\Users\Uporabnik\AppData\Local\Arduino15\packages\TleraCorp\hardware\stm32l0\0.0.7\cores\arduino/Uart.h:101:5: error: 'Callback' does not name a type

     Callback _completionCallback;

     ^

C:\Users\Uporabnik\AppData\Local\Arduino15\packages\TleraCorp\hardware\stm32l0\0.0.7\cores\arduino/Uart.h:102:5: error: 'Callback' does not name a type

     Callback _receiveCallback;

     ^

In file included from C:\Users\Uporabnik\Documents\Arduino\libraries\bq34z100\bq34z100.h:4:0,

                 from C:\Users\Uporabnik\Documents\Arduino\libraries\bq34z100\bq34z100.cpp:13:

C:\Users\Uporabnik\AppData\Local\Arduino15\packages\TleraCorp\hardware\stm32l0\0.0.7\libraries\Wire\src/Wire.h:112:5: error: 'Callback' does not name a type

     Callback _callback;

     ^

C:\Users\Uporabnik\Documents\Arduino\libraries\bq34z100\bq34z100.cpp: In member function 'int bq34z100::setup(uint8_t, uint8_t, uint16_t, uint16_t, uint16_t)':

C:\Users\Uporabnik\Documents\Arduino\libraries\bq34z100\bq34z100.cpp:155:1: warning: no return statement in function returning non-void [-Wreturn-type]

 }

 ^

C:\Users\Uporabnik\Documents\Arduino\libraries\bq34z100\bq34z100.cpp: At global scope:

C:\Users\Uporabnik\Documents\Arduino\libraries\bq34z100\bq34z100.cpp:127:5: warning: unused parameter 'BatteryChemistry' [-Wunused-parameter]

 int bq34z100::setup(uint8_t BatteryChemistry,uint8_t SeriesCells,uint16_t CellCapacity,uint16_t PackCurrentVoltage,uint16_t AppliedCurrent)

     ^

C:\Users\Uporabnik\Documents\Arduino\libraries\bq34z100\bq34z100.cpp: In member function 'bool bq34z100::readFlash(uint16_t, uint8_t)':

C:\Users\Uporabnik\Documents\Arduino\libraries\bq34z100\bq34z100.cpp:220:10: warning: unused variable 'changed' [-Wunused-variable]

     bool changed = false;

          ^

C:\Users\Uporabnik\Documents\Arduino\libraries\bq34z100\bq34z100.cpp: In member function 'void bq34z100::writeTable(uint16_t, uint8_t)':

C:\Users\Uporabnik\Documents\Arduino\libraries\bq34z100\bq34z100.cpp:252:10: warning: unused variable 'changed' [-Wunused-variable]

     bool changed = false;

          ^

C:\Users\Uporabnik\Documents\Arduino\libraries\bq34z100\bq34z100.cpp: At global scope:

C:\Users\Uporabnik\Documents\Arduino\libraries\bq34z100\bq34z100.cpp:265:6: warning: unused parameter 'subclass' [-Wunused-parameter]

 void bq34z100::checkSum(uint16_t subclass, uint8_t offset)

      ^

C:\Users\Uporabnik\Documents\Arduino\libraries\bq34z100\bq34z100.cpp:265:6: warning: unused parameter 'offset' [-Wunused-parameter]

Using library Wire at version 1.0 in folder: C:\Users\Uporabnik\AppData\Local\Arduino15\packages\TleraCorp\hardware\stm32l0\0.0.7\libraries\Wire 
Using library bq34z100 in folder: C:\Users\Uporabnik\Documents\Arduino\libraries\bq34z100 (legacy)
exit status 1
Error compiling for board B-L072Z-LRWAN1.

[LoRaWAN] Single channel gateway issue

Hi,

I tried two single channel gateway and having troubles with both, but no problem on a "real" gateway (Rpi+ic-880).

I tried OTAA and ABP.

OTAA : the node doesn't not seems to receive the JOIN_ACCEPT message. I tried a lot of config, the join resquest is well received (I have to fix DR to 5) the gateway seems to send well the join accept but the node seems to receive nothing.

ABP : it works but only ~1msg/5 succesfully arrived on server :s

As the issue appears on two different gateways (one is esp32 + sx1276 board, the other is a Dragino LG01) I think it's not coming from the gateway firmwares or it's a protocol issue I missed something configuring node and/or gateway.

So if you have any suggestion :)

[LoRaWAN] First packet is empty

Hi,

Every time I run for example LORAWAN_TTN_OTAA.ino , the first packet is empty :

image

I have not this issue with my mDot868.

Support for Sigfox connectivity

Hi,

First, thank you for your amazing work ! :)

Are you planning to add Sigfox connectivity on Arduino for the Murata module ?

I can't find any native implementations of the Sigfox stack for Arduino. Only examples I've found are for the MKRFOX1200 that use a Sigfox modem with AT command set.

There are few examples projects in the Sigfox STCubeMX package but I don't think I will be able to port the stack for Arduino...

Thanks !

How to Change clock speed - V2

Hi,
If through the Arduino I choose the 4.2MHz, which doesn't support the USB, will I still be able to upload the sketches through the USB or is that functionality disabled as well?
I guess I will find out when I try but will my delays and sleep times have to change accordingly?
Thanks
Riccardo

OpenOCD init failed

Dear GrumpyOldPizza,

I tried to upload a Sketch to my B-L072Z-LRWAN1 board, (chose right board and COM port in Arduino).
However, I get the following error message:

An error occurred while uploading the sketch
Error: init mode failed (unable to connect to the target)
in procedure 'program' 
in procedure 'init' called at file "embedded:startup.tcl", line 495
in procedure 'ocd_bouncer'
** OpenOCD init failed **
shutdown command invoked

Any idea what I could do? Thank you for your help.

UART version of SerialX.onReceive does not wake up from Stop mode

SerialX.onReceive is supposed to generate an interrupt when there is activity on serial interface. However, when the processor is in Stop mode, it does not wake up upon UART activity. In Active mode, the interrupt works correctly. USB version works correctly in both Stop and Active modes.

Here is the test case for Cricket board:

#include <STM32L0.h>

void dummy(){
  STM32L0.wakeup();
}

void setup() {
  pinMode(PIN_LED, OUTPUT);
  digitalWrite(PIN_LED, HIGH);
 
  Serial2.begin(57600); // UART 2
  Serial2.onReceive(dummy); // pin A3 should trigger interrupt, but doesn't in Stop mode
  
  Serial.begin(57600); // USB
  Serial.onReceive(dummy); // USB activity triggers interrupt
}

void loop() {

  digitalWrite(PIN_LED, HIGH);
  delay(500);
  digitalWrite(PIN_LED, LOW);
  delay(200);
  
  STM32L0.stop();        // Enter STOP mode and wait for an interrupt
}

A3 triggers interrupt (ie. led blinks) the first time after reset (processor in Active mode), but not after going into Stop mode.

Linux path issue

I have installed this repository as instructed on Ubuntu and ran into the following error:

/home/musti/.arduino15/packages/TleraCorp/hardware/stm32l0/0.0.5/tools/linux//dfu-suffix: no such file or directory Error compiling for board Cricket-L082CZ.

edit: above error output did not show correctly

The files are confirmed in the right place, however there is a redundant / in the path, which I can not figure out where from.

examples compile error

when i use arduino IDE 1.8.5 compile LoRaWAN example by B-L072Z-LRWAN1, it shows "

exec: "/bin/arm-none-eabi-g++": file does not exist"

i'm not sure what's the problems.

LoRaWAN.confirmed() returns false even though packet shows confirmed through TTN

I double checked that the issue wasn't specific to my code by running this example here. https://github.com/GrumpyOldPizza/ArduinoCore-stm32l0/blob/master/libraries/LoRaWAN/examples/LoRaWAN_Confirmed/LoRaWAN_Confirmed.ino

Here is a screenshot of the confirmation from TTN's console.
screen shot 2018-10-01 at 5 49 41 pm

My end goal here is to write the un-confirmed packets to flash and batch upload them once the sensor comes back within range of a gateway.

delayMicroseconds() timing is not good

Hi,

This time I think I've found a real bug xD

Trying to connect a DS18B20 (so OneWire protocol) I failed. I took my logic analyzer and surprise, timings are not good !

I used a simple code like this :

    digitalWrite(2, LOW);
    delayMicroseconds(10);
    digitalWrite(2, HIGH);
    delay(20);

    digitalWrite(2, LOW);
    delayMicroseconds(50);
    digitalWrite(2, HIGH);
    delay(20);
    
    digitalWrite(2, LOW);
    delayMicroseconds(100);
    digitalWrite(2, HIGH);
    delay(20);

    digitalWrite(2, LOW);
    delayMicroseconds(480);
    digitalWrite(2, HIGH);
    delay(20);

    digitalWrite(2, LOW);
    delayMicroseconds(800);
    digitalWrite(2, HIGH);
    delay(20);

    digitalWrite(2, LOW);
    delayMicroseconds(1000);
    digitalWrite(2, HIGH);
    delay(20);

    digitalWrite(2, LOW);
    delayMicroseconds(1200);
    digitalWrite(2, HIGH);
    delay(20);

And with an excel sheet I calculated a correction that I applied to all timings in OneWire library and magic I got my DS18B20.

So for example if you want a delay of 200µs you have to use delayMicroseconds(200*1.32-5) to get a real 200µs pause.

B-L072Z-LRWAN1 Board not connecting when running on batteries

Dear GrumpyOldPizza,

I'm using your example code, and as long as the board is connected power via USB, the LEDs (LD5, LD7) are lit up and the board correctly connects to TTN. However, if I put three AAA batteries in the battery compartment, only LD7 lights up and the board does not connect to TTN. I am clueless as to why that is. Any ideas? I greatly appreciate your help!

STM32 BOOTLOADER not showing in Zadig

First of all, thank you for your time!
While following the step-by-step guide on a win7 machine, I encountered the following problem:
When showing all devices in Zadig, I cant see a STM32 BOOTLOADER. Instead, the B-L072Z-LRWAN1 board shows up as ST-Link mass storage, ST-Link Debug and ST-Link VCP Ctrl.

unbenannt

I'm unsure how to proceed from here, your help would be greatly appreciated.

[LoRaWAN] hangs up

Hi,

Some times with the LORAWAN_TTN_OTAA example, the system just hangs up randowly :

image

In the screenshot I just some serial debug informations and a blink led but did not changed anything else. With the blink led I know that all the system is hanging because it freezes too. The bug happens all the time but it stops at differents steps (sometimes after "TRANSMIT (" sometimes avec "DR : 0" ...).

Does it happen to anyone else ? Except bug in library, it could be a supply issue I guess but I doubt ... I will check that by passing the actual linear regulator and connecting a high performance supply.

My config :

  • Own board with murata ABZ + BME 280.
  • Europe 868 MHz
  • Real gateway with Rpi3 + ic880a connected to TTN

LoRaWAN Class B and Class C support

Hi there,
great work. Since this is based on the Semtech Lora-Net implementation, is Class B or at least Class C supported? As far as i have seen in the commit comments, i think not - or am i mistaken?
Are there any plans to implenent this in the near future?

Thanks a lot!

hex file generate

hi, i found i cannot generate hex file. and i try to modify platform.txt to add

Create output (.hex file)

'recipe.objcopy.hex.pattern="{compiler.path}{compiler.objcopy.cmd}" {compiler.elf2hex.flags} {compiler.elf2hex.extra_flags} "{build.path}/{build.project_name}.elf" "{build.path}/{build.project_name}.hex"'

Save hex

'recipe.output.tmp_file={build.project_name}.hex
recipe.output.save_file={build.project_name}.{build.variant}.hex'

but compile error! Can you have a look about this?

STM32L0.sleep() and STM32L0.stop() not working on B-L072Z-LRWAN1

I'm using a B-L072Z-LRWAN1 but methods sleep() and stop() of the STM32L0 library seems to be not working. It compiles without error, but the programs just keeps running no matter what value you put into the methods.

My code:

#include <STM32L0.h>
#include <Adafruit_SHT31.h>
#include <Adafruit_TSL2591.h>
#include "LoRaWAN.h"

const char *appEui = "XXXXXXXXXXXXXXXX";
const char *appKey = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
const char *devEui = "XXXXXXXXXXXXXXXX";

#define LPP_DATATYPE_TEMPERATURE 0x67
#define LPP_DATATYPE_HUMIDITY 0x68
#define LPP_DATATYPE_ILLUMINANCE 0x65

Adafruit_SHT31 sht31;
Adafruit_TSL2591 tsl = Adafruit_TSL2591(2591);

void setup( void )
{

    Serial.begin(115200);
    sht31.begin(0x44);
    
    tsl.begin();
    tsl.setGain(TSL2591_GAIN_MED);
    tsl.setTiming(TSL2591_INTEGRATIONTIME_100MS);
    
  
    LoRaWAN.begin(EU868);
    LoRaWAN.addChannel(3, 867100000, 0, 5);
    LoRaWAN.addChannel(4, 867300000, 0, 5);
    LoRaWAN.addChannel(5, 867500000, 0, 5);
    LoRaWAN.addChannel(6, 867700000, 0, 5);
    LoRaWAN.addChannel(7, 867900000, 0, 5);
    LoRaWAN.setDataRate(5);
    LoRaWAN.joinOTAA(appEui, appKey, devEui);
}

void loop( void )
{
    
    uint16_t temp = (uint16_t) (sht31.readTemperature() * 10);
    uint16_t rh = (uint16_t) (sht31.readHumidity() * 2);
    Serial.println("Temp: "+String(temp/10));
    Serial.println("RH:   "+String(rh/2));

    uint32_t lum = tsl.getFullLuminosity();
    uint16_t ir, full;
    ir = lum >> 16;
    full = lum & 0xFFFF;
    uint16_t lux = tsl.calculateLux(full, ir);
    Serial.println("Lux:   "+String(lux));

    if (!LoRaWAN.busy() && LoRaWAN.joined())
    {
        int lpp_channel = 0;
        LoRaWAN.beginPacket();
        LoRaWAN.write(lpp_channel++);
        LoRaWAN.write(LPP_DATATYPE_TEMPERATURE);
        LoRaWAN.write((temp >> 8) & 0xFF);
        LoRaWAN.write(temp & 0xFF);
        LoRaWAN.write(lpp_channel++);
        LoRaWAN.write(LPP_DATATYPE_HUMIDITY);
        LoRaWAN.write(rh & 0xFF);
        LoRaWAN.write(lpp_channel++);
        LoRaWAN.write(LPP_DATATYPE_ILLUMINANCE);
        LoRaWAN.write((lux >> 8) & 0xFF);
        LoRaWAN.write(lux & 0xFF);
        LoRaWAN.endPacket();
    }

    STM32L0.stop(5000);
}

Test it with a simple sketch and it works sleep() either stop() methods:

#include <STM32L0.h>

void setup() {
  // put your setup code here, to run once:
  Serial.begin(115200);

}
void loop() {
  // put your main code here, to run repeatedly:
  Serial.println("Wake!");
  STM32L0.sleep(30000);
}

Cannot do it works with the library LoRaWAN. Maybe due to OTAA join? I don't know if it has a lot of sense. I tried also to comment the sensors libraries and appears to be the LoRaWAN library.

Thank you!

OTAA join data rate sequence

LoRaMac-node injects the datarate for a single JOIN into MlmeReqJoin_t. Hence the LoRaWAN class will only use the currently configured datarate for repeated joins.

Implement a scheme where after the initial sequence throu the join channels, that the next lower data rate is being used. This way a EU868 use can start with SF7 and escalate to SF12.

Perhaps the join should also ALWAYS use the highest txpower, no matter what the user selected. Only post join the user datarate / txpower are set for the stack.

Waiting on Serial Port will hang sketch when not available

Note that this is not a real defect:

The while (!Serial) { } line (also used in many other example sketches) will hang the sketch when a serial port is not available.

This is completely logical but might be confusing (e.g. to those who use ST-Link which doesn't provide a serial port link by default) when other means to detect a running sketch are used (like inspecting the LoRaWAN traffic on a backend server for an immediate end-to-end check). I'm using ST_Link by default and like to start with and end-to-end check when I expect everything to be OK (and work my way backward or forward when things fail). So working my way forward I found my "defect".

We might want to add a timeout waiting for the serial port and continue when it is not available?

Feature request: add setters for uplink and downlink counters

I'd like you to consider adding setters for uplink and downlink counters to help with testing the system at corner conditions when the counters roll over. Without these, it will take a very looong time to reach those conditions.

Also, could you please clarify these comments from another issue?
#27 (comment)
#27 (comment)

Will version 1.0.2 work correctly with 32-bit counter rollover, or should the network rejoin happen just before 16-bit counter expiry, as @SloMusti advises?

When the counter rolls over, does the application code need to do anything special (eg. force re-join)? Is there an error generated from send functions?

bug on pinMode() and digitalWrite()

Hi,

I hope you're fine :) I did not have the time to help you writing documentation or modifications but I hope to have time soon ... Upgrading my module I found a very strange bug.

If you remember I posted an issue months ago about timing issue of delayMicroseconds() which leads to fail using OneWire library. I saw you corrected this point and decided to upgrade my module. But I lost my DS18B20. I took my oscilloscope and I found some strange little spikes :

image

As it should be more like :

image

(it's not the same message and the same speed but there are both onewire communications).

So I tried to target the problem and found this :

This code :

void setup() {
}

void loop() {
 delayMicroseconds(10);
  pinMode(2,OUTPUT); // <=
 digitalWrite(2,LOW); // <=
 delayMicroseconds(10);
 digitalWrite(2,HIGH);
}

Leads to this :

image

This code :

void setup() {
}

void loop() {
 delayMicroseconds(10);
 digitalWrite(2,LOW);  // <=
  pinMode(2,OUTPUT); // <=
 delayMicroseconds(10);
 digitalWrite(2,HIGH);
}

Leads to this :

image

Context :
-Board custom with Murata ABZ.

  • I wrote my own variant but it's largelly like a grasshoper.
  • As it's for onewire, there is a pull up resistor on pin 2. I tested on a pin without pull up resistor => seems ok, so it looks like a high impedance temporary status.

Regards

Is there an example for using EEPROM?

Thank you, Thomas, for creating this project! It looks very useful. I had quite some issues with getting I Cube LoRaWAN running and their API's aren't as friendly. Overall, your code base looks very impressive: clean and professional. Took no time to get everything up and running and start building my application.
Since the documentation is on the lighter side, I'll ask here. I'd like to use EEPROM for storing the lora credentials. The API for EEPROM is not very clear on usage. Is there any example you can post on how to do basic read/writes?

Cant see USB port on a MAC on 1.8.5

I have been unable to get IDE 1.8.5 to see the USB port to allow programing of this device on a Mac... OSX ver 10.13.2

Apple's USB prober see's the device, but its never available in the IDE...

Any ideas???

Full Speed device @ 49 (0x14213000): .............................................   Composite device: "STM32  BOOTLOADER"
    Port Information:   0x0018
           Not Captive
           External Device
           Connected
           Enabled
    Number Of Endpoints (includes EP0):   
        Total Endpoints for Configuration 1 (current):   1
    Device Descriptor   
        Descriptor Version Number:   0x0100
        Device Class:   0   (Composite)
        Device Subclass:   0
        Device Protocol:   0
        Device MaxPacketSize:   64
        Device VendorID/ProductID:   0x0483/0xDF11   (STMicroelectronics)
        Device Version Number:   0x2200
        Number of Configurations:   1
        Manufacturer String:   1 "STMicroelectronics"
        Product String:   2 "STM32  BOOTLOADER"
        Serial Number String:   3 "04B23643006B"
    Configuration Descriptor (current config)   
        Length (and contents):   45
        Number of Interfaces:   1
        Configuration Value:   1
        Attributes:   0xC0 (self-powered)
        MaxPower:   100 ma
        Interface #0 - Application Specific/Device Firmware Update ..............................................   "@Internal Flash  /0x08000000/1536*128g"
        Interface #0 - Application Specific/Device Firmware Update (#1) ..............................................   "@Option Bytes  /0x1FF80000/01*032 e"
        Interface #0 - Application Specific/Device Firmware Update (#2) ..............................................   "@DATA Memory /0x08080000/2*3Ke"


Program via serial port

I have a Grasshopper board and to program it via Arduino I need to hold the boot button while restarting the board.

Can this board be programmed without having to put it in bootload mode manually?

I am also not able to get any of the serial examples to work. Do use Serial or SerialUSB? Tried both with no luck.

I am currently programming it from Win10.

I am able to get the blink sketch to work. Any help will be much appreciated.

DigitalWrite issue on pins >13 number

I have been testing the board variant Grasshopper, however not on original hardware but on custom boards and STM development boards.

Checking the variant file, all seems in order, however digital write does not work on any pin greater then 13, namely analog pins and extra pins. I am quite sure @GrumpyOldPizza implemented this well and thus kinds ask someone else to test this.

Variant pin definition:

Checking free memory

While debugging an application which is mis-behaving, I have discovered the need to determine the free memory available in real-time to see if something is going wrong.

For Arduino there is the library https://github.com/maniacbug/MemoryFree which does not work because:

...\Arduino\libraries\MemoryFree-master/MemoryFree.cpp:18: undefined reference to `__brkval'
...\Arduino\libraries\MemoryFree-master/MemoryFree.cpp:18: undefined reference to `__bss_end'

I believe it would be useful to have this feature in the core itself or have a known method that works to check this.

booting takes 4-5 seconds

If I write a sketch that turns the LED on as the first thing in setup() it takes 4-5 seconds after the upload completes for the LED to turn on. What causes this delay?
(I'm using a generic L082 board.)

[LoRaWAN] Transmission stops after about a day

I have been testing the robustness of the Murata module by using B-L072Z-LRWAN1 with this core, version 0.0.7 and have encountered an issue where about a day later the transmissions to gateway stop. This has been confirmed on all the boards with multiple gateways in two different cities to exclude other factors.

The code running on the device is attached below, simple transmission every 10s. I have yet to capture the serial log until the crash, but it does not appear to be an issue with the main code loop that keep executing.

Any suggestions or ideas towards debugging this are welcome as well as if anyone else can please test this independently.
loradiscoveryttnworking.txt

LoRaWAN.setSubBand(2) - inconsistent behavior

I managed to trace the frequencies used by the board and there are not respecting the subband option.
I used an sdr dongle 820T2 together with sdr#. This is a way of seeing radio signals graphically on your pc using a cheap radio dongle. Easy to spot Lora signals because of their distinctive shape.

I am using the great grasshopper board together with the AU915 frequency plan for TTN which is subband 2. (https://www.thethingsnetwork.org/country/australia/)

grasshopper out of range lora transfer.pdf

Your will see in the attachement the lora signal and the frequency at which it is transmitted. This is during 10-20 minutes. It is supposed to transmit every minute in the sub band 2 of AU915 (916.8 to 918.2). You see the TTN log with time of transmission received which shows missing transmissions.
You also see traced transmission around 924.0 Mhz which is not subband 2 anymore.

The board resets after a day and sometimes keeps within the subband 2 for a day without issues.
But sometimes totally out of range as per attachment.

Here is the relevant parts of the code using LoRaWAN.setSubBand()

`

void setup( void )
{ ...
LoRaWAN.begin(AU915);
LoRaWAN.setSubBand(2);
LoRaWAN.joinOTAA(appEui, appKey, devEui);

...}

void loop( void )
{ ...
    if (!LoRaWAN.busy())
    {
        if (!LoRaWAN.linkGateways())
        {
            LoRaWAN.rejoinOTAA();
        }
        if (LoRaWAN.joined())
        { ...
            LoRaWAN.beginPacket();
            LoRaWAN.write(highByte(distance));
            LoRaWAN.write(lowByte(distance));
            LoRaWAN.endPacket();
            //transmitting lora = 2 blinks
            digitalWrite(myLed, HIGH); delay(30); digitalWrite(myLed, LOW);delay(100);
        }
        //reset the board after 1 day 60000 * 60 * 24 * 1
        if (millis() > 60000 * 60 * 24 * 1) {
          STM32L0.reset();
        }
}

`

Compile error: "exec: "/bin/arm-none-eabi-g++": file does not exist

Installed the software on a different laptop than before and ran into this error:

Compile error: "exec: "/bin/arm-none-eabi-g++": file does not exist

A quick google search later I found this.

So apparently your software requires installing the Arduino Zero board in the IDE. Maybe it's worth mentioning this in the installation instructions - or add the neccesary files to your repo.

Thanks,

David

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.