iliasam / OpenTOFLidar

Open Source TOF Lidar
https://habr.com/ru/post/485574/
MIT License
752 stars 185 forks source link

Increasing pulse width and frequency #25

Closed taliaxu09 closed 5 months ago

taliaxu09 commented 6 months ago

Hello, I would like to increase the power output by increasing the pulse width to be as close to the maximum (I believe 100 ns?) as possible and also increase the frequency from 1 kHz to maybe 5 kHz or 10 kHz.

Would you point me to where I could change this in the code? Can I increase the pulse width by using a larger capacitor?

iliasam commented 6 months ago

Hello. 1kHz is just test signal frequency, see main.c of "not_scanning_fw" project (TIMER_ELAPSED(timer_1ms) part). "scanning_fw" reach 10kHz pulse frequency at 15 RPS motor speed.

You can try to increase pulse width by using a larger capacitor, but be careful!

taliaxu09 commented 6 months ago

Thank you! What would be the best software version / setup to compile the code?

iliasam commented 6 months ago

I don't know what is your hardware, do you need scanning or not, so I can't help you.

taliaxu09 commented 6 months ago

I built it as yours, and I don't need scanning and the motor, I am just using the laser.

I just wanted to know the best setup to be able to compile the code (I only used Keil uvison before) because I saw in another thread that there might be problems if the version is different.

iliasam commented 6 months ago

I use IAR 7.50 for building this FW.

taliaxu09 commented 5 months ago

Sorry to bother you again, not very familiar with embedded coding..

I see that timer_1ms seems like the fastest time the timer can recognize, since the increment is ms_tick which ticks every ms? What would be the easiest way to change this to 0.1ms?

iliasam commented 5 months ago

Software counters, like "timer_1ms", are based on "ms_tick" variable, that is incremented in SysTick_Handler(), which is called by system timer with 1ms period. This timer is configured by SysTick_Config() function in "hardware.c". A lot of code here is expecting that this timer has 1ms period.

One option is use hardware CAPTURE_TIMER, that is used in "scanning_fw". It can generate interrupts with needed frequency.

Another way - you can use hardware_dwt_get() function, that return MCU tick count (72 ticks per 1us). You can see dwt_delay_us() function. But this kind of delay will lock program execution.

taliaxu09 commented 5 months ago

Thank you!