-
-
Notifications
You must be signed in to change notification settings - Fork 16
GIGA: after merging previous changes: SPI1.transfer hangs board #64
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Will attest the amount of time that went into debugging. But as @KurtE said learned a lot more. about how things work. BTW this is related to this post and the following posts: #4 (comment) |
resolves: arduino#64 Removed the pins logical Arduino pins 11-13 from the PWM pin list, plus their defines for the timers. With these defines in place, the pins Alternate Function settings were set to that of the timers versus the SPI value (5) Note: This was done by @mjs513 and myself.
Aargh - ran into this again. My current branch did not include this PR so my quick and dirty test to Took me awhile to debug enough to remember this issue/pr... Some of the device tree stuff is a real PIA! When the device tree has multiple subsystems that can use the same pins, how does This is one example, where a pin can be used for SPI or could be used for PWM, or could be used for simple GPIO. It appears, that the system handles the case for switching the pin to GPIOs MODER register to 00 or 01 depending on Input versus Output. But it does not do this for analogRead (switch back to default 0x3). And I don't believe anywhere it will switch pins used for alternate functions. to 0x2 and the AFL registers, to the appropriate value. Or maybe the fully linked stuff? |
Hello guys and sorry for the silence, we've been a little swamped by the release of 4.1 - a few more days and we will be right back! Yes, the linked PR will help a lot, since Zephyr has never needed to "de-init" something. After all, when designing a board you should know what devices you attached to each pin, right? 🤣 So... for Zephyr a DT should never describe multiple conflicting devices. That's basically "our problem" to handle, but after that PR, if we manage the init/deinit in |
Thanks @pillo79, Will be good to get some feedback on some of the issues we have run into plus reviews of some updates.
That would be good. It will also be interesting to see how it impacts other sub-systems. Example: PWM (analogWrite), But we also ran into issues with analogRead in that if the pin is configured for anything else, the reads do not work. That is the I tried a hack in a sketch, where I:
Which did go through and switch the mode, but it still did not appear to work. Thanks again |
After this last batch of Pull Requests, several of my sketches failed to run. They would hang or look like a reboot
when SPI1.tranfer was called. SPI worked but SPI1 did not.
Most of the time I was using a real simple sketch to debug
I am not sure if anyone would want to see all of the debug stuff I put into the zephyr spi code:
spi_ll_stm32.zip
But included it just in case.
We found that it hung in the function:
in the while (!ll_func_rx_is_not_empty(cfg->spi)) ...
A debug output run:
I also have had it running with Logic Analyzer hooked up to pins 10-13, and only pin 10 showed anything.
So I wondered about what were the IO pins for SPI1 configured for:
So I added the following to the start of the transfer code... Actually to the start of the ISR...
I ran the sketch using only SPI1, but the output was shown above, but:
SPI pins: 5 5 5 : SPI1 2 3 1
The SPI (spi1) pins make sense as the Alternate functions for those pins are:
The one for SPI1 (spi5) - don't, need to double check pin 13s one but the other two are timers
Then remembered that these pins were added to the PWM list, and I am guessing probably all of the pins from pin2-13
currently have their alternate pin function set to the PWM timer used.
I did a quick and dirty removal of the timer entries for pins 11-13 from the overlay and rebuilt and then SPI1 started working again.
Will probably introduce a PR to do this, at least for now. Hopefully at some point there will be a system in place that allows
the sketch to select what usage that want for each pin. I know that there is a discussion going on with zephyr on this.
The good news is that I am learning a lot more about parts of the system :D The bad news is, it took a lot longer to figure this out
than it should have.
The text was updated successfully, but these errors were encountered: