Skip to content

STM32L(RAK811 chip) RAK811 Wis DUO #1395

Closed

Description

@bioshock2k

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?

Activity

  1. fpistm commented on May 17, 2021

    @fpistm
    Member

    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.

  2. added
    waiting feedback
    on May 17, 2021
  3. bioshock2k commented on May 17, 2021

    @bioshock2k
    Author

    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);
    }
  4. fpistm commented on May 17, 2021

    @fpistm
    Member

    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.

  5. bioshock2k commented on May 17, 2021

    @bioshock2k
    Author

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

  6. fpistm commented on May 17, 2021

    @fpistm
    Member

    Could i add those ADC pins as a contributor?

    Of course. Any contributions are welcome.

  7. added and removed
    waiting feedback
    on May 17, 2021
  8. changed the title [-]STM32L(RAK811 chip) ADC value=0 in arduino IDE[/-] [+]STM32L(RAK811 chip) Extend analog pins[/+] on May 17, 2021
  9. fpistm commented on May 24, 2021

    @fpistm
    Member

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

  10. bioshock2k commented on May 24, 2021

    @bioshock2k
    Author

    The list of available ADC pins on the RAK811?

  11. fpistm commented on May 24, 2021

    @fpistm
    Member

    The list of available ADC pins on the RAK811?

    yes 😉 The one which should be exposed.

  12. bioshock2k commented on May 24, 2021

    @bioshock2k
    Author

    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

  13. fpistm commented on May 24, 2021

    @fpistm
    Member

    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.

  14. added
    new variant
    on May 24, 2021
  15. changed the title [-]STM32L(RAK811 chip) Extend analog pins[/-] [+]STM32L(RAK811 chip) [RAK811 Wis DUO](https://store.rakwireless.com/products/rak811-lpwan-module)[/+] on May 25, 2021
  16. changed the title [-]STM32L(RAK811 chip) [RAK811 Wis DUO](https://store.rakwireless.com/products/rak811-lpwan-module)[/-] [+]STM32L(RAK811 chip) RAK811 Wis DUO[/+] on May 25, 2021
  17. fpistm commented on May 25, 2021

    @fpistm
    Member

    Added to the [New Variant] request list #722

  18. added
    enhancement
    and removed on Jul 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementnew variant

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions