Closed Madotan closed 7 months ago
Hello from France! ^^
It's been a while since I opened up this project, but I'll try to help :)
From my notes, a fast blink should not happen unless something is requested by the mouse or the PC, so there's something wrong if you get a fast blink right at boot. Also, not sure if an Aladin Air is supposed to work the same as a Pro, so there's that too...
Baudrate-wise, the code communicates with the PC at 9600, and with the Aladin mouse at 19200, so that seems to be right (in the code, Serial for PC and Serial2 for the mouse).
Trying the test data is a good start, I think you can use the following code, replacing the similar commented block at line 169 in MemoAladin.ino. It will check the test data and copy it into the internal buffer, ready to be read by the PC (the LED should blink fast). Then you should be able to read the data with Diving Log 6.0. Might be worth trying DataTrack too, if you have it (I should have a backup somewhere, I'll try to dig that up).
Although, before that you should check that without the Aladin connected, and Diving Log 6.0 not running, the LED is only "breathing" when plugging the board in USB (and maybe short the 2 Aladin cables together, to make sure no noise is being picked up and confusing the code).
if (checkTestData()) {
memcpy(data, testdata, sizeof(testData));
blinkFast();
}
For the buy option, possible, but for the best chance of that working I would need to dump the flash of my original MemoAladin build, which would be in around a month or so when I get back to the current owner. I wouldn't be able to test it otherwise and end up doing what you did. Although I should get a dump anyway...
Regards, -Benjamin
Hi Benjamin,
thanks for your reply! I forgot to mention, that i am not using an external LED, but the LED on the mainboard (PC13). i hope this supports "breathing". After shorting the aladin cables there was no more flashing, but constant light. I pasted your code (replacing testdata with testData in l169) but nothing happened and the led is just on. I looked up the logs with diving log 6.0 and subsurface and attached the to this post. As i am reading this, they are waiting for an input from the memomouse.
some translation from my pictures:
Arduino_Output.png -> Sketch uses 70% of RAM, not much RAM available, can cause stability issues
DC_Family_Uwatec_Memomous.txt -> at around 1:06 i resettet the stm to close the connection. subsurface.log -> same thing
Datatrack (DL: https://scubapro.johnsonoutdoors.com/us/software-firmware) detects the memomouse but just counts down to zero and closes the connection.
I found a bluepill and did some tests.
PC13 will not work as status LED, it need to support analogWrite and apparently it doesn't. I guess you could use PB1 and wire PB1 and PC13 together if you don't have a spare LED+resistor laying around. The PC13 LED is inverted though, so the constant ON will be OFF. Sketch RAM usage warning is no issue, the code doesn't do dynamic memory allocations so the 30% left will never be used.
I tried DivingLog and it doesn't download, because it doesn't send anything to the STM to initiate the transfer. I tried to send the data from the STM but it doesn't do anything. Not sure where are the logs to debug it, but maybe you can try, I'll attach some files. Your logs seems to suggest it sends something (Write: size=9, data=E0A000AA00000000EA), so, not sure. I hooked up 2 USB-Serial together and didn't receive anything when I started the transfert in Diving Log.
DataTrack works with the test data, although I had to add a line in the previous code :
if (checkTestData()) {
memcpy(data, testData, sizeof(testData));
decoderState = DecoderState::Ready;
blinkFast();
}
Some files attached in ZIP (can't upload .ino or .bin directly):
Just a quick update: After installing a regular LED on PINPB1 one of my bluepills startet working!!! It worked with subsurface and diving log and datatrack! Interestingly it would always load your testfiles to the logging software and not the data on my aladin. But my Aladin triggers the Upload (LED flashes and your 3 dives are in the software). I just used the "Master" of github not your new files. I am not sure if there is something like old code on the stm32 that it just overwrites my dives? I will update soon! Thank you very much for helping!
Strange, but ok, glad it works :P maybe a bad wire/connection somewhere? I don't think using PC13 can interfere somehow. If you get the test data, you still have the test code on the STM, the upload probably failed? Or wrong code uploaded, something like that.
Update-Time:
I reproduced every step to update all the links and create a (for me) working version of your project. (Maybe you want to add it to your guide?)
my prequesites: Win10, 64 bit STM32F103C8T6 with R10 1.5kOhms ST-Link V2 Aladin Air diving computer subsurface diving software
Updated Wiki-Pages for the bluepill: https://web.archive.org/web/20190316155227/http://wiki.stm32duino.com/index.php?title=Blue_Pill or https://stm32-base.org/boards/STM32F103C8T6-Blue-Pill.html If your stm32 does not come with R10=1.5kOhms check the archive-link for the dirty usb fix.
Download the bootloader: https://github.com/rogerclarkmelbourne/STM32duino-bootloader/blob/master/binaries/generic_boot20_pc13.bin
Download CubeProgrammer for STLink V2 to flash Bootloader (need E-Mail to sign up): https://www.st.com/en/development-tools/stm32cubeprog.html
Set your STM32 Boot0 to 1!
Connect your STM32 Hardware with the STLink
Start CubeProgrammer and connect the STLink to your PC
In File Path you link the Bootloader generic_boot20_pc13.bin
Start connection with STLink
Clean the STM32 chip as shown
Upload the Bootloader with "Start Programming"
Set your Boot0 to 0 without disconnecting power!
Connect the STM32 directly via USB
Maybe you will need the drivers mentioned here: https://github.com/rogerclarkmelbourne/Arduino_STM32 -> Point 2 https://github.com/rogerclarkmelbourne/Arduino_STM32/wiki/Installation
Check device manager if the stm is using COM-Port or "libusb-win32 devices/maple usb dfu". You need the COM-Port! If its using libusb -> reflash the bootloader with cubeprogrammer
Installing the bootloader is complete!
Scroll Down, Zip-Version: https://www.arduino.cc/en/software
https://github.com/rogerclarkmelbourne/Arduino_STM32/wiki/Installation
Load the Aladin-Library of this repo and LEDEffect-library from here: https://github.com/harrisonhjones/LEDEffect --> Sketch – Include library – Add .zip – Aladin Master.zip and LEDEffect Master.zip
Choose these COM-Settings:
I tested Datatrak (LINK) and Diving Log 6.0 (LINK!) and they all seem to work!
Thank you for the very complete update! I'll add all that into the readme ASAP, thanks.
About the BOOT 0 jumper: you don't need to set BOOT 0 to 1 to flash the board. It was a fluke if you had to.
I also tried to use the official STM Arduino core last time instead of the one from Roger, and although I couldn't get it to compile on my machine with the "old" Arduino IDE it should work all the same. Also, the STM32 is not strictly required, any Arduino with 2 hardware serial port should work as-is, or with a slight modification to use SoftwareSerial for Serial2. e.g. a Pro Mini should work too. I'll add a note in the readme.
Hi Benjamin,
first: Thanks for this project and the cheap opportunity to revive my old Aladin and Sorry for reviving this old project...
Unfortunatly i have some problems getting this thing to run. I got two STM35f103C8T6 and tried both. I flashed the bootloader mentioned here: https://github.com/rogerclarkmelbourne/Arduino_STM32/wiki/Bootloader (the link in your project doesnt work anymore) in the normal and tried the fastboot pc13 version with my stlink v2. The connection with usb is stable after that. My board came with an 1.5kOhms resistor in R10, so it should work without the "dirty USB fix".
After installing the arduino IDE, the LED-library and your libraries i transferred the program with the arduino-software. This seemed to upload correctly. After restarting the stm it startet blinking fast (no transfer pending). So i startet the software diving log 6.0, which should work, and startet the diving download. I connected my Aladin Air and changed it to logbook, nothing happens. Just the continoues fast blinking of the stm. So i openened the logbook on the aladin and that also didnt change anything. Right now i am not sure what the problem is...
After some testing around without knowing what im doing i saw in the logs of diving log 6.0 that it wants to connect to the memomouse with 9600baudrate, but your program says 19200. The communication with diving log 6 relies on this library: https://www.libdivecomputer.org/index.html The baudrate 9600 seems to work with a lot of original memomouses and diving log 6.0. Could you help me to run your testdata so i can check which end is causing problems? Thanks! If you dont have time to support me, is it possible to buy one of your ready to use stm?
Greetings from Germany, Madotan