Code Monkey home page Code Monkey logo

Comments (27)

fanoush avatar fanoush commented on August 23, 2024 1

I may have a solution. There is similar/same issue reported here adafruit/Adafruit_nRF52_Bootloader#35
there is some HCI buffer inside bootloader set to 8, looks like this overflows with default nrfConnect settings of sending 10 packets at once, please go to nrfConnect settings -> DFU options and reduce Number of packets from 10 to 5 (or try even lower if 5 doesn't help). This helped me and I flashed micropython on first try.
Then I run (over bluetooth repl)

import machine
machine.enter_ota_dfu()

and flashed the back-to-desay package and again on first try it worked and I am back to original Desay bootloader.

from ds-d6.

fanoush avatar fanoush commented on August 23, 2024

Sorry, noticed only now. Adafruit bootloader is notlistening for both transports like Desay one, if it advertising as AdaDFU it wont work on serial at the same time. However it waits 3 seconds fo serial DFU after each reboot or poweron on charger from empty battery. So that is the only chance to use serial (or when forced into serial mode from micropython). This is very strange. I would suggest to use different phone. Maybe also test downloaded zip with 7zip or winzip if it is really valid zip file,maybe you downloaded github webpage instead of raw zip?

from ds-d6.

fanoush avatar fanoush commented on August 23, 2024

Hi, did you resolve the issue? What was the problem?

from ds-d6.

mogenson avatar mogenson commented on August 23, 2024

Hi. I tried again today. Still cannot get any chatter on serial and AdaDFU device disconnects when attempting to do a DFU update from the D6 Flasher Android app. This is with either of the micropython zip archives from the repo. I've checked that the downloaded files are valid zip archives.

How do you restart the DS-D6? In the AdaDFU mode, the screen is off, so it's hard to tell what state it is in. If I open the device up, is there an easy to reach reset pin or pad?

from ds-d6.

fanoush avatar fanoush commented on August 23, 2024

As explained unfortunately you have no chance with serial if it is advertising over bluetooth, It is serial or bluetooth, not both. Could be you have some interference like too many wireless devices (wi-fi, bluetooth) around like mouse, headphones. In general it should work so I'd try go to different place, turn buetooth off/on on the phone, change between nrfconnect and D6 flasher (both should work)
And BTW there is also restore package that you can try https://github.com/fanoush/ds-d6/blob/master/micropython/DS-D6-adafruit-back-to-desay-sd132v201.zip

As for reset, yes there is RST pin under OLED so you need to lift it, easier way is to momentarily shorcut battery pins on the side near usb connector (marked +,- on this photo ), that will power off the device. Then you could prepare adafruit-nrfutil command line, slide it into usb socket with usb to serial and power and it will turn on and you have up to 3 seconds to press enter for serial flashing.

Also if you have it open you can always restore it fully over SWD pins via openocd.

If you still have issues/questions you can also join the lobby as linked in toplevel readme.

from ds-d6.

coelner avatar coelner commented on August 23, 2024

Same problem here. Both apps don't work. The bootloader disconnects the flasher.

from ds-d6.

fanoush avatar fanoush commented on August 23, 2024

Hello, I have tried this again from scratch with two devices and can confirm this is really not working now. I am no sure what is wrong or what changed. I tried D6Flasher, nrfconnect and nrf toolbox on two phones and it is hit and miss. I did succeed once with nrf toolbox and flashed micropython blerepl to one device but I suppose I was very lucky as I could't repeat it again.

This is very strange as I don't remember having any issues when I tried this months before with my first DS-D6. I even tried it like week ago and flashed another DS-D6 succesfully not noticing any issues like this. I guess that after first flashing I am mostly using dfu over serial but I had to flash it over bluetooth at least initially. Will investigate more.

I guess the only way out now is to let the battery die and try the serial mode which is available for few seconds when it powers on. Or open the device of course and restore via SWD (or just shortcut battery momentarily, that will turn it off so serial is available at poweron). Sorry about that. Will investigate more.

from ds-d6.

coelner avatar coelner commented on August 23, 2024

so far this worked for me but I flashed the uart version.
Next problem, I can not get any uart reply from the usb pins (I used a ch340G TTL). Do you have a guide how to use a st-link v2 to reflash over jtag?

from ds-d6.

fanoush avatar fanoush commented on August 23, 2024

this should not be needed, with uart enabled it does not last very long, so after 1 or 2 days the battery is dead so when you connect it to power again it should boot from scratch and work again, also at poweron time you have those 3 seconds to reflash it over serial via adafruit-nrfutil

as for jtag, I don't have ready made guide, the easiest it probably to use openocd and just erase last flash page at 0x7f000, this should force adafruit bootloader to stay in dfu mode after restart and then you can flash recovery DFU package

so check this https://gist.github.com/fanoush/06eee6344a2e59f7b12707b25d87edda and this http://openocd.org/doc/html/Flash-Commands.html and run commands like

reset halt
flash erase_address 0x7f000 0x1000
reset run

as for full recovery there is flash write_image that can write bin or hex file

BTW, the micropython console uart speed is 115200, I have added it to readme now, ch340G adapter should work and there are only 2 combinations of RX,TX. it may be that repl console gets stuck after some time but after poweron from empty battery it should work. UART hardware is power hungry so it should draw miliamps instead of microamps so the 80mAh battery should last like 8 hours with UART on.

from ds-d6.

fanoush avatar fanoush commented on August 23, 2024

oh sorry 80mAh is more like 80 hours maximum, not 8 but I guess the draw is more than 1 mA, see e.g. https://devzone.nordicsemi.com/f/nordic-q-a/23444/power-consumption-on-nrf52832-with-uart so it can be like 2 days from full battery

And BTW as for SWD setup I found spring loaded pogo pins to be practical, when you connect GND via USB connector it is just 2 pins, see photo here https://ibb.co/album/keQ51F

Pogo pins with width 0.68 fit into standard jumper wire female socket like seen on photo, you may search ebay or aliexpress for "Spring Test Pogo Pin P50 0.68mm", should cost dollar or two for pack of 10-20. But even normal male jumper wires could work when aligned properly. I tried also soldering but teared off the pad when I had wire soldered and pulled it by mistake so I'd suggest to avoid that.

from ds-d6.

coelner avatar coelner commented on August 23, 2024

Thanks for your help but I think the device is dead. It does not respond to anything of this.

from ds-d6.

fanoush avatar fanoush commented on August 23, 2024

What you mean by "anything of this" - serial or SWD? Most probably you are just doing/connecting something wrong, it is quite unlikely to kill it just by flashing. For serial connection - do you attach also 5V (not 3.3V) to usb power pin and GND in addition to (3.3V level TTL) RX/TX? It won't start otherwise if battery is empty. OTOH if you think it is charged but not responding then I'd just put it away for few days to let the battery discharge and start again later. Hopefully you got more than one.

The SWD should definitely work in any state of CPU/ram/flash if you attach GND,5V and SWD pins. Also you may measure 3.3 (VDD) voltage pin to ground, next to oled, see https://fccid.io/png.php?id=3414019&page=2 to check if it has power.

Anyway if you wish you may describe exactly what you are doing in what order to check if there is some obvious mistake.

from ds-d6.

coelner avatar coelner commented on August 23, 2024

I tried again with a ch340g and ft2322h but no uart response. Switched TX and RX and applied 5V to the USB connector.
I tried also a st-link v2 with GND and DIO, second try was with CLK. I get no response at all, only the st-link is recognized. (It is similiar to some of the st-link clones when I try to reflash them. they do not respond to anything)
The battery is between 3.8 and 4V, it should be enough.

Usually the device should be rebooted if some of the rst pads is connected to ground?

from ds-d6.

coelner avatar coelner commented on August 23, 2024

I tried again with a ch340g and ft2322h but no uart response.
I tried also a st-link v2 with gnd and dio, second run was with clk.
The battery is between 3.8 and 4V, it should be enough.
ds-d6-pad
Is this right:
1 - VDD -> 3.3V
2 - DIO
3 - CLK
4 - GND
5 - CHG

from ds-d6.

fanoush avatar fanoush commented on August 23, 2024

Yes, that is right. if battery is fine then for SWD you need 3 wires GND,DIO,CLK connected to STLINK v2 pins GND,SWDIO,SWCLK. GND is easier to connect via usb connector if you have usb female cable.

reset is RST under OLED, for reset you need to connect it to gnd momentarily. But easier is to shortcut +/- battery briefly, that will turn it off and you will need to attach 5V to usb to wake it.

from ds-d6.

coelner avatar coelner commented on August 23, 2024

Ok, thanks. Howe ever the RST does not work with all tries I did, the shortcut between the BAT is working properly.
But I am curious why I can't get any cpu connection over SWD...

from ds-d6.

fanoush avatar fanoush commented on August 23, 2024

Both for reset and swd you need ground pin, are you using GND from usb connector? maybe you can scratch test points a bit to get proper contact? can you make photo of your setup? These are both really basic things that should just work (reset and SWD)

from ds-d6.

coelner avatar coelner commented on August 23, 2024

think it was a broken pogo pin. And maybe some of the foam over the RST pad was causing no reliable connection.
At least if I run sudo openocd -d2 -f interface/stlink-v2.cfg -f target/nrf52.cfg I get the 'welcome' screen and the device restarts. It shows then the clock shortly and then a battery charged status page with 100% and three battery bars.
EDIT1: Works flawless. the stlink encasing was wrong, I used the wrong pins....

from ds-d6.

fanoush avatar fanoush commented on August 23, 2024

Oh, interesting. Just recently I noticed I have two types of stlink V2 dongles with switched pins - one is marked SWDIO,GND,SWCLK on right side and the other is SWCLK,SWDIO,GND (from top). The markings are correct on both as it is indeed switched inside but maybe you have one mixed. It is great it finally works for you.

from ds-d6.

coelner avatar coelner commented on August 23, 2024

Did you patch this file too: https://github.com/fanoush/ds-d6/blob/master/micropython/DS-D6-adafruit-back-to-desay-sd132v201.zip

Currently I can't get into the bootloader successfully, I see only two of the three arrows.

from ds-d6.

fanoush avatar fanoush commented on August 23, 2024

yes, you are in the bootlaoder if you see the arrows :-)
it is actually the older bootloader with animations but it is fixed so softdevice can be upgraded

