New Ping with STM32F412Vx
Hi Tim, I’ve tried multiple attempts to get the STM32F4xx working with the New Ping by making suitable changes yet failed every time.
Since the above lib. does support the particle ( Photon & Electron ) devices which use STM32F2xx, I would like to get help in understanding how can I make this work. Any guidance from you will be highly appreciated.
Comments (16)
-
repo owner -
Account Deactivated reporter Yes, Tim!
-
Account Deactivated reporter - attached NewPing.h
- attached NewPing.cpp
<div class="preview-container wiki-content"><!-- loaded via ajax --></div> <div class="mask"></div> </div>
</div> </form>
-
Account Deactivated reporter Attached are the files with modification as per STM32F4xx series
-
Account Deactivated reporter I need the sonar.check_timer method to be working with STM32F4 series. Hence cannot do the following :
#define TIMER_ENABLED false
-
Account Deactivated reporter - changed status to resolved
The NewPing library was modified to work with STM32F4 series
-
repo owner @{5c836343039b847f6a384e5c} If you could test this branch with your changes:
https://bitbucket.org/teckel12/arduino-new-ping/src/STM32F412Vx/src/
-
repo owner - changed status to open
-
Account Deactivated reporter Made few changes.
Hardware testing yet to be done.
-
Account Deactivated reporter Hi Tim,
We tested the branch with the hardware and it is working well with the STM32F412Vx board. Also we added one more additional board i.e., STM32F411VE-DISCOVERY which is working as well.
Attached
-
Account Deactivated reporter - attached NewPing.cpp
- attached NewPing.h
<div class="preview-container wiki-content"><!-- loaded via ajax --></div> <div class="mask"></div> </div>
</div> </form>
-
Account Deactivated reporter However, in both the boards, sonar ( Gravity - URM09 ) doesn’t work when connected to pins PA7, PC2 and PC4 but works with the pins PA0, PB0, PC0.
Code attached below for the same
-
Account Deactivated reporter - attached URM09_Gravity.ino
<div class="preview-container wiki-content"><!-- loaded via ajax --></div> <div class="mask"></div> </div>
</div> </form>
-
repo owner - marked as trivial
-
repo owner I see a few problems with your code.
First, you shouldn’t be using the same pin for trigger and echo. That should be two different pins. There’s only certain microcontrollers and sensors that will work with one pin. Only a few sensors will work this way. Others may work if you add a capacitor, but that again is hit or miss. So, NEVER use a single pin! Do ALL of your testing using two pins, as the sensor was designed. Only after everything is working 100% would you EVER try to use a single pin. Just don’t do that, you’re making things MUCH harder on yourself as a result.
Secondly, why the heck are you using the 15 Sensors Example Sketch as your code base? Have you read the warnings? It’s right in the top or code! Basically, my MANY warnings say to NOT use the 15 Sensor sketch! As all my warnings say, use the 3 Sensor Sketch example instead:
https://bitbucket.org/teckel12/arduino-new-ping/wiki/Home#!ping-3-sensors-sketch
I have no idea why everyone always wants to make things more difficult by using the 15 sensor example instead of the 3 sensor example when I give warning after warning! Please people, stop doing what I’m telling you NOT to do!
Anyway, your problems are directly due to not following the instructions. No code will be changed or further time wasted if you can’t be bothered by reading the instructions and MANY warnings. Good luck, you’re on your own.
-
repo owner - changed status to resolved
User is not following the instructions. Is trying to use a single pin instead of 2 pins and is using an example sketch which is FILLED with warnings on not using it, but using a different example sketch instead. The problems are directly related to not following instructions.
Closed.
- Log in to comment
Have you tried changing the NewPing.h file, line 170 from:
#define TIMER_ENABLED true
to:
#define TIMER_ENABLED false