Movesense customgatt example not working? - gatt

I've built the custom_gattsvc_app and updated it into my movesense sensor through DFU in AndroidSampleApp. Now I am not anymore able to connect to the sensor. The sensor can be found by AndroidSampleApp as well as NRF Connect, but connecting does not work.
The sensor itself blinks in short intervals, perhaps it is in reset loop? I don't have a programming jig, so I can't even update it anymore (Cannot connect -> cannot update). I am using version 1.9.1. I've tested other example apps, such as hello_world_app and ble_std_services, and they have worked just fine.
Is there a known problem here?
Building done with following commands:
cmake -G Ninja -DMOVESENSE_CORE_LIBRARY=../MovesenseCoreLib/ -DCMAKE_TOOLCHAIN_FILE=../MovesenseCoreLib/toolchain/gcc-nrf52.cmake ../samples/custom_gattsvc_app
ninja dfupkg

The device might be crashing and trying to restart continuously. If you are not blinking the led and have turned off the BLE advertising in your code.
You should be able to recover by taking out the battery, short the two contacts with your finger(dip your finger in water if you have dry skin) and insert the battery, release the contacts immediately when the led starts to flash.
Your sensor should no be in DFU mode(led constantly on) and ready to update firmware. You can use the "nRF Toolbox" app(from the producer of the Bluetooth chip used in the Movesense device) to upload a new build of your code/example.

Custom GATT Example seems to be working with version 1.8.1, so I will continue using that. Perhaps the problem is related to this: https://bitbucket.org/suunto/movesense-device-lib/issues/70/version-190-and-191-and-send_ble_nus_data

Related

How to fix Failed to connect to ESP32: Timed out waiting for packet header error?

I tried to flash an ESP32 but I didn't succeed, I tried with esptool.py and Arduino IDE. I tried to press the boot button and reset but it didn't work. Here is the error:
A fatal error occurred: Failed to connect to ESP32: Timed out waiting for packet header
If using the Arduino IDE, try lowering the upload speed (Tools/Upload Speed). Lowering mine from 921600 to 460800 did the trick.
First ensure that you are in download mode:
Start the serial monitor and set the speed (mine is 115200).
While pressing the "boot" button, press and release the "en" button (your buttons may be labeled differently).
You should see something like this on the serial monitor:
waiting for download
Now start the upload
My development machine, a 2013 iMac is connected via USB to the USB-c port on my ESP32 Dev Module. Apparently the iMac's USB or ESP32 board's USB cannot keep up at the 921600 upload speed.
DISCLAIMER! May not be correct answer but may help to save time for someone.
Quick answer if you do not want read my experience: Disconnect all wires from pins and try uploading again! It may help.
I came across with the same error and could not figure it out. I first thought that something is wrong with the code, because it happened after I edited working code while figuring out where to connect what pin 😀. I also wasn't able to upload simple HelloWorld after it happened with connected wires. But then I disconnected all my wires from the board and the upload works fine.
I can not figure out the WHY factor but I think it must had been the input/data pin I was using, in my case D13. I have the DevKit with fewer pins. Maybe someone can comment why connected pins may make the error come up?
To make your ESP32 board go into flashing/uploading mode automatically, you can connect a 10 μF electrolytic capacitor between the EN pin and GND. When I had the same problem, when I followed this advice, the problem was solved.
References
Failed to connect to ESP32: Timed out waiting for packet header
espressif/arduino-esp32 - issue
On some AliExpress-like ESP32s you have to press the boot button in order to upload your sketch.
If you are watching the Arduino IDE console ouput and Connecting ... appears, you have to press the boot button for approximately 2 seconds until the console output changes.
Try to do this one after the other
Press the boot button when press uploading button until it write the code.
Try disconnect esp32 from the board/header/pcb that you are using right at the time.
Disconnect any other connection that your esp32 might have.
Do not connect to anything even your hand if possible.
Try put it in something that doesnt have a moist surface. look pic number 3.
MY CASES(30 pin version):
Case 1: I dont know why. I was connecting the pin to a female header it doesnt work and sometimes it just work like that. look pic number 1.
Case 2: when Im holding esp32 on my hand sometimes it wont work then i put it on my table and another time it doing well.
Case 3: pressing boot button when uploading it helped sometimes, and the other time it just work like it should.
Case 4: when it connected to pcb its simply just wont work, but when disconnected boom it work like nothing ever happen. look pic number 2.
Maybe just maybe something with capacitive or something like that (just assuming because number Case 1). hope that will help you out.
pic 1pic 2pic 3
This technique definitely working
Goto Tools > programmer, Select ISP and Upload Your Code.
if you can't see any programmer, then download 1.8.12 version.
https://www.arduino.cc/en/software/OldSoftwareReleases
With Arduino IDE
Make sure the Com port is selected under Tools menu. My experience with ESP32 is Com 5.
If it is not available as an option, try changing USB ports and/or re-select Tools - Board - ESP32 dev module.
Watch the "Compiling Sketch" window.
Press the "Boot" button as soon as you get the red message "Serial port Com 5" You can release the button as soon as it starts to upload.
If this doesn't work,try plugging into another USB port.
The Reset button only resets the uploaded sketch to re-initialise and has nothing to do with the uploading.
Install expressif.exe and port drivers,connect the port and flash the esp32 ,upload the code using ardiuno,solve the error
in my case buttons are new but not shorting properly as multimeter showed ..opened both scratched resoldered and all working
Changing by upload speed from 921600bps to 115200bps fixed it. No need to press any buttons.
Just download the drivers x)
CP210x: CP210x USB to UART Bridge VCP Drivers
FTDI: FTDI Virtual COM Port Drivers

