AngelMarc wrote: Sun Jun 08, 2025 5:40 am High speed square waves from a 32u4 (also 5 volt) start looking rounded. I don't remember what frequency that's noticable, but I don't see it at stupid speeds with the ESP32 S3 or the Pi Pico.
Help needed, crank signal generator. <solved>
-
MPC001
- Posts: 174
- Joined: Sat May 05, 2018 11:41 am
Re: Help needed, crank signal generator. <solved>
That's interesting thankyou. Will keep an eye on the CRO etc. Though only shooting for a stable 8k rpm as the E40 (& E38) stop at 8,192 rpm. 
-
MPC001
- Posts: 174
- Joined: Sat May 05, 2018 11:41 am
Re: Help needed, crank signal generator. <solved>
Thanks Antus. I'll keep that in mind as well.
-
antus
- Site Admin
- Posts: 10012
- Joined: Sat Feb 28, 2009 10:34 am
- cars: TX Gemini 2L Twincam 8psi
TX Gemini SR20 18psi
Datsun 1200 Ute
Subaru Blitzen '06 EZ30 4th gen, 3.0R Spec B
Subaru WRX 2007
Re: Help needed, crank signal generator. <solved>
This is an analog world thing, to do with the capacitance in the wire or the trace/wire and filtering. Many people are not aware of it because they are looking at signals in a logic level device, but when you look on a scope you'll always see some level of rounding. The aim is to have the analog electronics built to the level that it is resistant enough to interference, and the signal passes the trigger point on the digital time scale at a usable time. In most cases this is the case out of the box, but if you start having trigger problems under certain circumstances this is something to investigate and consider.AngelMarc wrote: Sun Jun 08, 2025 5:40 am High speed square waves from a 32u4 (also 5 volt) start looking rounded. I don't remember what frequency that's noticable, but I don't see it at stupid speeds with the ESP32 S3 or the Pi Pico.
Have you read the FAQ? For lots of information and links to significant threads see here: http://pcmhacking.net/forums/viewtopic.php?f=7&t=1396
-
AngelMarc
- Posts: 612
- Joined: Sat Apr 08, 2023 11:23 am
- cars: A CB450 running to 8,000RPM with a P59.
Re: Help needed, crank signal generator. <solved>
There's also a term called slew rate that has nothing to do with interference.
Don't stress specific units.
-
MPC001
- Posts: 174
- Joined: Sat May 05, 2018 11:41 am
Re: Help needed, crank signal generator. <solved>
Moved on from 16Mhz NANO which was a little unstable @ +/- 150 rpm at ~8,000 rpm to 120/133Mhz PICO.
+/- 150-200 rpm @ 8,000 seems to stay inside the crk/cam error detection logic.
Re tested with PICO 3 methods to generate 24x waveforms:
1. AngelMarc's posted P59.ino 24 cell array method (still yet to understand exactly how this works - more work to do.)
2. 240 cell array with 3 degree stepping.
3. Timer per tooth period. (many more lines of code than 1 & 2.)
All have similar improved stability of about +/- 35rpm, but method 1 is the most stable at around 8,000 rpm.
After trying a TXS0108E 3.3 > 5V level shifter chip to get a 5V sig feeding crank & cam inputs, and finding similar randomness gremlins with these as many others do , I tried direct 3.3v from Pico pin to E40 crk/cam inputs and they run fine with the inputs at 3.3v it seems.
Now to see how stable a 600Mhz Teensy 4.0 can do these waveforms.
+/- 150-200 rpm @ 8,000 seems to stay inside the crk/cam error detection logic.
Re tested with PICO 3 methods to generate 24x waveforms:
1. AngelMarc's posted P59.ino 24 cell array method (still yet to understand exactly how this works - more work to do.)
2. 240 cell array with 3 degree stepping.
3. Timer per tooth period. (many more lines of code than 1 & 2.)
All have similar improved stability of about +/- 35rpm, but method 1 is the most stable at around 8,000 rpm.
After trying a TXS0108E 3.3 > 5V level shifter chip to get a 5V sig feeding crank & cam inputs, and finding similar randomness gremlins with these as many others do , I tried direct 3.3v from Pico pin to E40 crk/cam inputs and they run fine with the inputs at 3.3v it seems.
Now to see how stable a 600Mhz Teensy 4.0 can do these waveforms.
-
AngelMarc
- Posts: 612
- Joined: Sat Apr 08, 2023 11:23 am
- cars: A CB450 running to 8,000RPM with a P59.
Re: Help needed, crank signal generator. <solved>
I ran mine with a TC4452V MOSFET driver, if you care to know and didn't see that. 12 volts pulled from PC power supply. On the P59.
I don't know if you could have a current draw issue that fries the Pico's output. Pi Pico is used in a Gamecube mod where one wire goes to 2 of its pins, I suspect for that reason; but never found out for sure why.
And are you looking at output on an oscilloscope, or relying on ECU reported numbers. The P59 shits itself above 8,000 RPM signal, I don't know where the P01 and E40 fall apart.
The signal should look pretty good even at 100,000RPM
I've been using a VDS1022 USB oscilloscope. Cost me $100. Seen somebody test it on a 14MHz signal and decided it was plenty good. The cheapest PicoScope (no relation) isn't good enough.
I don't know if you could have a current draw issue that fries the Pico's output. Pi Pico is used in a Gamecube mod where one wire goes to 2 of its pins, I suspect for that reason; but never found out for sure why.
And are you looking at output on an oscilloscope, or relying on ECU reported numbers. The P59 shits itself above 8,000 RPM signal, I don't know where the P01 and E40 fall apart.
The signal should look pretty good even at 100,000RPM
I've been using a VDS1022 USB oscilloscope. Cost me $100. Seen somebody test it on a 14MHz signal and decided it was plenty good. The cheapest PicoScope (no relation) isn't good enough.
Last edited by AngelMarc on Wed Jun 11, 2025 6:18 am, edited 2 times in total.
Don't stress specific units.
-
AngelMarc
- Posts: 612
- Joined: Sat Apr 08, 2023 11:23 am
- cars: A CB450 running to 8,000RPM with a P59.
Re: Help needed, crank signal generator. <solved>
Might help to keep track of the flagsMPC001 wrote: Wed Jun 11, 2025 4:31 am
1. AngelMarc's posted P59.ino 24 cell array method (still yet to understand exactly how this works - more work to do.)
half done, done, and math
If statements, but they work like 3 separate loops. Loops through until conditions are met, then sets its own flag invalid and triggers another loop, in a specific order. math loop, then halfdone, then done
Math =1 means do it, but halfdone and done = 1 means they're already done, move on. As i went, that's just the choices I made to keep track in my head.
Don't stress specific units.
-
MPC001
- Posts: 174
- Joined: Sat May 05, 2018 11:41 am
Re: Help needed, crank signal generator. <solved>
Thanks Marc, appreciate the tips. Will get there !AngelMarc wrote: Wed Jun 11, 2025 6:12 amMight help to keep track of the flagsMPC001 wrote: Wed Jun 11, 2025 4:31 am
1. AngelMarc's posted P59.ino 24 cell array method (still yet to understand exactly how this works - more work to do.)
half done, done, and math
If statements, but they work like 3 separate loops. Loops through until conditions are met, then sets its own flag invalid and triggers another loop, in a specific order. math loop, then halfdone, then done
Math =1 means do it, but halfdone and done = 1 means they're already done, move on. As i went, that's just the choices I made to keep track in my head.
-
MPC001
- Posts: 174
- Joined: Sat May 05, 2018 11:41 am
Re: Help needed, crank signal generator. <solved>
Yes I noted the MOSFET you are using thankyou!AngelMarc wrote: Wed Jun 11, 2025 5:04 am I ran mine with a TC4452V MOSFET driver, if you care to know and didn't see that. 12 volts pulled from PC power supply. On the P59.
I don't know if you could have a current draw issue that fries the Pico's output. Pi Pico is used in a Gamecube mod where one wire goes to 2 of its pins, I suspect for that reason; but never found out for sure why.
And are you looking at output on an oscilloscope, or relying on ECU reported numbers. The P59 shits itself above 8,000 RPM signal, I don't know where the P01 and E40 fall apart.
The signal should look pretty good even at 100,000RPM
I've been using a VDS1022 USB oscilloscope. Cost me $100. Seen somebody test it on a 14MHz signal and decided it was plenty good. The cheapest PicoScope (no relation) isn't good enough.
The E40 sinks around 33uA (vs E38 4mA) @ crk & cam inputs.
Scanning rpm from E40 over CAN. Limit of ECM is 8,192 & it hard stops there. I saw your VDS1022 & have been researching it. Currently I have an old handheld oscilloscope with a little LCD readout. USB scope looks much better & easier to see & use.
-
AngelMarc
- Posts: 612
- Joined: Sat Apr 08, 2023 11:23 am
- cars: A CB450 running to 8,000RPM with a P59.
Re: Help needed, crank signal generator. <solved>
Just the driver, used as the level shifter, no discrete MOSFET.MPC001 wrote: Wed Jun 11, 2025 3:09 pm Yes I noted the MOSFET you are using thankyou!
The E40 sinks around 33uA (vs E38 4mA) @ crk & cam inputs.
Scanning rpm from E40 over CAN. Limit of ECM is 8,192 & it hard stops there. I saw your VDS1022 & have been researching it. Currently I have an old handheld oscilloscope with a little LCD readout. USB scope looks much better & easier to see & use.
33uA... I think that's high for some ARM/3.3V uControllers.
P59 cut coms at about 9,000, but it sort of still tries even at 20,000; output is a mess at that point though.
What sold me on that scope
https://www.youtube.com/watch?v=1ec1n9ScGTw Particularly starting at about 41:47, looking at signals in the MHz range.
You do not have the required permissions to view the files attached to this post.
Don't stress specific units.