Reduce SPI speed?
Moderators: grovkillen, Stuntteam, TD-er
Reduce SPI speed?
Is there an ESPEasy function that allows me to change the SPI speed on a ESP32? I would like to slow it down. Because of pesky long-cable gremlins.
- Thomas
- Thomas
Re: Reduce SPI speed?
We have not made that configurable (yet). I'm quite sure some plugins (libraries mostly) try to change the speed to their 'desired' speed, so maybe we should override/inhibit that in some way.
What kind of long-cable lengths are you intending to use?
What kind of long-cable lengths are you intending to use?
/Ton (PayPal.me)
Re: Reduce SPI speed?
I assume some display in some coffee machine...
Re: Reduce SPI speed?
I've built the HVAC monitoring project I described last summer in this topic:
viewtopic.php?p=69774
I powered it up for the first time last night. Discovered what I feared, which is that my generously long SPI cables are a problem. Total cable length is 2.5 meters! That's an evil length.
There are three BMP390 sensors on the SPI buss, all thanks to ATH (Ton added BMP390 SPI support). All sensors are daisy chained on the same ribbon cable, each with its own chip select. Each sensor has 10K pullups on all signals, so total SPI bus terminations are 3.3K ohms.
I have confirmed that a much shorter ribbon cable length works fine. But then the sensors don't reach where they need to go.
My first thought is to slow down the SPI bus and see if it solves the issue without any hardware changes. It would certainly be a convenient solution.
- Thomas
viewtopic.php?p=69774
I powered it up for the first time last night. Discovered what I feared, which is that my generously long SPI cables are a problem. Total cable length is 2.5 meters! That's an evil length.
There are three BMP390 sensors on the SPI buss, all thanks to ATH (Ton added BMP390 SPI support). All sensors are daisy chained on the same ribbon cable, each with its own chip select. Each sensor has 10K pullups on all signals, so total SPI bus terminations are 3.3K ohms.
I have confirmed that a much shorter ribbon cable length works fine. But then the sensors don't reach where they need to go.
My first thought is to slow down the SPI bus and see if it solves the issue without any hardware changes. It would certainly be a convenient solution.
- Thomas
Re: Reduce SPI speed?
I can have a look at what's needed.
I don't think the SPI bus speed will be changed by any library as that's typically something that is too specific for the platform.
What ESP are you using? There are quite a lot of low-level differences between those ESP32-variants.
How are the CS lines wired?
Is it possible some of those may causing timing issues?
And how about possible reflections of the signal? You mention pull-up resistors per sensor. But I would expect it to be terminated at the end of the bus like you once needed to do for SCSI inserting those resistor arrays at the last device on the ribbon cable.
Another idea is to add like a 470 Ohm resistor in series with the signal.
I don't think the SPI bus speed will be changed by any library as that's typically something that is too specific for the platform.
What ESP are you using? There are quite a lot of low-level differences between those ESP32-variants.
How are the CS lines wired?
Is it possible some of those may causing timing issues?
And how about possible reflections of the signal? You mention pull-up resistors per sensor. But I would expect it to be terminated at the end of the bus like you once needed to do for SCSI inserting those resistor arrays at the last device on the ribbon cable.
Another idea is to add like a 470 Ohm resistor in series with the signal.
Re: Reduce SPI speed?
OK, I stand corrected, apparently you can change the SPI speed per call.
This does make it simpler to fix it for your use case.
However I think it would be a more intuitive approach if we add low/high speed option in the settings like we also do for I2C.
This does make it simpler to fix it for your use case.
However I think it would be a more intuitive approach if we add low/high speed option in the settings like we also do for I2C.
Re: Reduce SPI speed?
The current SPI clock is already quite low:
#define BMP3XX_DEFAULT_SPIFREQ (1000000) ///< The default SPI Clock speed
So unless I am really bad at counting zeroes, it is only 1 MHz.
Really not that much. Unless it is already below the minimum SPI frequency and the ESP code may set it to some different value.
#define BMP3XX_DEFAULT_SPIFREQ (1000000) ///< The default SPI Clock speed
So unless I am really bad at counting zeroes, it is only 1 MHz.
Really not that much. Unless it is already below the minimum SPI frequency and the ESP code may set it to some different value.
Re: Reduce SPI speed?
Thanks for looking at the code. 1 MHz is slow, but I'd take 50KHz if that was possible. When I have a chance I will check the SCK speed with the o-scope to see what is in effect.
I'm using the ESP32-DevKitC ESP32-WROOM-32U. The classic aliexpress $3 deal. Has been one of my favorite footprints.
Device chip selects are driven by GPIO5, GPIO16, and GPIO17. Nothing special about them, they are all in the ribbon cable. These are each terminated at the sensor with 10K ohms, which may need to to a smaller value.
I fully understand your remarks about terminations and their position. First implementation was to see if I could avoid modifying the sensors and use them as-is. I was hoping the sensor gods would be kind to me for once.
Solving reflections on high speed buses is something I've done many times in the past. But in this case I don't need the high speed, so that is why I asked if there was an ESPEasy function that allowed me to slow down the SPI bus. I don't mind fixes that require the soldering iron, but I love software solutions more.
All my bad news came late last night after I booted for the first time. So it appears I will need to spend some time with the o-scope.
BTW, one of the issues I face is that ESPEasy disables the SPI plugins when they don't successfully communicate. Is there a setting to turn-off this "plugin disable" feature so I can troubleshoot with the o-scope? I checked the Advanced Menu and didn't see such a thing.
- Thomas
I'm using the ESP32-DevKitC ESP32-WROOM-32U. The classic aliexpress $3 deal. Has been one of my favorite footprints.
Device chip selects are driven by GPIO5, GPIO16, and GPIO17. Nothing special about them, they are all in the ribbon cable. These are each terminated at the sensor with 10K ohms, which may need to to a smaller value.
I fully understand your remarks about terminations and their position. First implementation was to see if I could avoid modifying the sensors and use them as-is. I was hoping the sensor gods would be kind to me for once.
Solving reflections on high speed buses is something I've done many times in the past. But in this case I don't need the high speed, so that is why I asked if there was an ESPEasy function that allowed me to slow down the SPI bus. I don't mind fixes that require the soldering iron, but I love software solutions more.
All my bad news came late last night after I booted for the first time. So it appears I will need to spend some time with the o-scope.
BTW, one of the issues I face is that ESPEasy disables the SPI plugins when they don't successfully communicate. Is there a setting to turn-off this "plugin disable" feature so I can troubleshoot with the o-scope? I checked the Advanced Menu and didn't see such a thing.
- Thomas
Re: Reduce SPI speed?
Well I guess that last question of you is relatively easy to change as Ton did re-use code for both BME388 plugin versions and thus it might be that the I2C check also is applied to this plugin.
So you might want to uncheck "Check I2C devices when enabled" on the tools->Advanced page.
My first glance at the SPI code suggests the actual frequency might be higher as there is for sure some check to see if you're requesting a lower speed than supported and then return the lowest div factor.
So I guess it might be 26 or 40 MHz.
So you might want to uncheck "Check I2C devices when enabled" on the tools->Advanced page.
My first glance at the SPI code suggests the actual frequency might be higher as there is for sure some check to see if you're requesting a lower speed than supported and then return the lowest div factor.
So I guess it might be 26 or 40 MHz.
Re: Reduce SPI speed?
Oh and can you try other pins, other than GPIO 16/17?
Those sometimes can send out really high frequency stuff as they are internally also used for PSRAM. However if this is never found, there still might be some 80 MHz activity on them.
And there was something with GPIO-5 too on the ESP32...
It does have an internal pull-up
https://espeasy.readthedocs.io/en/lates ... e-on-esp32
Those sometimes can send out really high frequency stuff as they are internally also used for PSRAM. However if this is never found, there still might be some 80 MHz activity on them.
And there was something with GPIO-5 too on the ESP32...
It does have an internal pull-up
https://espeasy.readthedocs.io/en/lates ... e-on-esp32
Re: Reduce SPI speed?
Scope reports SCK is 1MHz.
Unchecking "Check I2C devices when enabled" did not work out.
Thanks for the tips on the GPIO usage. I will try different pins and see what happens.
- Thomas
Unchecking "Check I2C devices when enabled" did not work out.
Thanks for the tips on the GPIO usage. I will try different pins and see what happens.
- Thomas
Re: Reduce SPI speed?
Just changed the define I mentioned before, so we have to see if it will work anyway.
https://github.com/letscontrolit/ESPEasy/pull/5223
Can you test this test build? https://github.com/letscontrolit/ESPEas ... 2715882334
It was suggested [here](https://github.com/espressif/arduino-es ... 2412296693) that 100 kHz might also work...
well seems to depend on silicon generation, but worth a test I guess.
https://github.com/letscontrolit/ESPEasy/pull/5223
Can you test this test build? https://github.com/letscontrolit/ESPEas ... 2715882334
It was suggested [here](https://github.com/espressif/arduino-es ... 2412296693) that 100 kHz might also work...
well seems to depend on silicon generation, but worth a test I guess.
Re: Reduce SPI speed?
That's good, there's no connection between this I2C feature and your SPI plugin being disabled. Does the device reboot during use? As that's the only other reason for plugins getting disabled.
/Ton (PayPal.me)
Re: Reduce SPI speed?
The device does not reboot. The plugins refuse to be enabled when the long cable is used. No problem on a short cable.
I will try your modified code. Fingers are crossed that slow clocking does the trick.
- Thomas
I will try your modified code. Fingers are crossed that slow clocking does the trick.
- Thomas
Re: Reduce SPI speed?
Please also check what frequency is actually set.
It is likely not exactly 100 kHz.
It is likely not exactly 100 kHz.
Re: Reduce SPI speed?
Thanks for the custom test code. I confirmed it sets the SPI clock to 100KHz.
But no joy. However, the slower clock will help during the initial troubleshooting.
My TEK scope (TEK2245A) is just not up to the task, because it's analog. And my Chinese (Owon) digital scope is starting to fail, contrast is really bad. So I might shop for a new scope this weekend.
One step forward, two steps back.
- Thomas
But no joy. However, the slower clock will help during the initial troubleshooting.
My TEK scope (TEK2245A) is just not up to the task, because it's analog. And my Chinese (Owon) digital scope is starting to fail, contrast is really bad. So I might shop for a new scope this weekend.
One step forward, two steps back.
- Thomas
Re: Reduce SPI speed?
Just to give a face to what I am working on, here is a photo. It shows the three pressure sensor probes. The BMP390 is at the tip of each probe, all connected by evil long cables.
Re: Reduce SPI speed?
Owon scope and failing is something I can also talk about from experience.
My XDS3064E is now next to impossible to operate as there seems to be something triggering changes on some button and/or touchscreen.
I recently bought the SDS824X HD, which is really a pleasure to operate.
And you can also operate it from your browser as it has some kind of VNC like interface to it.
There seems to be some tool floating around to transform the SDS804X HD into the SDS824X HD as even the memory depth and bandwidth seems to be the same on all units but just software locked and since you expressed a preference for a software 'fix'...
The 804 doesn't come with 200 MHz probes, but those aren't that expensive.
I did print a VESA mount to it and it is now mounted to a monitor stand on my desk as that was easier to manage (and has more room...)
My XDS3064E is now next to impossible to operate as there seems to be something triggering changes on some button and/or touchscreen.
I recently bought the SDS824X HD, which is really a pleasure to operate.
And you can also operate it from your browser as it has some kind of VNC like interface to it.
There seems to be some tool floating around to transform the SDS804X HD into the SDS824X HD as even the memory depth and bandwidth seems to be the same on all units but just software locked and since you expressed a preference for a software 'fix'...
The 804 doesn't come with 200 MHz probes, but those aren't that expensive.
I did print a VESA mount to it and it is now mounted to a monitor stand on my desk as that was easier to manage (and has more room...)
Re: Reduce SPI speed?
The SDS804X HD is a good value. I'll check out the million YouTube o-scope review videos and see if the lower cost alternatives are good enough for my needs. No longer a working engineer, now a retired citizen with a small checkbook.
- Thomas
- Thomas
Re: Reduce SPI speed?
The 804 also has 12 bit ADC and like I said the 100 Mpt sample depth is present on the cheaper models, only 50 Mpt enabled by default.
Previously you had to buy licenses for protocol decoding, but those are now included if you update to the latest firmware. (maybe first set those other 'flags' so the scope thinks it is the 824, though on EEVblog people claim the order doesn't seem to matter)
Price difference with the previous generation SDS1104X-U is about 75 euro less, but then you have only 14 Mpt. and 8 bit ADC
Rigol DHO804 might also offer a nice price/spec ratio and is currently being sold (in NL) for 384 euro inc.VAT.
https://www.eleshop.nl/rigol-dho804-oscilloscoop.html
Previously you had to buy licenses for protocol decoding, but those are now included if you update to the latest firmware. (maybe first set those other 'flags' so the scope thinks it is the 824, though on EEVblog people claim the order doesn't seem to matter)
Price difference with the previous generation SDS1104X-U is about 75 euro less, but then you have only 14 Mpt. and 8 bit ADC
Rigol DHO804 might also offer a nice price/spec ratio and is currently being sold (in NL) for 384 euro inc.VAT.
https://www.eleshop.nl/rigol-dho804-oscilloscoop.html
Re: Reduce SPI speed?
After digging into it, I found that the Rigol DHO804 and Siglent SDS804X are near twins in performance and price. Online discussions usually mention the Rigol is the latest favorite. Either choice would be more than I need for my DiY projects.
But I'm not in love with spending $475 USD (scope, tax, shipping). If I can't get my OWON to work (I've repaired it a couple of times), I will see about selling a kidney. That might get me enough cash to fund a new scope.
I will be moving the chip select GPIO's to "better" pins. I don't expect this to help, but it needs to be evaluated. Then I'm on to scope probing and general hair pulling.
Lastly, thanks for helping out with the custom firmware. I still think it would be nice to have an SPI speed feature, like ESPEasy's I2C provides. And a way to turn off the SPI plugin auto-disable function too. Just wish list things, not critical.
- Thomas
But I'm not in love with spending $475 USD (scope, tax, shipping). If I can't get my OWON to work (I've repaired it a couple of times), I will see about selling a kidney. That might get me enough cash to fund a new scope.
I will be moving the chip select GPIO's to "better" pins. I don't expect this to help, but it needs to be evaluated. Then I'm on to scope probing and general hair pulling.
Lastly, thanks for helping out with the custom firmware. I still think it would be nice to have an SPI speed feature, like ESPEasy's I2C provides. And a way to turn off the SPI plugin auto-disable function too. Just wish list things, not critical.
- Thomas
Re: Reduce SPI speed?
I did hook up some ESP (the C6 was apparently on top of the pile on my desk) to the scope here.
I got the extra 16-channel logic analyzer option too, but still had not tried using it since I bought this scope 2 weeks ago.
So testing SPI and the decoding options would be a good start to getting to know the tool.
Anyway, I hooked up as many pins as I could fit on the 16 channels.
Then I had my "hmm that's odd" moment... As you can see, the MOSI signal is on 2 pins.
I already had a talk with someone from Espressif and it seems that if you use 'custom' SPI pins, you might still see the original signal on the default pins.
The default SPI pins are not routed through the MUX, but when you use a custom SPI pin setting, they are routed through the MUX.
I guess at higher speeds, you may see degradation of the signal if it is done like that (present on multiple pins).
So I will have a look at it tomorrow to see if there is something I can do at a low level to the signal. (already found some 'drive strength' registers too)
Do you use the 'default' pins for SPI or do you have some custom SPI pinout?
I got the extra 16-channel logic analyzer option too, but still had not tried using it since I bought this scope 2 weeks ago.
So testing SPI and the decoding options would be a good start to getting to know the tool.
Anyway, I hooked up as many pins as I could fit on the 16 channels.
Then I had my "hmm that's odd" moment... As you can see, the MOSI signal is on 2 pins.
I already had a talk with someone from Espressif and it seems that if you use 'custom' SPI pins, you might still see the original signal on the default pins.
The default SPI pins are not routed through the MUX, but when you use a custom SPI pin setting, they are routed through the MUX.
I guess at higher speeds, you may see degradation of the signal if it is done like that (present on multiple pins).
So I will have a look at it tomorrow to see if there is something I can do at a low level to the signal. (already found some 'drive strength' registers too)
Do you use the 'default' pins for SPI or do you have some custom SPI pinout?
Re: Reduce SPI speed?
I'm using the standard VSPI layout. CLK=GPIO-18, MISO=GPIO-19, MOSI=GPIO-23
My analog scope shows that the 100KHz CLK signal looks good. But syncing on MISO and MOSI is not practical with this scope. I haven't had a chance to use my fussy OWON digital scope yet.
The 'drive strength' registers sound interesting. Scotty, I need more power!
- Thomas
My analog scope shows that the 100KHz CLK signal looks good. But syncing on MISO and MOSI is not practical with this scope. I haven't had a chance to use my fussy OWON digital scope yet.
The 'drive strength' registers sound interesting. Scotty, I need more power!
- Thomas
Re: Reduce SPI speed?
Moved the BMP390 chip selects from GPIO16/GPIO17 to GPIO21/GPIO22. Left the GPIO5 as-is. No improvement.
Looked further into my OWON o-scope display issue. It appears that the plastic lens has deteriorated and contaminated the LCD (or vice versa). Only the screen edges are clear. This has been a slow progression that began a few years ago.
It is not worth saving and is now going to the recycler. I will need to buy a new scope to continue the troubleshooting. Soon will be putting bags of ice in the bathtub in preparation for the kidney removal. I don't know if "vintage" organs have any value, but about to find out.
- Thomas
Looked further into my OWON o-scope display issue. It appears that the plastic lens has deteriorated and contaminated the LCD (or vice versa). Only the screen edges are clear. This has been a slow progression that began a few years ago.
It is not worth saving and is now going to the recycler. I will need to buy a new scope to continue the troubleshooting. Soon will be putting bags of ice in the bathtub in preparation for the kidney removal. I don't know if "vintage" organs have any value, but about to find out.
- Thomas
Re: Reduce SPI speed?
Maybe there is some local Facebook group for collectors of 'vintage kidneys', or maybe it is called 'retro'.
Is it going to be the left or the right one?
Is it going to be the left or the right one?
Re: Reduce SPI speed?
By the way, looking at the display, it looks like the LCD may have been exposed to a DC voltage.
If so, then the display is beyond repair, as the crystals have been damaged.
If it were just the plastics and/or the polarization filters, then using polaroid glasses or some polarization filter from an old LCD may show improvements (probably still not usable though)
If so, then the display is beyond repair, as the crystals have been damaged.
If it were just the plastics and/or the polarization filters, then using polaroid glasses or some polarization filter from an old LCD may show improvements (probably still not usable though)
Re: Reduce SPI speed?
Another idea just to test...
Can you wire up one BME388 using Ethernet cable?
I thing you should use each signal with GND in a pair.
The wiring per pair in Ethernet cable should differ (due to different windings per meter), but on such short distances it shouldn't really matter.
At least this will eliminate external disturbances.
This used to work also on those UW-SCSI cables back in the day and those sometimes were also quite long. I think it was still single-ended signalling as you could use UW to 50-pin passive connectors to connect your older SCSI devices to the same UW cable.
Can you wire up one BME388 using Ethernet cable?
I thing you should use each signal with GND in a pair.
The wiring per pair in Ethernet cable should differ (due to different windings per meter), but on such short distances it shouldn't really matter.
At least this will eliminate external disturbances.
This used to work also on those UW-SCSI cables back in the day and those sometimes were also quite long. I think it was still single-ended signalling as you could use UW to 50-pin passive connectors to connect your older SCSI devices to the same UW cable.
Re: Reduce SPI speed?
I had considered using CAT5 cable for the sensors, with the three SPI bus signals set up as grounded twisted pairs. But decided on the ribbon cables instead since that method has worked for me in the past. But never with such a long cable that has three sensors at different locations along it.
Before I decide on any hardware changes I need to see what I'm dealing with. Which requires an o-scope.
I'm leaning towards the Rigol DHO804 since their DHO80X series is a very popular choice, per all the YouTube review videos. EEVBlog is a fanboy of Rigol and he created a one hour review with good info.
I've decided to keep my kidneys and instead raise funds by mowing lawns. At $2 per cut, I should have the cash for my scope soon.
- Thomas
Before I decide on any hardware changes I need to see what I'm dealing with. Which requires an o-scope.
I'm leaning towards the Rigol DHO804 since their DHO80X series is a very popular choice, per all the YouTube review videos. EEVBlog is a fanboy of Rigol and he created a one hour review with good info.
I've decided to keep my kidneys and instead raise funds by mowing lawns. At $2 per cut, I should have the cash for my scope soon.
- Thomas
Re: Reduce SPI speed?
Hmm since we both live at the same (northern) halve of the planet, I doubt there will be much lawns to mow right now.
Depending on where you are in the States, you either have to dig through a lot of snow, or there is no grass left.
Depending on where you are in the States, you either have to dig through a lot of snow, or there is no grass left.
Re: Reduce SPI speed?
Looking back, the main reason I didn't use Ethernet cable is because it doesn't have enough wires for what I had in mind. Including power, there are 8 wires needed to handle the three sensors. So no spares to act as pseudo shields on the three SPI signals.
Drat, forgot about grass doesn't need to be cut in the winter; My plans have been spoiled again. So I ordered a money making how-to book from Amazon: TikTok Influencer for Dummys.
Oh wait, the US government is banning TikTok next week. Geez, all the good ideas are taken.
- Thomas
Drat, forgot about grass doesn't need to be cut in the winter; My plans have been spoiled again. So I ordered a money making how-to book from Amazon: TikTok Influencer for Dummys.
Oh wait, the US government is banning TikTok next week. Geez, all the good ideas are taken.
- Thomas
Re: Reduce SPI speed?
You could have seen that one coming...
Had a small windfall coming my way last month, so I ordered that Rigol DHO804 today. Should arrive early next week. (Sold my ~40 year old analog o-scope a couple of years a go, but since working on ESPEasy, having a scope might come in handy )
/Ton (PayPal.me)
Re: Reduce SPI speed?
Well if you need to make plans based on the US government, then I don't know when you will be able to plan anything.
I'm still surprised he didn't suggest to call the Gulf of Mexico the "TrumpGulf" and plans to put a ban + tarrifs on hurricanes as they are not good for US finances.
Anyway...
About your Ethernet cable lack of cables.
The CE lines are "active low", thus essentially pulled to GND when active.
So what you can do is let those run till the end of the bus and terminate them using a resistor to 3V3 so they are pulled up unless individually pulled down by the ESP.
Those CE lines can then be "the other" wire in the pair for CLK, MISO, MOSI.
Leaves 2 wires in a pair for VCC and GND.
The other wire in those high frequency pairs doesn't have to be GND, as long as it is just a stable DC level.
I'm still surprised he didn't suggest to call the Gulf of Mexico the "TrumpGulf" and plans to put a ban + tarrifs on hurricanes as they are not good for US finances.
Anyway...
About your Ethernet cable lack of cables.
The CE lines are "active low", thus essentially pulled to GND when active.
So what you can do is let those run till the end of the bus and terminate them using a resistor to 3V3 so they are pulled up unless individually pulled down by the ESP.
Those CE lines can then be "the other" wire in the pair for CLK, MISO, MOSI.
Leaves 2 wires in a pair for VCC and GND.
The other wire in those high frequency pairs doesn't have to be GND, as long as it is just a stable DC level.
Re: Reduce SPI speed?
Everyone gets a new 4-channel digital scope but me.
Using the three /CE for the three phantom grounds is better than nothing. Ideally I would use a ribbon cable with grounds on each side of every signal. That was a typical solution used in the olden days on bus'd devices. And I've got a lot of ribbon cable on 100' rolls. But it's too soon to decide on a solution.
Wait a minute... That's it, I can sell some rolls of ribbon cable and pay for the o-scope with the pile of cash I get. Problem solved.
- Thomas
Using the three /CE for the three phantom grounds is better than nothing. Ideally I would use a ribbon cable with grounds on each side of every signal. That was a typical solution used in the olden days on bus'd devices. And I've got a lot of ribbon cable on 100' rolls. But it's too soon to decide on a solution.
Wait a minute... That's it, I can sell some rolls of ribbon cable and pay for the o-scope with the pile of cash I get. Problem solved.
- Thomas
Re: Reduce SPI speed?
Well I had to pay for it myself...
However I got a bargain as I only had to sign away my singing voice and got some nice legs too in return... oh wait, that was another deal... Have to look back how I paid for it.
Oh nope, I remember, just had to swipe one of those pieces of plastic. Genius concept of free money
Can't you stick the ribbon cable to a metal air duct or something?ThomasB wrote: ↑11 Jan 2025, 23:14 Using the three /CE for the three phantom grounds is better than nothing. Ideally I would use a ribbon cable with grounds on each side of every signal. That was a typical solution used in the olden days on bus'd devices. And I've got a lot of ribbon cable on 100' rolls. But it's too soon to decide on a solution.
Wait a minute... That's it, I can sell some rolls of ribbon cable and pay for the o-scope with the pile of cash I get. Problem solved.
- Thomas
However adding too much ground wires/planes will increase the capacitance of the cable and thus cause shark-tooth waveforms.
Re: Reduce SPI speed?
I mostly expect to find horrible shark tooth waveforms due to the long cable's capacitance. Hoping to find magic terminating resistor values to square things up.However adding too much ground wires/planes will increase the capacitance of the cable and thus cause shark-tooth waveforms.
I have good news. Found one of those in my wife's purse. I can use it to order the scope. But first I have to stop at the horse races.Oh nope, I remember, just had to swipe one of those pieces of plastic.
Re: Reduce SPI speed?
My analog scope is not a great tool for SPI debugging, but did some more measurements with it. It appears that the SDI (data in) signal has crosstalk from SCK (clock). They are adjacent signals in the ribbon cable.
I will wait for a better o-scope before experimenting with different pull-up resistors. I have a gut feeling that I'll need to also change the cable layout going to the sensors. Probably include ground/guard wires between each bus signal.
- Thomas
I will wait for a better o-scope before experimenting with different pull-up resistors. I have a gut feeling that I'll need to also change the cable layout going to the sensors. Probably include ground/guard wires between each bus signal.
- Thomas
Re: Reduce SPI speed?
I just was doing some tests on the scope to see what the effect was of loose ground.
So like using a probe and a BNC coax cable to connect 2 channels of the signal generator and check their signals on the scope.
The ground was connected via the BNC coax cable, but as soon as you disconnect the GND of the scope probe, there isn't much left of the square wave. Even at low frequencies of 1 MHz.
So I guess you really should keep some GND or at least some clearly defined DC offset close.
So like using a probe and a BNC coax cable to connect 2 channels of the signal generator and check their signals on the scope.
The ground was connected via the BNC coax cable, but as soon as you disconnect the GND of the scope probe, there isn't much left of the square wave. Even at low frequencies of 1 MHz.
So I guess you really should keep some GND or at least some clearly defined DC offset close.
Re: Reduce SPI speed?
Today I made all new ribbon cables that had ground wires between the SPI signals. Now the two sensors that are furthest away from the ESP32 are working. That's an improvement, but I need all three sensors to work.
I was hoping to fully solve things with this "parts cannon" fix. So I could delay the o-scope purchase until I landed some lucrative lawn mowing jobs. But looks like I need to act sooner.
I plan to get the Rigol DHO804. It was recently available for $373 USD on Amazon, but currently going for $439. I'm going to watch the price for a few days to see if the lower price comes back.
- Thomas
I was hoping to fully solve things with this "parts cannon" fix. So I could delay the o-scope purchase until I landed some lucrative lawn mowing jobs. But looks like I need to act sooner.
I plan to get the Rigol DHO804. It was recently available for $373 USD on Amazon, but currently going for $439. I'm going to watch the price for a few days to see if the lower price comes back.
- Thomas
Re: Reduce SPI speed?
And what if you swap the 2 sensors between the ESP and the last one on the bus?
Just to make sure it isn't a loose wire like the CS to the one closest to the ESP.
Just to make sure it isn't a loose wire like the CS to the one closest to the ESP.
Who is online
Users browsing this forum: Google [Bot] and 0 guests