from ds-d6.

coelner avatar coelner commented on August 23, 2024

Ok, something is fishy here... I can't upload and the bootloader reaches always the timeout. I tried openocd but I fail early:

sudo openocd -d2 -f interface/stlink-v2.cfg -f target/nrf52.cfg
Open On-Chip Debugger 0.10.0
Licensed under GNU GPL v2
For bug reports, read
	http://openocd.org/doc/doxygen/bugs.html
debug_level: 2
Info : auto-selecting first available session transport "hla_swd". To override use 'transport select <transport>'.
Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD
adapter speed: 10000 kHz
Info : Unable to match requested speed 10000 kHz, using 4000 kHz
Info : Unable to match requested speed 10000 kHz, using 4000 kHz
Info : clock speed 4000 kHz
Info : STLINK v2 JTAG v29 API v2 SWIM v7 VID 0x0483 PID 0x3748
Info : using stlink api v2
Info : Target voltage: 3.196342
Info : nrf52.cpu: hardware has 6 breakpoints, 4 watchpoints



telnet:

telnet localhost 4444
Trying ::1...
Connection failed: Verbindungsaufbau abgelehnt
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
Open On-Chip Debugger
nrf52.cpu: hardware has 6 breakpoints, 4 watchpoints
> reset halt
target halted due to debug-request, current mode: Thread 
xPSR: 0x01000000 pc: 0x000008e4 msp: 0x20000400
> flash banks
> flash
flash
  flash bank bank_id driver_name base_address size_bytes chip_width_bytes
            bus_width_bytes target [driver_options ...]
  flash banks
  flash init
  flash list
