smartboxchannel / eON-INDOOR_CLIMATE_SENSOR_290-EFEKTALAB

New arduino project. Wireless weather mini station with electronic ink display 2.9 inches (GDEH029A1 OR GDEM029T94), very low power consumption,compact size, housing with magnets. The device can use si7020 / 21, sht20 / 21, HTU20/21D or BME280 sensors. Use the MINEW MS50SFA RF module with nRF52832 chips, or the EBYTE E73 module with nRF52840 and nRF52833 chips.
GNU General Public License v3.0
54 stars 13 forks source link

Device Frozen After Flashing 0.46 Code #1

Open maxim-sm opened 3 years ago

maxim-sm commented 3 years ago

I have the EINK290 (Tindie order: #246050). It is a great device and thank you for that! Unfortunately I have an issue flashing the code in this repository on the device.

Problem Description: After flashing the device with the code it stops working. The screen is stuck on the last thing that was drawn on it and the LED doesn't show any sign of life.

Steps to reproduce:

  1. Install Arduino IDE
  2. Configure it as described in the README
  3. Flash with an ST-Link V2 device (probably a clone)

Device Details:

Additional Information: I'm a newbie and never worked with MySensors and have very little experience with programming hardware. I used the Serial.println and the blinkLed function from your code to determine that the code enters the before() and _happyinit() functions until getting stuck in the first if condition. if (hwReadConfig(EEPROM_NODE_ID_ADDRESS) == 0) {

I've followed the MySensors code and I think that the code gets stuck at uint32_t *vpage = VirtualPage.get(NVRAM_MAGIC);

in NVRAM.cpp (line 275 in Arduino/libraries/MySensors/drivers/NVM/NVRAM).

I tested some code snippets that I could find from MySensors and it seems that every code that involves reading or writing to the NVRAM (such as hwReadConfig, hwWriteConfig, getState, etc.) gets the device stuck.

To summarize the flow of the code until getting stuck is: hwReadConfig(line 4487 in EINK290_1) -> NVRAM.read(line 57 in MyHwNRF5.cpp) -> VirtualPage.get(NVRAM_MAGIC) (line 275 in NVRAM.cpp).

I didn't follow the code further for it is definitely out of the scope of my knowledge.

Additional Things that I Tried: -Older versions of MySensors (until 2.2) -Variation of arduino-nRF5 library that can be found on your Github -Testing on Windows and Linux -Different "Low Frequency Clock" options -Different MyConfig.h variations (commenting and uncommenting different options)

Details About my Environment: -Arduino IDE Version: 1.8.13 -MySensors Library Version: 2.3.2 -ST-Link V2 Device Used: https://www.amazon.com/DAOKI-ST-Link-Programming-Emulator-Downloader/dp/B01EE4WAC8 -IDE Output:

Sketch uses 85528 bytes (8%) of program storage space. Maximum is 1048576 bytes. Open On-Chip Debugger 0.10.0-dev-00254-g696fc0a (2016-04-09-12:07) Licensed under GNU GPL v2 For bug reports, read http://openocd.org/doc/doxygen/bugs.html debug_level: 0 0x4000 adapter speed: 10000 kHz nrf52.cpu: target state: halted target halted due to debug-request, current mode: Thread xPSR: 0x01000000 pc: 0x00008834 msp: 0x20040000 Programming Started auto erase enabled nrf52.cpu: target state: halted target halted due to breakpoint, current mode: Thread xPSR: 0x61000000 pc: 0x2000001e msp: 0x20040000 wrote 86016 bytes from file /tmp/arduino_build_844176/EINK290_1.ino.hex in 2.497448s (33.634 KiB/s) Programming Finished Verify Started nrf52.cpu: target state: halted target halted due to breakpoint, current mode: Thread xPSR: 0x61000000 pc: 0x2000002e msp: 0x20040000 verified 85816 bytes in 0.229241s (365.575 KiB/s) Verified OK Resetting Target shutdown command invoked

-IDE Configuration: Screenshot at 2021-05-20 14-03-10_1

-MyConfig.h Content (Without commented text):

//#define EINK_V1

define DCPOWER

//#define LIGHTSENS //#define BIZZER

define LANG_EN

define MY_DEBUG

//#define MY_PASSIVE_NODE //#define MY_NODE_ID 101

define MY_RADIO_NRF5_ESB

define MY_NRF5_ESB_MODE (NRF5_1MBPS)

//#define MY_NRF5_ESB_MODE (NRF5_250KBPS)

define MY_RESET_REASON_TEXT

define SN "EFEKTA WeatherStation 290"

define SV "0.46"

define ESPECIALLY

Any help will be greatly appreciated! Thanks :)

