Laser_tape_reverse_engineering icon indicating copy to clipboard operation
Laser_tape_reverse_engineering copied to clipboard

85A module not working.

Open MickTheMechanic opened this issue 2 years ago • 88 comments

In have purchased the following device, which appears to be identical to the D30 device: https://www.amazon.de/gp/product/B08H8WPB3M/ref=ppx_yo_dt_b_asin_title_o03_s00?ie=UTF8&psc=1

Upon disassembly i noticed the module was marked as 85A, but it appears to be visually identical to the 85B module: Image (20) Image (19)

On the JRT-Measure website it seems like the 85A is the same as the 85B, just with a more powerful laser diode, better suited for industry applications: https://www.jrt-measure.com/distance-sensor-short-range/57266349.html

I am able to succesfully program the MCu via the STLink software using the U85B HEX files, but I do not get any data via the serial connection, and the laser is permenantly on.

I have tried using an arduino and a CH340 shield to interface with my PC, and I have tried the serial monitor in the Arduino IDE, Serial Port Monitor, and the PC utilities, but I am not getting any comminication from the module.

Could you provide some support for troubleshooting?

MickTheMechanic avatar Nov 07 '21 15:11 MickTheMechanic

What is the name of HEX file that you are using? Do you use ST-Link programmer or DFU bootloader?

iliasam avatar Nov 07 '21 15:11 iliasam

I have tried STLink programmer and STcube programmer.

I have tried the following files from the CortexM0 folder: Firmware_dist_calculation_fast_boot.hex Firmware_dist_calculation_fast.hex Firmware_dist_calculation_simple.hex Firmware_raw_capture.hex

Each upload appears to be sucsessful, but no communication via serial.

It is possible i have made a mistake somewhere, it is my first time working with STM32 products, until now my experience is only with ATMega and ESP32 products.

MickTheMechanic avatar Nov 07 '21 15:11 MickTheMechanic

I checked the documentation again, I think i have made a mistake.

When using the programmer which file do I select?

MickTheMechanic avatar Nov 07 '21 15:11 MickTheMechanic

Try to use "Firmware_dist_calculation_fast_boot.hex" again with "PC_show_results.exe" utility. Your USB-UART converter should support baudrate - 256000. It would be good to check TX pin of the module by oscilloscope. Also you can try to disconnect beeper from PCB and connect it between TX pin and GND. You should hear buzzing if module is transmitting data (I tried it).

If you are using NOT "_boot.hex" file, you need to connect module UART RX pin to external UART which will pull up this line - to get UART working. "_boot.hex" files do not have such check , UART is always enabled in such firmware.

iliasam avatar Nov 07 '21 15:11 iliasam

Sorry, my mistake - BOOT0 must be connected to GND or it can be floating to get firmware running.

iliasam avatar Nov 07 '21 15:11 iliasam

In the STCube software which baudrate should i select for the uplaud via UART?

MickTheMechanic avatar Nov 07 '21 15:11 MickTheMechanic

Baudrate for bootloader is 115200 - you can see at image: https://github.com/iliasam/Laser_tape_reverse_engineering/wiki/U85-module-programming I have updated text and pinout about BOOT0 pin just now, be careful.

iliasam avatar Nov 07 '21 16:11 iliasam

I cannot connect, i have the error message:


17:07:15 : Serial Port COM4 is successfully opened.
  17:07:15 : Port configuration: parity = even, baudrate = 115200, data-bit = 8,                     stop-bit = 1.0, flow-control = off
  17:07:17 : Timeout error occured while waiting for acknowledgement.
  17:07:17 : Timeout error occured while waiting for acknowledgement.
  17:07:17 : Error: Activating device: KO. Please, verify the boot mode configuration and check the serial port configuration. Reset your device then try again... 
  17:07:21 : RTS low
  17:07:21 : DTR low

I currently have PWRON and BOOT0 connected to VBAT, and NRST is floating. Is this correct?

MickTheMechanic avatar Nov 07 '21 16:11 MickTheMechanic

"PWRON and BOOT0 connected to VBAT, and NRST is floating." - this is correct. So it is strange, that you can't connect from bootloader. Are you sure that RX and TX are connected OK (not swapped)?

iliasam avatar Nov 07 '21 16:11 iliasam

I have tried both connections, but i cant get the connection to work. Is it possible i have damaged the bootloader somehow?

MickTheMechanic avatar Nov 07 '21 16:11 MickTheMechanic

Strange situation. st-link programmer with NRST connected and "Connect under Reset" selected should we working anyway. What is the type of st-link programmer that you are using?

iliasam avatar Nov 07 '21 16:11 iliasam

I can connect with the STlink, but not with serial. I am currently re-doing all my connections, incase it was an issue with the cables or soldering.

I have the STLink V2, looks just like a usb thumb drive

MickTheMechanic avatar Nov 07 '21 16:11 MickTheMechanic

If your programmer is same: https://www.mikroshop.ch/shoppic/ST_LINKV2.jpg You need to notice, that it do not have NRST pin. Its RST pin for STM8 only: https://research.kudelskisecurity.com/2020/04/15/swd-part-3-swo-and-nrst/ But if can erase and flash MCU without NRST connected to st-link, so that is OK.

iliasam avatar Nov 07 '21 16:11 iliasam

It looks like i damaged the module somehow, I have a second one here and I have sucsessfully connected via Serial

MickTheMechanic avatar Nov 07 '21 17:11 MickTheMechanic

I have done the calibration at >10cm, but the distance is way off. It is showing 2.8m at a distance of only 1.7m.

Are there further steps that need to be taken to improve accuracy?

MickTheMechanic avatar Nov 07 '21 17:11 MickTheMechanic

Could you try to go calibration at distance 20cm? I do not have such big errors at my module.

iliasam avatar Nov 07 '21 18:11 iliasam

Ok, i will do some testing and let you know how it goes.

I noticed some components on the circuit board are different when compared to the U85B, most notibly is the large component (an inductor?) is no longer present, and the 6 pin IC marked FB3MKE has been replaced by 2 smaller 5 pin IC's labelled YJ33. Do you know what this circuit is responsible for?

Also, do I understand correctly that the _simple file is for precision, _fast file is for speed?

And a final question for now, i have been observing the signals in the PC utility, and I noticed the low frequency (FREQ LOW) signal does not look clean, whereas the other frequencies are a very clean sinus wave. Is this normal?

Screenshot (49) ?

MickTheMechanic avatar Nov 07 '21 18:11 MickTheMechanic

FB3MKE IC (DC-DC) is used for producing 3.3V for power supply. YJ33 is a linear source of 3.3V. I'm afraid that "85a" version could really need other phase compensation method due to changes in hardware

"Also, do I understand correctly that the _simple file is for precision, _fast file is for speed?" No, they have same precision, but "_simple " is just written simpler to understand, but it is slower.

" low frequency (FREQ LOW) signal does not look clean" That is OK, this "FREQ LOW" and "FREQ5" are experimental.

iliasam avatar Nov 07 '21 19:11 iliasam

Do you mean temperature compensation?

Another question I have is about the photosensor voltage, according to the pc utility it is at 110v, is this normal? And should this value change or remain constant?

MickTheMechanic avatar Nov 07 '21 19:11 MickTheMechanic

Phase is compensated by measured amplitude value, temperature phase offset is compensated too, but temperature dependence is much smaller.

110v is OK, so be careful with module. Module does not produce really dangerous current, but such voltage hurts and could easily destroy low-voltage electronics if some short circuit happens.
APD voltage is changed when measured temperature is changing.

iliasam avatar Nov 07 '21 19:11 iliasam

I would like to get this module working correctly, it may also benefit others in the future.

could you walk me through how to determine a new phase compensation for this hardware? I can do testing or take measurements with an oscilloscope, I just don’t know where to begin.

MickTheMechanic avatar Nov 07 '21 21:11 MickTheMechanic

I can try to give you description how to collect needed data. Firstly, I need to build firmware with compensation disabled - it must be used with "PC_phase_analyse.exe" utility. You would not need any other electronic devices to collect data. But you need to have some kind of movable plate that must be installed close to laser output lens. This plate is needed to change amplitude of transmitted light accurately. See this photo: https://habrastorage.org/r/w1560/web/992/4ae/5f5/9924ae5f5807467fa40f9595134ac2f4.jpg

iliasam avatar Nov 08 '21 08:11 iliasam

Ok no problem, I can manage some kind of mechanism for that, let me know when you have the modified firmware.

i have read your article in more detail and i have some observations and questions..

with the current firmware I observe that the distance measurement is not correct, one mm measured from the sensor corresponds to multiple centimeters, apart from that the distance seems stable until a distance of about 30cm (95mm according to the sensor) is reached, then the value jumps up to over 1000mm, it is the stable once more for a short distance before jumping again.

I wonder if this phenomenon is caused by the phase difference exceeding 360°, Or perhaps the reference frequency is no longer 5khz with the new hardware? Just some thoughts I had while reading your paper.

also thank you for the support 👍

MickTheMechanic avatar Nov 08 '21 09:11 MickTheMechanic

All frequencies are generated by PLL IC (si5351 or its clone), which is same type in all types of modules. This IC is fully controlled by MCU, so all frequencies should be OK.

iliasam avatar Nov 08 '21 10:11 iliasam

Ok, thank you for the explanation.

I will begin work on the mechanism for limiting the Laser output.

MickTheMechanic avatar Nov 08 '21 10:11 MickTheMechanic

I have published test firmware: https://github.com/iliasam/Laser_tape_reverse_engineering/blob/master/Code/CortexM0/test_firmware_phase_calc.hex See readme.txt description: https://github.com/iliasam/Laser_tape_reverse_engineering/tree/master/Code/CortexM0 I need some time to write description how to make measurements.

iliasam avatar Nov 08 '21 18:11 iliasam

Thanks, I have also finished the device for limiting the amplitude: AD2A950B-23DF-45BB-BCA0-FF5730317DA3 67F5A488-969F-42B8-B325-C094F7DA41FF C42F64BC-F206-4FB3-9573-08E366FD07E5

I await your further instructions.

thanks for the help

MickTheMechanic avatar Nov 08 '21 19:11 MickTheMechanic

In your reply you said the plate should cover the laser output, but in the image it seems like the plate is covering the photo sensor input. Should the input or the output be covered?

MickTheMechanic avatar Nov 08 '21 20:11 MickTheMechanic

Yes, in my photo plate is closing photodiode lens, but photo is made with old module. I had closed laser output with 85b module. I suppose that your device should work OK. You can test it - load test firmware, run "PC_phase_analyse.exe" utility and check amplitude at different positions of plate.

iliasam avatar Nov 09 '21 04:11 iliasam

I have tested the device and I can adjust the amplutude by adjusting how much the laser is covered.

What are the next steps?

MickTheMechanic avatar Nov 09 '21 14:11 MickTheMechanic