> flash list
> Connection closed by foreign host.

I miss something like a flash or something to write to. Any hints?

from ds-d6.

vendelin8 avatar vendelin8 commented on August 23, 2024

When I flashed DS-D6-desay-bootloader-noanim-fix.zip and DS-D6-adafruit-bootloader-sd132v611.zip, I was able to come back with DS-D6-adafruit-back-to-desay-sd132v201.zip. Now I flashed DS-D6-micropython1.10-blerepl.zip too, and it seems to be stuck. It shows up as a mpus device in nrf Toolbox and D6Flasher. I sent

import machine
machine.enter_ota_dfu()

with nrfToolbox UART, nothing seemed to happen. If I try to flash DS-D6-adafruit-back-to-desay-sd132v201.zip.
The Start Bootloader button in D6Flasher writes the text about the 3 arrows, but my DS-D6 shows nothing on the screen.
I get dfu characteristics not found with both tools.
I googled it, the first couple of results doesn't seem to help. What do you think?

from ds-d6.

fanoush avatar fanoush commented on August 23, 2024

enter_serial_dfu() is not bluetooth, it is serial uart on middle usb pins. so you need usb to serial ttl adapter

see https://github.com/fanoush/ds-d6/tree/master/micropython#how-to-use , for bluetooth you needed the first one

from ds-d6.

vendelin8 avatar vendelin8 commented on August 23, 2024

Edited, I meant ota, sorry. I tried with that, nothing seemed to happen.

from ds-d6.

fanoush avatar fanoush commented on August 23, 2024

ok, if you still see mpus device (e.g. in nrfConnect Android app when scanning) then micropython is still running. Can you still connect to it in nrfConnect and see nordic uart service?

Not sure what nrfToolbox UART does (e.g. regarding sending new lines), can you try https://aykevl.nl/apps/nus/ from Chrome on PC or Android phone to type in the machine.enter_ota_dfu() code?

Or there is also https://play.google.com/store/apps/details?id=de.kai_morich.serial_bluetooth_terminal&hl=en&gl=US

D6Flasher cannot handle switch from micropython (it would need to send the import+enter_ota_dfu() lines too)

from ds-d6.

vendelin8 avatar vendelin8 commented on August 23, 2024

Ok, it worked from Android Chrome. Before I tried on desktop linux latest Chromium, but it said bluetooth not supported. From Android Brave it was the same. Now I'm back, thank you very much.

from ds-d6.

Related Issues (16)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.