smartboxchannel commented 3 years ago

Hello, I just read the letter briefly. Tomorrow I will try to reproduce this problem. In any case, we'll figure it out. Will you tell me you are trying to start a flashed device in the mysensors network or without a network? is there a mysensors gateway?

чт, 20 мая 2021 г., 14:18 maxim-sm @.***>:

I have the EINK290 (Tindie order: #246050). It is a great device and thank you for that! Unfortunately I have an issue flashing the code in this repository on the device.

Problem Description: After flashing the device with the code it stops working. The screen is stuck on the last thing that was drawn on it and the LED doesn't show any sign of life.

Steps to reproduce:

  1. Install Arduino IDE
  2. Configure it as described in the README
  3. Flash with an ST-Link V2 device (probably a clone)

Device Details:

  • Device Variant: NRF52840
  • Buzzer: No
  • AAA Batteries: No
  • Light Sensor: No

Additional Information: I'm a newbie and never worked with MySensors and have very little experience with programming hardware. I used the Serial.println and the blinkLed function from your code to determine that the code enters the before() and happy_init() functions until getting stuck in the first if condition. if (hwReadConfig(EEPROM_NODE_ID_ADDRESS) == 0) {

I've followed the MySensors code and I think that the code gets stuck at uint32_t *vpage = VirtualPage.get(NVRAM_MAGIC);

in NVRAM.cpp (line 275 in Arduino/libraries/MySensors/drivers/NVM/NVRAM).

I tested some code snippets that I could find from MySensors and it seems that every code that involves reading or writing to the NVRAM (such as hwReadConfig, hwWriteConfig, getState, etc.) gets the device stuck.

To summarize the flow of the code until getting stuck is: hwReadConfig(line 4487 in EINK290_1) -> NVRAM.read(line 57 in MyHwNRF5.cpp) -> VirtualPage.get(NVRAM_MAGIC) (line 275 in NVRAM.cpp).

I didn't follow the code further for it is definitely out of the scope of my knowledge.

Additional Things that I Tried: -Older versions of MySensors (until 2.2) -Variation of arduino-nRF5 library that can be found on your Github. -Testing on Windows and Linux

Details About my Environment: -Arduino IDE Version: 1.8.13 -MySensors Library Version: 2.3.2 -ST-Link V2 Device Used: https://www.amazon.com/DAOKI-ST-Link-Programming-Emulator-Downloader/dp/B01EE4WAC8 -IDE Output:

Sketch uses 85528 bytes (8%) of program storage space. Maximum is 1048576 bytes. Open On-Chip Debugger 0.10.0-dev-00254-g696fc0a (2016-04-09-12:07) Licensed under GNU GPL v2 For bug reports, read http://openocd.org/doc/doxygen/bugs.html debug_level: 0 0x4000 adapter speed: 10000 kHz nrf52.cpu: target state: halted target halted due to debug-request, current mode: Thread xPSR: 0x01000000 pc: 0x00008834 msp: 0x20040000 Programming Started auto erase enabled nrf52.cpu: target state: halted target halted due to breakpoint, current mode: Thread xPSR: 0x61000000 pc: 0x2000001e msp: 0x20040000 wrote 86016 bytes from file /tmp/arduino_build_844176/EINK290_1.ino.hex in 2.497448s (33.634 KiB/s) Programming Finished Verify Started nrf52.cpu: target state: halted target halted due to breakpoint, current mode: Thread xPSR: 0x61000000 pc: 0x2000002e msp: 0x20040000 verified 85816 bytes in 0.229241s (365.575 KiB/s) Verified OK Resetting Target shutdown command invoked

-IDE Configuration: [image: Screenshot at 2021-05-20 14-03-10_1] https://user-images.githubusercontent.com/17222086/118968919-22238f00-b975-11eb-99bf-2ad624b160b5.png

-MyConfig.h Content (Without commented text):

//#define EINK_V1

define DCPOWER

//#define LIGHTSENS //#define BIZZER

define LANG_EN

define MY_DEBUG

//#define MY_PASSIVE_NODE //#define MY_NODE_ID 101

define MY_RADIO_NRF5_ESB

define MY_NRF5_ESB_MODE (NRF5_1MBPS)

//#define MY_NRF5_ESB_MODE (NRF5_250KBPS)

define MY_RESET_REASON_TEXT

define SN "EFEKTA WeatherStation 290"

define SV "0.46"

define ESPECIALLY

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/smartboxchannel/EFEKTA-EINK290-TEMP-HUM-PRES-WEATHER-MINI-STATION-NRF52/issues/1, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHTEF7V4OFUW27MG5BBNQBLTOTVYBANCNFSM45GYWSZQ .

maxim-sm commented 3 years ago

Thanks a lot for the quick response.

I have a MySensors gateway and the gateway is the only device that I currently have on the network. I'm very new to the MySensors world and still trying to understand the basics. It all started with me trying to get the EINK290 to be the first device on the network and work with Home Assistant. I did it by adding the following code which supposedly needed for Home Assistant (as I saw in HA's documentation and a YouTube video I used for help):