Issues Flashing STM32F401CC with CubeProgrammer DFU

I'm trying to do a DFU program upload via Arduino for an STM32F401CC. I'm using CubeProgrammer to upload the compiled bin and verify the contents of the STM32's flash is being written starting at 0x8 -- it's all there. I'm using a jumper to pull B0 high and am verifying it shows as STM32 BOOTLOADER in the device manager, then I'm disconnecting it. Everything shows that the program is upload correctly, but my program isn't actually running (make onboard PC13 LED blink). I'm using a board I got off amazon but verified the STM32F401CC is genuine. Is there something I'm missing? I'm coming over to ARM after years of using the ESP32.
I had couple bought and both the same problem,as yours, supposingly they were fake ones and wrong batch,so port in arduino ide wasnt recognized and the same issue as above in stmcubeprogrammer. It was stm32401ccu6 gh27a batch 103, only way was flash with full erase (manually didnt work only automatically in stm32cubeprogrammer ) possible but after each download code to mcu in arduino IDE i couldnt download any more sketches on it and had to upload new firmware / bootloader again and it didnt finish i had to press stop button in stmcube programmer during burning bootloader so trash, cheap peace of all kind of problems, i had to read the chineese documentation From WeAct on git because those with HID bootloader was just crap bad english , so more timre carefully didnt make even sense, so finally figure out how to flash finally bougt same chip 411 and it worked but Arduino ide sketch led didnt Blink another piece of cheap clone, 411ceu6 batch 106, at least could upload firmware sucesfully in stm32programmer but Arduino sketches didnt work , i had one 411 already from different manufacturere and didnt have these issues, and next time i will give it last try with WeAct orig chineese manufacturer which makes suposedly only original nonfake Stm32f411ce ver 3.0 product on aliexpress and they sell since 2022 411ceu6 batch 014 allegedly its only one which should not give all kinds of issues As they state on their git. Had anyone same problem solved to finally blinking led in arduino ide? It even didnt switch the build in on PC13 but i could measure 3,1V on that pin to ground, and everytime i burn the orig Or hid bootloader The led fades in and out, its a mystery to me really whats going wrong, someone on forums wrote issues with timer, it has to be sth with arduino ide 1.8.19 or stmduino , then noticed in board manager i have../raw/master/package_stmicroelectronics_index.json in preferences arduino ide and stated there as depreciated so i there was srated i shall be using raw/main/package_stmicroelectronics_index.json Oh my thing So i changed the word master into main and typed in Board manager STM32 MCU based boards and installed actual version 2.2.So instead of chaos just be patient and check literally everything, arduno could pop up message that mcu package depreciated but didnt ;) oh my...suddenly surprice, i need check yet if all worked and i just underwent wrong rumors, so no, it has 1,20V on PC13 diode doesnt blink with blink sketch only after bootloader upload fading, i hate such a job and bought 3 and all of them the same. Doesnt work eiter Led_buildin nor pc13, It was swg method, if i set led high and upload via serial i measure 1,9v and if I set led low i measure 1,3 v with Vin 5V and voltage drop ,5v results in 4,45v complete rambazamba , so i start tombelieve these boards are fake anyone similar or same experience?

OTA firmware update with BLE113

