Home › Forums › The libraries hosted on the site › EByte LoRa e32 UART devices sx1262/sx1268 › Problems using atmega328p without bootloader & hardware serial
Tagged: bootloader, e32, hardware UART
- This topic has 6 replies, 2 voices, and was last updated 4 years, 1 month ago by
Renzo Mischianti.
-
AuthorPosts
-
-
26 March 2021 at 12:19 #11153
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() {
}
-
26 March 2021 at 12:22 #11154
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…
-
26 March 2021 at 12:24 #11155
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 🙁
-
26 March 2021 at 14:09 #11156
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 -
28 March 2021 at 10:50 #11176
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!
-
28 March 2021 at 10:58 #11177
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.
-
28 March 2021 at 19:17 #11182
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
-
-
-
AuthorPosts
- You must be logged in to reply to this topic.