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

Unexpected SBC SPI interrupts in MB6HC standalone mode can cause hard fault #972

Closed
dc42 opened this issue Apr 9, 2024 · 2 comments
Closed
Assignees
Milestone

Comments

@dc42
Copy link
Collaborator

dc42 commented Apr 9, 2024

As at version 3.5.0-rc.4 method SbcInterface::Spin() is called when in standalone mode. This initialises the SBC SPI interface so that it can receive transfers from a connected SBC and (according to the comments) return a response indicating that RRF is running in standalone mode. However, the SPI interrupt service routine now passes the SPI interrupt on to the WiFi module when not in SBC mode, which results in a hard fault if noise is received on the SBC SS signal. Even if the interrupt was processed using the SBC ISR, it is unlikely that the code would work because the ISR wakes up the SBC task, which doesn't run in standalone mode.

Example hard fault data, from 3.5.0-rc.4:

Last reset 00:01:13 ago, cause: software
Last software reset at 2024-04-09 14:25, reason: MemoryProtectionFault mmarValid daccViol, Gcodes spinning, available RAM 66676, slot 2
Software reset code 0x4163 HFSR 0x00000000 CFSR 0x00000082 ICSR 0x0043c004 BFAR 0x00000118 SP 0x2045ffb0 Task MAIN Freestk 72058 ok
Stack: 40078000 80000000 00011508 40058000 00000000 ffffffed 0042d080 8101003a ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff
Error status: 0x00Faulted at:
.text._ZN13WiFiInterface12GetNewStatusEv
                0x0042d060       0x70 ./src/Networking/ESP8266WiFi/WiFiInterface.o
                0x0042d060                SPI1_WiFi_Handler()
Error is at offset: 0x20
@dc42
Copy link
Collaborator Author

dc42 commented Apr 9, 2024

I propose that we remove this code from RepRap.cpp:

#if HAS_SBC_INTERFACE
	// Keep the SBC task spinning from the main task in standalone mode to respond to a SBC if necessary
	if (!UsingSbcInterface())
	{
		ticksInSpinState = 0;
		spinningModule = Module::SbcInterface;
		sbcInterface->Spin();
	}
#endif

With this code removed, function SbcInterface::Spin() can also be removed.

@dc42 dc42 self-assigned this Apr 9, 2024
@dc42 dc42 added this to the 3.5.0 milestone Apr 9, 2024
@dc42 dc42 changed the title Unexpected SBC SPI interrupts in standalone mode can cause hard fault Unexpected SBC SPI interrupts in MB6HC standalone mode can cause hard fault Apr 9, 2024
@dc42
Copy link
Collaborator Author

dc42 commented Apr 10, 2024

Code removed, issue believed solved.

@dc42 dc42 closed this as completed Apr 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant