The SPI class has a member "static SPI *_owner;" to indicate need to set SPI or not, and the default value is NULL in SPI.cpp. But after call the destructor and constructor again, it may encounter the format and frequency are not set issue due to the address is the same.
In ci-test-shield\TESTS\API\SPI\SPI.cpp, each test case calls the SPI constructor and may cause this issue. The solution should be set the _owner to be NULL in the SPI destructor as below.
diff --git a/drivers/SPI.h b/drivers/SPI.h
index 645243070..7e0ba08f4 100644
--- a/drivers/SPI.h
+++ b/drivers/SPI.h
@@ -263,6 +263,7 @@ protected:
public:
virtual ~SPI() {
protected:
cc @deepikabhavnani @c1728p9 @bulislaw
[Mirrored to Jira]
@ccchang12 Do you mind pushing PR with a fix?
[Mirrored to Jira]
@bulislaw I think it is better the owner can modify the code directly in next release.
[Mirrored to Jira]
Internal Jira reference: https://jira.arm.com/browse/IOTHAL-223