stm32duino / I-NUCLEO-LRWAN1

Arduino library to support I-NUCLEO-LRWAN1 LoRa® expansion board based on USI® LoRaWAN™ technology module.
15 stars 14 forks source link

Using Nucleo 64 with I-NUCLEO-LRWAN1 #5

Closed Night19 closed 6 years ago

Night19 commented 6 years ago

Lora module not ready ERROR: at least one UART pin has no peripheral What does mean? Please help :/

fpistm commented 6 years ago

Hi, you should give more info. Core version, targeted board, sketch you try to use.

Anyway, this means the HardwareSerial you configure is not correct. At least one of the pin used for the Serial has no U(S)ART capabilities or it is commented in the PeripheralPins.c of the targeted board. https://github.com/stm32duino/Arduino_Core_STM32/blob/38605636366c442b5da96a5b1c9ead71356ccbf0/cores/arduino/stm32/uart.c#L104

Night19 commented 6 years ago

img_20180621_215923 img_20180621_215911 Core v. 1.3.0 STM32LO53 Nucleo-64 I-NUCLEO-LRWAN1 getDevEui sketch

fpistm commented 6 years ago

Ok, so on Nucleo L053, there is no UART on PA0/PA1.

As wrote in the sketch example, this is for Discovery L475 IoT board:

// Serial port use to communicate with the USI shield. Specific to the board Discovery L475 IoT.
HardwareSerial SerialLora(PA_1, PA_0);

Shield used D0/D1 as Serial interface. On this Nucleo, D0/D1 are:

PA3,  //D0 Rx
PA2, //D1 Tx

Anyway there is restriction with Nucleo64as mentioned in the Readme.md: See UM1724, §6.8 section to solve the issue.

Shield uses a LPUART interface as the AT command console, the D0 and D1 pins are the LPUART TX and LPUART RX, and the default configuration is 115200,N,8,1

For Nucleo64, by default, D0/D1 of CN9 board connector are respectively not connected to PA3 and PA2 (SB62 and SB63 opened). Those pins are connected to STLink USART thanks SB13, SB14. To use the shield:

Then in the sketch use: HardwareSerial SerialLora(PC_11, PC_10);

I'm currently working on this library. I will enhance sketches and nucleo64 usage. And also add support of new firmware, see #3

Night19 commented 6 years ago

It's working. Thanks! <3

borombo96 commented 6 years ago

I follow this, but I have this message: LoRa module not ready. Someone can help me?

fpistm commented 6 years ago

Hi @borombo96 I think you have a USI shield with a firmware >2.8 This will be possible with #6

borombo96 commented 6 years ago

I'm trying with a board with firmware 2.6, the error is the same :(

fpistm commented 6 years ago

@borombo96 which board are you using? And how the shield is wired?

borombo96 commented 6 years ago

I-NUCLEO-LRWAN1 and STM32L053R8

fpistm commented 6 years ago

Sounds strange as @Night19 and me succeed with setup providing above. Have you made some hardware change on the Nucleo L053R8 or the shield?

fpistm commented 6 years ago

You could try BridgeSerial.ino example to ensure board and shield communication are ok:

https://github.com/stm32duino/I-NUCLEO-LRWAN1/pull/6/commits/03021df2accee52022720f5f43f988403afbe8d9#diff-d3cf38fc3aa27d43ea8adfe5280cb78e

This example will be available thanks #6 Think to update HardwareSerial SerialLora(PC_11, PC_10); and connect

borombo96 commented 6 years ago

I try the bridgeSerial ...

/*
+  Allows to relay UART data from/to a PC terminal to/from LORA shield.
+
+  Shield uses a LPUART interface as the AT command console, the D0 and D1 pin
+  is the LPUART TX and LPUART RX, and the default configuration is 115200,N,8,1
+
+  Important note for Nucleo64:
+  by default, D0/D1 of CN9 board connector are respectively not connected to
+  PA3 and PA2 (SB62 and SB63 opened).
+  Those pins are connected to STLink USART thanks to SB13, SB14.
+
+  To use the shield:
    - Connect shield D0(Tx) to PC11(Rx)
    - Connect shield D1(Rx) to PC10(Tx)
  or
    - Close SB62 and SB63 to connect D0/D1 of CN9 connector to PA3 and PA2
    - Open SB13 and SB14 to disconnect PA3 and PA2 from STLink UART
  but in this case, you will have to wire STLink Rx/Tx of CN3 connector to
  another pins and update Serial instance before call `Serial.begin(115200);`
  using:
  Serial.setRx(Rx pin);
  Serial.setTx(Tx pin);
*/
HardwareSerial SerialLora(PC_11, PC_10);

void setup()
{
  Serial.begin(115200);
  SerialLora.begin(115200);
}

// The loop function runs over and over again forever
void loop()
{
  char c;

  if (SerialLora.available() > 0)
  {
    c = SerialLora.read();
    Serial.print(c);
  }
  if (Serial.available() > 0)
  {
    c = Serial.read();
    SerialLora.print(c);
  }
}

modifyng the HardwareSeriale witch PC_11 and PC_10 but it doesn't show me anything on the serial monitor. Maybe I've to close some jumper? Ty for help

fpistm commented 6 years ago

I you made properly the wiring btw D0/D1 shield and PC10/11 you should have something on the console. Of course at 115200 ;) So if you have nothing I think the shield has an issue. Bad firmware? I advice you to reflash the firmware. See the procedure on: https://github.com/USIWP1Module/USI_I-NUCLEO-LRWAN1

The wm-sg-sm-42_firmware_v2.6.hex is available.

fpistm commented 6 years ago

Just to be avoid any issue with Nucleo L053. The AnalogReadSerial example is functional ? Serial is working well?

borombo96 commented 6 years ago

I don't know what is the AnalogReadSeria, but the serial of NucleoL053 is working, I try an easy example with Serial.Begin and Serial.Println and it works...

fpistm commented 6 years ago

ok. Fine. So issue comes from the shield. It seems the Serial interface of the shield does not work properly that's why you have "LoRa module not ready" Confirmed by the bridge Serial test. It's a very basic use case. So, try to update the firmware of the shield.

FYI, AnalogReadSerial is an Arduino sketch example available in "Examples->01.Basics->AnalogReadSerial" menu

fpistm commented 6 years ago

FYI, I've release 1.0.1 library version including updated sketch examples and new firmware support

adrienDLCT commented 6 years ago

Hi, I work with Borombo, in fact we have some problems for the Uart communication between LoRa module and stm32 and also between stm32 and the PC. We just found a solution; (with the getDevEUI example, and some other) So we are working with this following configuration in the software:

HardwareSerial SerialLora(PA_10, PA_9);

Thereby, we must connect TX of the LoRa module with the PA_10 pin, and the RX with the PA_9 pin. When we build the program we can see that it's working because we receive the data on the RX of the ST-Link part of the stm32. ( I am able to read this pin thanks to a USB to Uart bridge.)

What do we have to do to receive the same information but on the PC Uart ?

Here is our hardware configuration: 36887382_10209433790960065_3580111337230958592_n

fpistm commented 6 years ago

Which core version you used? 1.3.0 ?

fpistm commented 6 years ago

D8 of the shield is connected to "RCC_MCO". I do not advise to use a pin already used by the shield. See https://github.com/USIWP1Module/USI_I-NUCLEO-LRWAN1/blob/master/Schematics/USI%20LoRa%20Arduino%20shield_SCH_20161115-1.pdf

I think, you do not use the latest version of the core 1.3.0 which add LPUART1 support. PC10/PC11 use LPUART1 peripheral so it require 1.3.0 core version. Here is the setup: nucleo64_lrwan

Note that you could simply connect the shield to your USB to UART bridge and use a terminal on the PC to send/receive AT command. Nucleo will only provide power (flash a blank sketch in the nucleo)

adrienDLCT commented 6 years ago

What do you mean by the core version ? The version of LoRa firmware? Or the version of the stm32 processor? This following picture show the different version of ours LoRa module. at ver

An other question i work with arduino ide, and i am wondering how to get the data sensors, have you got an idea?

fpistm commented 6 years ago

I talk about the https://github.com/stm32duino/Arduino_Core_STM32 version you have installed to add the Nucleo L053R8 support. You probably add it thanks the board manager. You should have the 1.3.0 version: https://github.com/stm32duino/Arduino_Core_STM32/releases/tag/1.3.0

borombo96 commented 6 years ago

With this new core_version 1.3 the DevEui and the PingPong are working, ty very much.

fpistm commented 6 years ago

Since https://github.com/stm32duino/I-NUCLEO-LRWAN1/releases/tag/1.0.1 This topic should be properly handled.