I want to do firmware update over the air with BLE113 module. I am using Nordic's nRF Toolbox to test this and I have configured their GATT services and characteristics in BGScript to do OTA update. But OTA updates are not always successful.
I deduce that, according to Nordic there are different file types of file that can be used to upload for OTA update process, which are,
Distribution Packet(ZIP)
Soft Device
Bootloader
Application.
At present I use 'Application' which means I select a bin file and upload with nRF Toolbox app from Android mobile. But this method is mostly unsuccessful (success rate is nearly 10% only). Can anyone suggest me a reliable way to do this? Has file type got to do anything with reliable OTA update process?
EDIT :
I am using a custom made board. I am not sure with antenna, Anyway I shall check this. And I always keep optimum power level. But nRF Toolbox (or I have come up with my own app using Nordic's OTA firmware update library) always shows 'successfully transferred' when I do OTA update and firmware is not updated most of the times.
It looks like you're trying to update a Bluegiga BLE 113 with Nordic's toolbox? That can't work.
Nordic and Bluegiga (now Silicon Labs) have different ways to perform firmware updates over the air, and they're not compatible.
I have a sample iOS app which will let you OTA from an iOS device to the BLE113 (assuming your firmware supports it): https://github.com/RobotPajamas/ble113-ota-ios
Here is a longer explanation of the BLE113 over the air update process: http://www.sureshjoshi.com/embedded/ble113-ota-over-the-air-programming/

ESP8266 Point to Point communication with 2 arduinos

I am using 2 esp8266 wireless modules to establish bidirectional wireless communication between 2 arduino boards (one mega and one uno) without the use of any earth based technologies (i.e. radio frequencies, wifi which relies on earth sattelites, etc.). My solution was to use the esp8266 to establish a private area network with both esp's acting as a station and an access point (AT+CIPMODE=3). Unfortunately, this solution has proven to be more of a hassle than it was worth.
To start, I have the esp's each wired according to this diagram
When I first started out, the red LED was on and the blue LED was off. During this time, I was able to send AT commands, establish the server, and achieve the communication I required by entering commands directly to the serial monitor. After this, I started writing a library using the SoftwareSerial library to allow me to issue commands directly through the program to set up the esp as needed upon start up of my script. Before doing this, I changed the baudrate to make sure it was running at 9600, and entered the AT commands in the serial monitor to make sure everything was working properly and it still worked.
After I began writing the library, before uploading the code with a test of the library I noticed the blue LED was lit solid now. Noticing this, I reuploaded the barebones script (I haven't uploaded the library code to the arduino yet) and the esp was no longer receiving the AT commands.
Does this indicate an issue with the board which I can fix or does this mean the board is done?
With my deadlines approaching fast in about 3 weeks it is crucial I get this wireless communication working so if this is an issue with the board, I'm going to have to scrap the esp's and use a different way of communicating. So my second question is, if this is the case, what are other viable options for establishing this communication? I have used xbee's before and while that would be ideal, they fall out of the budget I have been alotted so I need to keep it under $50 for this. If bidirectional communication is not possible for that price I can live with one way because I just need to get this system working. Basically I just need to transmit a single byte of data.
I realize this response is a little belated, and I hope you got it sorted: I've started working with the ESP8266 myself in the last few weeks, and hence why I was looking around for tutorials on direct communication between 2 units, when I found your post.
From what I've been able to ascertain, the AT commands are a part of the 'firmware' which ships with some modules. The Arduino code however starts loading onto the chips at memory address 0x0000, which is the same address that the firmware update tools use.
In other words, I believe that with the Arduino-coded program running on there, you lose the AT command functionality.
If you find a firmware update tool for the ESP8266 (plenty online) you'll get back the AT commands.
I suppose though the real question is why would you want to? It seems that the AT commands are just a way to treat the ESP as a dumb WiFi antenna. With the Arduino code, you're actually treating it as a micro-controller in its own right.

Arduino Standalone

I have an Arduino Uno and I am using arduino 1.0.5 IDE. I followed he procedures for bootloading an atmega328P-PU on a breadboard.
I uploaded the ArduinoISP sketch first, made the connections(using the External Oscillator) and then wired it up. Then, I selected the programmer as Arduino as ISP, selected the board as Arduino duemilanove w/ Atmega328P. Then I selected the correct serial port and clicked Burn Bootloader.
I got the following errors:
avrdude.exe: stk500_program_enable(): protocol error, expect=0x14,
resp=0x50avrdude.exe: initialization failed, rc=-1 Double
check connections and try again, or use -F to override
this check.avrdude.exe: stk500_disable(): protocol error, expect=0x14,
resp=0x51
How to solve this issue? Also, can I upload the bootloader directly by using it on the Uno in place of the original chip. If so, how?
to my understanding the error you have indicates a bad reading from the chip. I experienced that with chips that were either dead or not properly connected, especially to power supply.
You may find more detailed information in th tutorial : https://www.arduino.cc/en/Tutorial/ArduinoISP
Especially those things :
Note for Arduino 1.0: you need to make one small change to the
ArduinoISP code. Find the line in the heartbeat() function that says
"delay(40);" and change it to "delay(20);".
Select the items in the
Tools > Board and Serial Port menus that correspond to the board you
are using as the programmer (not the board being programmed).
Instead of arduino built-in boot loader just go through below link and it will be great for uploading boot loader and verifying board status info
I am replying you this because same issue I got long back and it saved me.
One more thing for arduino boot loader: for atmega328 you need to put capacitor between reset and gnd( in case you missed)
For gammon bootloader you don't need it.
Be Innovative.
For reset line you might me using 100nf(thats what stated in documentation )...but sometimes it doesn't work...try something like 4.7uf, 22uf or 47uf or close values
I had a similar problem and the issue was that my programmer was a bit slow, I used the -B flag for avrdude to slow down the bitrate and it started working, I set the -B20 and works like a charm every time, but I use the USBTinyISP programmer, not the stk500 one, so this might not work for you.
In case someone stuck at this as I did and nothing like changing the cap value helped. Make sure you are using your USB-TTL adapter in a 5v mode (obviously for a 5v powered chip). I always used it in a 3.3v mode in order not to accidentally burn my 3.3v chips and it always worked. Until today, I was trying to flash my custom atmega8 board and everything worked with the ISP but I was having a hard time using the bootloader and after half a day searching and trying different stuff the 5v setting to the rescue.

Resources