TTGO T-Deer


(Afremont) #42

Can you tell me which lmic repository you are planning to use?


(Schallb) #43

Just did my first check with
lib_deps_lora = MCCI LoRaWAN LMIC library@^2.3.1

It seems everything is running fine - THX to

everything seems to work out of the box!


(Afremont) #44

Thanks. Yes, gotta have DIO1 connected to something or you only transmit once.


(Schallb) #45

I see now that the device wants to join via OTAA (in my gateway traffic view) but my device doesn’t really do it and retries again and again.
I think this is now the point to dig deeper in the LMIC stuff…


(Jezd) #46

It’s likely to be the DIO1 wiring, or config in your code - device is sending request, gateway is replying with confirmation but its not being picked up


(Flowsailer) #47

I made the mistake to set Arduino Pro or Pro Mini in the Arduino IDE. Here you have to choose Arduino Mini. And then the upload works. Thanks.


(Schallb) #48

UPDATE: If you enter the right DEVEUI and APPKEY the whole thing works like magic :man_facepalming:


(Schallb) #49

Did somebody get the serial flash working?


(Flowsailer) #50

It works for me. I have to choose Arduino Mini in the Arduino IDE.


(Schallb) #51

I’m talking about the W25Q32FVSS that is soldered on the board…
I tried the SerialFlash library but it seems I’m getting no connection to the flash…

#define FLASH_CS (8)

if (!SerialFlash.begin(FLASH_CS))
{
Serial.println(F(“Unable to access SPI Flash chip”));
}
else
{
FlashTest();
SerialFlash.sleep();
}


(Jezd) #52

I managed to get “Start flash…Init Flash OK!”
Used SPIFlash library, must change device ID from 0xEF30 to 0xEF40

#include <SPIFlash.h>;
SPIFlash flash(8 , 0xEF40);

Serial.print("Start flash..."); 
if (flash.initialize())
   Serial.println("Init Flash OK!");
else
   Serial.println("Init Flash FAIL!");
Serial.print("DeviceID: ");
Serial.println(flash.readDeviceId(), HEX);
Serial.println();

Serial.println("Flash content:");
int counter = 0;
while(counter<=256){
    Serial.print(flash.readByte(counter++), HEX);
    Serial.print('.');
}    
Serial.println();

But I’ve not had chance to play or go beyond that, first step.

Start flash…Init Flash OK!
DeviceID: EF40

Flash content:
FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.FF.

Seems ok


(Schallb) #53

Was not my best weekend it seems - a lot of stupid careless mistakes…
I used the SerialFlash library and sent the device to sleep. After re-booting you have to call wakeup, even if SerialFlash.begin(FLASH_CS) fails.

The positove message: removing the LED, sending flash, LORA and CPU to deepsleep I achieved a power consumption of ~0.07mA measured on the LiPo battery…


(Jezd) #54

Just noticed my meter will do current down to uA so gave it a try.

Powering the device (with led) on LiPo via the LDO, running standard code with sleep etc I am getting 0.84mA in sleep period

UPDATE

As per schallb I took the red led off (I got brave) and we are down to a very usable 78uA is sleep - no red led


(Nograin) #55

tl/dr;
it’s IO1 (as labelled on the board) which should be connected to D5 for the above mentioned pin mapping, right?

long version:
oh well… expected this to be easier… :roll_eyes:

hooked one up to an 3.3V FTDI, seeing the demo sketch’s data coming in fine, looking good…

so let’s flash the OTTA demo, you guys suggested the MCCI lib (platformio #5774)

AVRdude can’t seem to connect - oh well, like in the old days, push the reset button on the board at the right moment - or connect DTR (aka RTS) from the FTDI-cable… ok. flash succeeded.

but it’s only rubbish coming back in the serial monitor, though it’s definitly set to 9600 baud like set up in the sketch. maybe 115200? no. 19200? yes! … why? no idea. platformio.ini as well as the sketch itself has it defined as 9600…

checking the gateway… nothing coming in. doh! the lib is set to 915mhz (need to edit /project_config/lmic_project_config.h for 868 or others)

clean/upload - hurray - JOIN ACCEPTs in the gateway’s console… but board obviously not recognizing it… yes - IO1 connected to D5 using and @jezd’s pin mapping
so why? :roll_eyes:


(Nograin) #56

well, the devil’s in the detail.

i did have
board = pro8MHzatmega328
defined, this doesn’t work.

using
board = pro16MHzatmega328
does.

:woman_shrugging:


(Nograin) #57

that’s running it as pro16MHzatmega328 and using rocketscream’s low-power for sleep as in your platformio.ini above?


(Schallb) #58

My first set of five devices is up and running.
Next steps will be to imlement downlink functionality and better support for wakeup from deep-sleep via external interrupt.
One thing i found out: the W25Q32 SPI flash offers a unique 64bit wide ID! It can perfectly be used as DEVEUI


(Jezd) #59

Any code you feel like sharing - I’m having issues with the 16mhz aspect and running at 8mhz, have you done a new bootloader?


(Schallb) #60

No new bootloader -> I boot with 16MHz and switch asap to 8Mhz (clock divider)

platformio.ini:
[env:ttgotdeer]
platform = atmelavr
framework = arduino
board = pro16MHzatmega328
upload_speed = 115200
monitor_speed = 9600
board_build.mcu = atmega328p
board_build.f_cpu = 8000000L

in my code:
void setup()
{
//set to 8MHz
setClockPrescaler(CLOCK_PRESCALER_2);
}

using prescaler.h from https://github.com/fschaefer/Prescaler