Problems using atmega328p without bootloader & hardware serial

Home Forums The libraries hosted on the site EByte LoRa e32 UART devices sx1262/sx1268 Problems using atmega328p without bootloader & hardware serial

Viewing 5 reply threads
  • Author
    Posts
    • #11153
      Josh lepeter
      Participant

        hello!

        I am trying to make a project using atmega328p progframmed directly via USBASP from arduino environment and using an E32-433t20d module as the radio. i am trying to use the hardware serial without any luck and also I have this weird thing going on that the AUX input pin that i declare shows 5V instead of 0, wich leads me to think that it is not declared as an input in the library maybe? or most likely, i am not passing the right arguments to the initializer function…

        can someone point me in the right direction please? thank you so much!!

        /*
        * LoRa E32-TTL-100
        * Set configuration.
        * http://mischianti.org/lora-e32-device-for-arduino-esp32-or-esp8266-configuration-part-3/
        *
        * E32-TTL-100—– Arduino UNO
        * M0 —– 3.3v
        * M1 —– 3.3v
        * TX —– PIN 2 (PullUP)
        * RX —– PIN 3 (PullUP & Voltage divider)
        * AUX —– Not connected
        * VCC —– 3.3v/5v
        * GND —– GND
        *
        */
        #include “Arduino.h”
        #include “LoRa_E32.h”

        LoRa_E32 e32ttl100(Serial, 2, 8, 9, 9600); // e32 TX e32 RX // Hardware serial, AUX pin, M0, M1, Baudrate
        void printParameters(struct Configuration configuration);
        void printModuleInformation(struct ModuleInformation moduleInformation);

        void setup() {
        //Serial.begin(9600);
        delay(500);

        // Startup all pins and UART
        e32ttl100.begin();

        ResponseStructContainer c;
        c = e32ttl100.getConfiguration();
        // It’s important get configuration pointer before all other operation
        Configuration configuration = *(Configuration*) c.data;
        c.status.getResponseDescription();

        //printParameters(configuration);
        configuration.ADDL = 0x0;
        configuration.ADDH = 0x1;
        configuration.CHAN = 0x19;

        configuration.OPTION.fec = FEC_0_OFF;
        configuration.OPTION.fixedTransmission = FT_TRANSPARENT_TRANSMISSION;
        configuration.OPTION.ioDriveMode = IO_D_MODE_PUSH_PULLS_PULL_UPS;
        configuration.OPTION.transmissionPower = POWER_17;
        configuration.OPTION.wirelessWakeupTime = WAKE_UP_1250;

        configuration.SPED.airDataRate = AIR_DATA_RATE_011_48;
        configuration.SPED.uartBaudRate = UART_BPS_115200;
        configuration.SPED.uartParity = MODE_00_8N1;

        // Set configuration changed and set to not hold the configuration
        ResponseStatus rs = e32ttl100.setConfiguration(configuration, WRITE_CFG_PWR_DWN_LOSE);
        rs.getResponseDescription();
        //printParameters(configuration);
        c.close();
        }

        void loop() {

        }

         

      • #11154
        Josh lepeter
        Participant

          using that code I can’t get the module to change it’s parameters… when I check them in my computer using the ebyte RFsettings tool it shows that the module still has the same settings than before trying the code…

        • #11155
          Josh lepeter
          Participant

            oh sorry, I just realised I uploaded an old code, the most recent one had the WRITE_CFG_PWR_DWN_SAVE flag passed to the setConfiguration function and still no luck 🙁

          • #11156
            Renzo Mischianti
            Keymaster

              Hi Josh,
              please give us a connection schema, so we can help you.
              And try to uncomment the line in the library

              
              #define LoRa_E32_DEBUG
              

              and retry.
              Bye Renzo

            • #11176
              Josh lepeter
              Participant

                Hello! thank you for your reply!

                I am afraid that I cannot use the DEBUG because the atmega328p only has one hardware uart, and that is being used by the E32 module 🙁

                atmega is runnig at 16Mhz @ 5V, so a level shifter is used on some lines.

                The connection schema is this (sorry i don’t have schematic yet):

                ATMEGA               E32

                PD0(RX)               P4(TXD) straight connection (not pulled up by mcu… so, safe)

                PD1(TX)               P3(RXD) through a level converter.

                PB0(8)                  P1(M0)  through level conv.

                PB1(9)                  P2(M1) through level conv.

                PD2(2)                  P5(AUX) straight connection (only used as input… so, safe)

                 

                Thanks!

              • #11177
                Josh lepeter
                Participant

                  as sidenote, when connecting the modules to my computer using the usb adapter sold for that purpose, the RF settings utility from ebyte can read and change the parameters without any problem and they will be kept in memory. also, if I don’t use any library and set up a transparent link between two modules (one on my pc using the adapter and putty and other on the MCU using the provided schema), manually pull M0 and M1 to normal working mode in code and send data between PC and MCU the link works both ways, so tecnically the connections are ok. I don’t use AUX in that test, but i have checked with the multimeter at the MCU side and the signal is changing when sending/receiving, so i guess mcu should read it fine also.

                  • #11182
                    Renzo Mischianti
                    Keymaster

                      Hi Josh,
                      check the logic level of M0 and M1 if raise correctly, with 5v power sometime It’s hard to change.
                      Check if are high.
                      If you have a FDTI use software serial to debug or to control the e32, debug information It’s important to discover the problem.

                      Bye Renzo

                Viewing 5 reply threads
                • You must be logged in to reply to this topic.
                Exit mobile version