Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

STM32L(RAK811 chip) RAK811 Wis DUO #1395

Closed
bioshock2k opened this issue May 17, 2021 · 11 comments
Closed

STM32L(RAK811 chip) RAK811 Wis DUO #1395

bioshock2k opened this issue May 17, 2021 · 11 comments
Labels
enhancement New feature or request new variant Add support of new bard

Comments

@bioshock2k
Copy link

Hi,

I´ve been trying to use the RAK 811 chip ADC that runs a STM32L. When using the Arduino IDE using analogRead() i get a value of 0 in the read.

AM i missing something?

@fpistm
Copy link
Member

fpistm commented May 17, 2021

Hi @bioshock2k
could you be more precise?
Arduino IDE version? Core version?
Board selected? (there are 2 RAK 811)? Menu options?
Which pin you used with analogRead()?
...
All relevant information else we could not help.

@fpistm fpistm added the waiting feedback Further information is required label May 17, 2021
@bioshock2k
Copy link
Author

bioshock2k commented May 17, 2021

Yes i can.
Arduino IDE 1.8.49
Board selected: LoRa boards
Board Part Number: RAK811 Lora tracker(16kb RAM)
All these settings i had sucess programming and messing with the RAK811, but never with the adc.

This is the code i am using to test the ADC:

#include <arduino_lmic.h>
#include <arduino_lmic_hal_boards.h>
#include <arduino_lmic_hal_configuration.h>
#include <arduino_lmic_lorawan_compliance.h>
#include <arduino_lmic_user_configuration.h>
#include <lmic.h>

#include "STM32LowPower.h"
#include <lmic.h>
#include <hal/hal.h>
#include <SPI.h>

#include <Arduino.h>
#include <NewPing.h>
#include <MedianFilter.h>
#include <Wire.h>

int ADC_pin=PA3;
int ADC_pin2=PB14;
// Pin mapping
const lmic_pinmap lmic_pins = {
    .nss = 26,
    .rxtx = 32,
    .rst = 21,
    .dio = {27, 28, 29},
};


void setup() {
  // put your setup code here, to run once:
    Serial.begin(115200);
    while ( !Serial ) delay(10);
    Serial.println("\r\n*******************************");
    Serial.println("System Starting...");
    Serial.println("");
    pinMode(ADC_pin, INPUT);
    pinMode(ADC_pin2,OUTPUT);
    //os_init();
}

void loop() {
  // put your main code here, to run repeatedly:
  float battery=analogRead(ADC_pin);
 // int battery2=digitalWrite(ADC_pin2,HIGH);
  Serial.print("Batery: ");
  Serial.println(battery);
  //Serial.println(battery2);
  delay(500);
}

@fpistm
Copy link
Member

fpistm commented May 17, 2021

Thanks
Pins used are not defined by the variant as ADC pins:

int ADC_pin=PA3;
int ADC_pin2=PB14;

Only those ones have been defined:

#define PA1 PIN_A0
#define PA2 PIN_A1 // ADC_VBAT
#define PB12 PIN_A2

Do not ask me why. This is a contribution and I never had this board. 😉 So I don't know why contributor does not defined them. Anyway that's why you get always 0 as it is not considered as a valid analog pin.

@bioshock2k
Copy link
Author

Thank you very much!
That will do perfectly.
Could i add those ADC pins as a contributor?

@fpistm
Copy link
Member

fpistm commented May 17, 2021

Could i add those ADC pins as a contributor?

Of course. Any contributions are welcome.

@fpistm fpistm added Request and removed waiting feedback Further information is required labels May 17, 2021
@fpistm fpistm changed the title STM32L(RAK811 chip) ADC value=0 in arduino IDE STM32L(RAK811 chip) Extend analog pins May 17, 2021
@fpistm
Copy link
Member

fpistm commented May 24, 2021

Hi @bioshock2k
Please, have you the list of ADC pin to add ?

@bioshock2k
Copy link
Author

The list of available ADC pins on the RAK811?

@fpistm
Copy link
Member

fpistm commented May 24, 2021

The list of available ADC pins on the RAK811?

yes 😉 The one which should be exposed.

@bioshock2k
Copy link
Author

bioshock2k commented May 24, 2021

Pin Number | Name | Type | Description
2 | PB12/ADC | I/O | GPIO and ADC
3 | PB14/ADC | I/O | GPIO and ADC
4 | PB15/ADC | I/O | GPIO and ADC
20 | PA2/ADC | I/O | GPIO and ADC
22 | PA1/ADC | I/O | GPIO and ADC
23 | PA0/ADC | I/O | GPIO and ADC

Here it goes

@fpistm
Copy link
Member

fpistm commented May 24, 2021

OK, I guess this is the one defined here and so you used the RAK811 Wis DUO
https://docs.rakwireless.com/Product-Categories/WisDuo/RAK811-Module/Datasheet/#low-rf-version-pin-definition

image

but in the core this is the RAK811 LoRa Tracker (which seems no more sold)
image

So there is no issue in the variant. The RAK811 LoRa Tracker has only 3 pins available for ADC (PA0 is connected to measure VBAT)

as the pin mapping is not the same a new variant should be created.

@fpistm fpistm added the new variant Add support of new bard label May 24, 2021
@fpistm fpistm changed the title STM32L(RAK811 chip) Extend analog pins STM32L(RAK811 chip) [RAK811 Wis DUO](https://store.rakwireless.com/products/rak811-lpwan-module) May 25, 2021
@fpistm fpistm changed the title STM32L(RAK811 chip) [RAK811 Wis DUO](https://store.rakwireless.com/products/rak811-lpwan-module) STM32L(RAK811 chip) RAK811 Wis DUO May 25, 2021
@fpistm
Copy link
Member

fpistm commented May 25, 2021

Added to the [New Variant] request list #722

@fpistm fpistm closed this as completed May 25, 2021
@fpistm fpistm added enhancement New feature or request and removed Request labels Jul 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request new variant Add support of new bard
Projects
None yet
Development

No branches or pull requests

2 participants