Skip to content

Commit 87902a8

Browse files
committed
Add SCLK and SIN stats to SPIMasterTester.
It has been found that there is a problem with the new K66F SPI driver when clock polarity is high. After setting clock polarity to high SCLK line is still low. When transmission starts and CS is asserted (in case of manual CS handling) SCLK signal is invalid (low). After first transfer SCLK idle state becomes high. SPI implementation on FPGA test shield is resistant on this bug and transmission is successful. The problem has been found on two boards communication test where transmission fails. The idea is to add support to the FPGA test shield to catch such errors and verify this in the test.
1 parent a4738fa commit 87902a8

File tree

3 files changed

+24
-0
lines changed

3 files changed

+24
-0
lines changed

components/testing/COMPONENT_FPGA_CI_TEST_SHIELD/SPIMasterTester.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,3 +68,11 @@ uint32_t SPIMasterTester::get_last_clk_edge_to_cs_ns()
6868

6969
return (delay_ns * 10);
7070
}
71+
72+
uint8_t SPIMasterTester::get_start_stop_stats()
73+
{
74+
uint8_t start_stop_stats;
75+
read(TESTER_SPI_MASTER_START_STOP_STATS, (uint8_t *)&start_stop_stats, TESTER_SPI_MASTER_START_STOP_STATS_SIZE);
76+
77+
return start_stop_stats;
78+
}

components/testing/COMPONENT_FPGA_CI_TEST_SHIELD/SPIMasterTester.h

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,20 @@ class SPIMasterTester: public SPITester {
104104
*/
105105
uint32_t get_last_clk_edge_to_cs_ns();
106106

107+
/**
108+
* Get SCLK and SIN states on transmission start and stop.
109+
*
110+
* @return latched SCLK and SIN states on transmission start and stop.
111+
*
112+
* @note Stats are encoded as fallows (bit 0 - LSB):
113+
* - bit 0: start SCLK
114+
* - bit 1: start SIN
115+
* - bit 2: stop SCLK,
116+
* - bit 3: stop SIN,
117+
* - other: unused
118+
*/
119+
uint8_t get_start_stop_stats();
120+
107121
};
108122

109123
#endif

components/testing/COMPONENT_FPGA_CI_TEST_SHIELD/fpga_config.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@
5656
#define TESTER_SPI_MASTER_STOPS 0x00102009
5757
#define TESTER_SPI_MASTER_TRANSFERS 0x0010200A
5858
#define TESTER_SPI_MASTER_TRANSFERS_SIZE 2
59+
#define TESTER_SPI_MASTER_START_STOP_STATS 0x0010200C
60+
#define TESTER_SPI_MASTER_START_STOP_STATS_SIZE 1
5961
#define TESTER_SPI_MASTER_TO_SLAVE_CHECKSUM 0x00102012
6062
#define TESTER_SPI_MASTER_TO_SLAVE_CHECKSUM_SIZE 4
6163
#define TESTER_SPI_MASTER_CTRL 0x00102016

0 commit comments

Comments
 (0)