Fixed some issues with the TGA_PRO_MEM2_EXP production test

pull/10/head
Steve Lascos 5 years ago
parent 53c91b75ff
commit 56feedf0fa
  1. 10
      examples/Tests/TGA_PRO_MEM2_EXP/TGA_PRO_MEM2_EXP.ino
  2. 10
      examples/Tests/TGA_PRO_MEM2_EXP/spiTest.cpp
  3. 2
      src/BAHardware.h
  4. 6
      src/peripherals/BASpiMemory.cpp

@ -43,7 +43,7 @@
*/ */
#define RUN_MIDI_TEST // Uncomment this line to run the MIDI test. #define RUN_MIDI_TEST // Uncomment this line to run the MIDI test.
#define RUN_MEMO_TEST // Uncomment this line to run the MEM0 test. //#define RUN_MEMO_TEST // Uncomment this line to run the MEM0 test.
//#define RUN_MEM1_TEST // (Teensy 3.5/3/6 only!) Uncomment this line to run the MEM1 test. //#define RUN_MEM1_TEST // (Teensy 3.5/3/6 only!) Uncomment this line to run the MEM1 test.
#include <Audio.h> #include <Audio.h>
@ -76,7 +76,7 @@ BAPhysicalControls controls(BA_EXPAND_NUM_SW, BA_EXPAND_NUM_POT, BA_EXPAND_NUM_E
void configPhysicalControls(BAPhysicalControls &controls, BAAudioControlWM8731 &codec); void configPhysicalControls(BAPhysicalControls &controls, BAAudioControlWM8731 &codec);
void checkPot(unsigned id); void checkPot(unsigned id);
void checkSwitch(unsigned id); void checkSwitch(unsigned id);
bool spiTest(BASpiMemory *mem); // returns true if passed bool spiTest(BASpiMemory *mem, int id); // returns true if passed
bool uartTest(); // returns true if passed bool uartTest(); // returns true if passed
unsigned loopCounter = 0; unsigned loopCounter = 0;
@ -101,14 +101,16 @@ void setup() {
#if defined(RUN_MEMO_TEST) #if defined(RUN_MEMO_TEST)
SPI_MEM0_1M(); SPI_MEM0_1M();
//SPI_MEM0_4M();
spiMem0.begin(); delay(10); spiMem0.begin(); delay(10);
if (spiTest(&spiMem0)) { Serial.println("SPI0 testing PASSED!");} if (spiTest(&spiMem0, 0)) { Serial.println("SPI0 testing PASSED!");}
#endif #endif
#if defined(RUN_MEM1_TEST) && !defined(__IMXRT1062__) #if defined(RUN_MEM1_TEST) && !defined(__IMXRT1062__)
SPI_MEM1_1M(); SPI_MEM1_1M();
//SPI_MEM1_4M();
spiMem1.begin(); delay(10); spiMem1.begin(); delay(10);
if (spiTest(&spiMem1)) { Serial.println("SPI1 testing PASSED!");} if (spiTest(&spiMem1, 1)) { Serial.println("SPI1 testing PASSED!");}
#endif #endif
Serial.println("Now monitoring for input from Expansion Control Board"); Serial.println("Now monitoring for input from Expansion Control Board");

@ -12,7 +12,7 @@ constexpr int mask1 = 0xaaaa;
using namespace BALibrary; using namespace BALibrary;
size_t SPI_MAX_ADDR = 0; int SPI_MAX_ADDR = 0;
int calcData(int spiAddress, int loopPhase, int maskPhase) int calcData(int spiAddress, int loopPhase, int maskPhase)
{ {
@ -37,7 +37,7 @@ int calcData(int spiAddress, int loopPhase, int maskPhase)
return (data & 0xffff); return (data & 0xffff);
} }
bool spiTest(BASpiMemory *mem) bool spiTest(BASpiMemory *mem, int id)
{ {
int spiAddress = 0; int spiAddress = 0;
int spiErrorCount = 0; int spiErrorCount = 0;
@ -48,14 +48,14 @@ bool spiTest(BASpiMemory *mem)
uint16_t goldData[NUM_BLOCK_WORDS]; uint16_t goldData[NUM_BLOCK_WORDS];
SPI_MAX_ADDR = BAHardwareConfig.getSpiMemMaxAddr(0); // assume for this test both memories are the same size so use MEM0 SPI_MAX_ADDR = BAHardwareConfig.getSpiMemMaxAddr(0); // assume for this test both memories are the same size so use MEM0
const size_t SPI_MEM0_SIZE_BYTES = BAHardwareConfig.getSpiMemSizeBytes(0); const size_t SPI_MEM_SIZE_BYTES = BAHardwareConfig.getSpiMemSizeBytes(id);
Serial.println(String("Starting SPI MEM Test of ") + SPI_MEM0_SIZE_BYTES + String(" bytes")); Serial.println(String("Starting SPI MEM Test of ") + SPI_MEM_SIZE_BYTES + String(" bytes"));
for (int cnt = 0; cnt < NUM_TESTS; cnt++) { for (int cnt = 0; cnt < NUM_TESTS; cnt++) {
// Zero check // Zero check
mem->zero16(0, SPI_MEM0_SIZE_BYTES / sizeof(uint16_t)); mem->zero16(0, SPI_MEM_SIZE_BYTES / sizeof(uint16_t));
while (mem->isWriteBusy()) {} while (mem->isWriteBusy()) {}
for (spiAddress = 0; spiAddress <= SPI_MAX_ADDR; spiAddress += NUM_BLOCK_WORDS*sizeof(uint16_t)) { for (spiAddress = 0; spiAddress <= SPI_MAX_ADDR; spiAddress += NUM_BLOCK_WORDS*sizeof(uint16_t)) {

@ -36,7 +36,7 @@ namespace BALibrary {
// to correctly configure your hardware // to correctly configure your hardware
#define TGA_PRO_REVA(x) BALibrary::BAHardwareConfig.m_tgaBoard = TgaBoard::REV_A ///< Macro for specifying REV A of the TGA Pro #define TGA_PRO_REVA(x) BALibrary::BAHardwareConfig.m_tgaBoard = TgaBoard::REV_A ///< Macro for specifying REV A of the TGA Pro
#define TGA_PRO_REVB(x) BALibrary::BAHardwareConfig.m_tgaBoard = TgaBoard::REV_B ///< Macro for specifying REV B of the TGA Pro #define TGA_PRO_REVB(x) BALibrary::BAHardwareConfig.m_tgaBoard = TgaBoard::REV_B ///< Macro for specifying REV B of the TGA Pro
#define TGA_PRO_EXPAND_REV2(x) BALibrary::BAHardwareConfig.m_expansionBoard = ExpansionBoard::REV_1 ///< Macro for specifying REV 1 of the Expansion Board #define TGA_PRO_EXPAND_REV2(x) BALibrary::BAHardwareConfig.m_expansionBoard = ExpansionBoard::REV_2 ///< Macro for specifying REV 2 of the Expansion Board
#define SPI_MEM0_1M(x) BALibrary::BAHardwareConfig.m_spiMem0 = SPI_MEMORY_1M ///< Macro for specifying MEM0 is 1Mbit #define SPI_MEM0_1M(x) BALibrary::BAHardwareConfig.m_spiMem0 = SPI_MEMORY_1M ///< Macro for specifying MEM0 is 1Mbit
#define SPI_MEM0_4M(x) BALibrary::BAHardwareConfig.m_spiMem0 = SPI_MEMORY_4M ///< Macro for specifying MEM1 is 4Mbit #define SPI_MEM0_4M(x) BALibrary::BAHardwareConfig.m_spiMem0 = SPI_MEMORY_4M ///< Macro for specifying MEM1 is 4Mbit
#define SPI_MEM1_1M(x) BALibrary::BAHardwareConfig.m_spiMem1 = SPI_MEMORY_1M ///< Macro for specifying MEM0 is 1Mbit #define SPI_MEM1_1M(x) BALibrary::BAHardwareConfig.m_spiMem1 = SPI_MEMORY_1M ///< Macro for specifying MEM0 is 1Mbit

@ -498,8 +498,12 @@ void BASpiMemoryDMA::zero(size_t address, size_t numBytes)
/// TODO: Why can't the T4 zero the memory when a NULLPTR is passed? It seems to write a constant random value. /// TODO: Why can't the T4 zero the memory when a NULLPTR is passed? It seems to write a constant random value.
/// Perhaps there is somewhere we can set a fill value? /// Perhaps there is somewhere we can set a fill value?
uint8_t zeroBuffer[MAX_DMA_XFER_SIZE]; #if defined(__IMXRT1062__)
static uint8_t zeroBuffer[MAX_DMA_XFER_SIZE];
memset(zeroBuffer, 0, MAX_DMA_XFER_SIZE); memset(zeroBuffer, 0, MAX_DMA_XFER_SIZE);
#else
uint8_t *zeroBuffer = nullptr;
#endif
while (bytesRemaining > 0) { while (bytesRemaining > 0) {
m_txXferCount = m_bytesToXfer(nextAddress, min(bytesRemaining, static_cast<size_t>(MAX_DMA_XFER_SIZE))); // check for die boundary m_txXferCount = m_bytesToXfer(nextAddress, min(bytesRemaining, static_cast<size_t>(MAX_DMA_XFER_SIZE))); // check for die boundary

Loading…
Cancel
Save