Skip to content
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

[BUG] STM32 HAL software SPI bug #23064

Closed
bigtreetech opened this issue Nov 2, 2021 · 8 comments
Closed

[BUG] STM32 HAL software SPI bug #23064

bigtreetech opened this issue Nov 2, 2021 · 8 comments
Labels

Comments

@bigtreetech
Copy link
Contributor

Did you test the latest bugfix-2.0.x code?

Yes, and the problem still exists.

Bug Description

https://github.com/MarlinFirmware/Marlin/blob/2.0.x/Marlin/src/HAL/STM32/HAL_SPI.cpp#L81

Here is the initialization function of software SPI, but it does call the hardware SPI API of Arduino framework.

Bug Timeline

No response

Expected behavior

No response

Actual behavior

Octopus-Pro, Enable TMC SPI、LCD SD SPI、Max31865 SPI at the same time and use the software SPI. After calling SPI.begin();, Max31865 cannot read the normal temperature and report the max temp error.

Steps to Reproduce

No response

Version of Marlin Firmware

Commits on Nov 2, 2021

Printer model

No response

Electronics

No response

Add-ons

No response

Bed Leveling

No response

Your Slicer

No response

Host Software

No response

Additional information & file uploads

No response

@thisiskeithb thisiskeithb added C: Peripherals C: Temperatures T: HAL & APIs Topic related to the HAL and internal APIs. labels Nov 2, 2021
@thisiskeithb
Copy link
Member

@slowbro Can you take a look at this?

@Portzal
Copy link

Portzal commented Nov 3, 2021

I am having the following issues that may be related?

BTT Octopus Pro (429) TMC5160’s I have sensor less homing working great using SPI_ENDSTOPS, but with a SD card with a print file on it in the BTT TFT or onboard SD, the machine false triggers when it goes to home. If I print from the TFT U Disk every thing works as expected.

@slowbro
Copy link
Member

slowbro commented Nov 4, 2021

I think the issue is that there is not enough grace time for the MAX TC to get a temp reading. I wonder if it would eventaully be able to read the temp OK. @bigtreetech have you tried enabling IGNORE_THERMOCOUPLE_ERRORS in temperature.cpp and seeing it it works otherwise?

@bigtreetech
Copy link
Contributor Author

No, but I can try it now. However, In theory, after calling SPI.begin();, the GPIO corresponding to MOSI, MISO, SCK will be set to Alternate function mode instead of General purpose output push-pull mode required by the software SPI. Therefore, the software SPI cannot read the correct data

@bigtreetech
Copy link
Contributor Author

IGNORE_THERMOCOUPLE_ERRORS Can't solve the problem

@thinkyhead
Copy link
Member

@bigtreetech — It would help to get calls to SPI.begin() sorted out generally. Maybe it's not the call to SPI.begin() here, but a specific call to spiInit() someplace else…? Maybe some calls to SPI.begin() are supposed to be calls to spiBegin() instead…? I see that HAS_MAXTC_SW_SPI causes spiBegin and spiInit to get called…. Maybe we just need to set a flag after it's been called once to not call it again….

@github-actions
Copy link

This issue has had no activity in the last 60 days. Please add a reply if you want to keep this issue active, otherwise it will be automatically closed within 10 days.

@github-actions github-actions bot closed this as completed May 1, 2022
thisiskeithb added a commit to thisiskeithb/Arduino_Core_STM32 that referenced this issue May 18, 2022
@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked and limited conversation to collaborators Jun 30, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

5 participants