define CHILD_ID 1

And the following to the setup():

Serial.println("Requesting initial value from controller"); request(CHILD_ID, V_STATUS); wait(2000, C_SET, V_STATUS);

Once these changes didn't work (the device was frozen), I tried to flash the vanilla code from the repo without these additions. I honestly hope that I didn't screw anything up with this code, although it seems that the device is stuck even before executing any of this.

maxim-sm commented 3 years ago

Sorry to bother with this, but have you had a chance to check if you can reproduce the issue?

smartboxchannel commented 3 years ago

Only today I have the soldered boards of the desired version on my hands, I will try to reproduce them. By the way, your device does not have an external quartz resonator, try to flash the device with the settings in IDE - RC for now

002

maxim-sm commented 3 years ago

Thanks for the suggestion. Unfortunately I already tried changing it to the RC setting which didn't help.

smartboxchannel commented 3 years ago

https://github.com/smartboxchannel/EFEKTA-EINK290-TEMP-HUM-PRES-WEATHER-MINI-STATION-NRF52/tree/main/CODE/HEX

Try downloading the compiled firmware for now.

This can be done by connecting j-link to the device and opening cmd.

you need to insert a line:

nrfjprog -f nrf52 --program "C:\EINK290_1_52840_RC_ST.ino.hex" --chiperase -r

and press enter.

do not forget to specify the correct path to the hex file

smartboxchannel commented 3 years ago

Thanks for the suggestion. Unfortunately I already tried changing it to the RC setting which didn't help.

Hello, have you tried to flash the device with ready-made firmware? This will allow us to understand where the problem is.

maxim-sm commented 3 years ago

Thanks for the suggestion. Unfortunately I already tried changing it to the RC setting which didn't help.

Hello, have you tried to flash the device with ready-made firmware? This will allow us to understand where the problem is.

Sorry, not yet. I'm not at home this weekend, but I will test it tomorrow evening once I'm back. Thanks! 🙂

maxim-sm commented 3 years ago

First, thanks again for helping me with this! I really appreciate it. I flashed the HEX file and it worked perfectly! :partying_face: It successfully connected to the gateway and Home Assistant.

I didn't use nrfjprog as I have an ST-LINK device (I read that it isn't compatible). So I used openocd to flash it. If anyone needs the commands:

$ /opt/openocd/bin/openocd -f interface/stlink.cfg -f target/nrf52.cfg
> init
> halt;nrf5 mass_erase
> program EINK290_1_52840_RC_ST.ino.hex verify reset

Taken from: https://4k2.de/microcontroller/openocd-flashing-nrf52/

Please let me know how can I help you further debug this issue.

smartboxchannel commented 3 years ago

I assumed that by loading the compiled hex file, the device would start. This indicates that my instructions for installing the development environment, boards and libraries are not so good. I'm sure this is the problem. In the coming days, I will update the manual, make it more detailed and ask you to try to reinstall all libraries, edit all files, compile and try to flash the device with the firmware already compiled on your side.