Skip to content

Add spi #32

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

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open

Add spi #32

wants to merge 5 commits into from

Conversation

Frederikwag
Copy link

By creating this pull request you agree to the terms in CONTRIBUTING.md.
https://github.com/Infineon/.github/blob/master/CONTRIBUTING.md
--- DO NOT DELETE ANYTHING ABOVE THIS LINE ---

CONTRIBUTING.md also tells you what to expect in the PR process.

Description
Added the 3 wire test for SPI. 3 tests are executed:

  1. Verify if the sensor is responding
  2. Request angle data from the sensor using 3-wire SPI (16 bit)
  3. Request temperature data from the sensor (8 bit)

Related Issue
The test requires the sensor tlx5012. Later on, we need to "professionalize" it so that it communicates with another board. Setting up the XMC as slave is the critical part.

Context

@Frederikwag Frederikwag reopened this Apr 23, 2025
@@ -13,7 +15,7 @@

// defines
// Variables for SPI testing
static SPIClassPSOC *spi = nullptr;
static SPIClass *spi = nullptr;
Copy link
Member

@jaenrig-ifx jaenrig-ifx May 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good try 😬
Now this is fixed for xmc-for-arduino, but it won´t work for arduino-core-psoc.
The tests are meant to be reusable across cores. So when we identify that some core specific implementation is present, we should:

  1. generalize it using any standard common API.
  2. If generalization is not possible, use some mechanism to conditionally set certain specialization. For example, use the preprocessor to identify the core -> https://github.com/Infineon/arduino-core-tests/blob/main/src/corelibs/uart/test_uart_tx.cpp#L151-L163

@@ -5,6 +5,8 @@
* MISO pin for the test cases to work as expected.
*/

// THIS IS THE BRANCH ADD_SPI
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove comment.

@@ -70,7 +72,7 @@ TEST_IFX(spi_connected1_loopback, test_spi_mode_configuration) {
TEST_IFX(spi_connected1_loopback, test_spi_reinitialization) {
spi->end();
spi->begin();
TEST_ASSERT_EQUAL_MESSAGE(CY_RSLT_SUCCESS, spi->status, "SPI reinitialization failed");
TEST_ASSERT_TRUE_MESSAGE(true, "SPI reinitialization completed");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test might not be available for the standard Arduino coreAPI?

*/

// std includes
#include <tlx5012-arduino.hpp>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might not be easy to test the 3-wire SPI interface... But this is not a 3wire SPI test, it is a TLE5012 test. Of course, if it works, then the affected 3-wire spi functionalities are as well validated.
We should be using the 3wire spi class and functions for it to belong in this project.

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

Successfully merging this pull request may close these issues.

2 participants