AnsweredAssumed Answered

21469 EZ Board crashes on 16-bit SPIB Master Core Read....

Question asked by PatrickM on Jun 13, 2011
Latest reply on Jun 14, 2011 by jeyanthi.jegadeesan

Hi,

 

I am using a 21469 EZ Board with some low latency DAC's and ADC's attached.  We are using the board to verify algorithms for a communication system.

 

A subset of the I/O pins on connector P2 are shown below.  All the switches shown in bold are OFF to allow the respective I/O signal to pass through to the attached board.

 

The SPI port drives several AD5663 2.7 V to 5.5 V, 250 ìA, Rail-to-Rail Output, Dual 16-Bit nanoDACs.  We select the appropriate DAC by setting FLAG0-3 bits (named MUX_CONTROL_X below).  This works quite well.  I've included the test code to output a sine wave using a timer interrupt.

 

The SPIB port drives anADIS16400 Triaxial Inertial Sensor with Magnetometer, hereinafter referred to as the IMU.  Using DMA I can read data from the IMU through SPIB.  However, when I try read a single sixteen bit value the processor crashes.  The error that I get from the debugger is "<empty_stack + 0x2e>.  I'm presuming that some sort of uninitialized trap instruction was invoked by the instruction which crashed the processer.

 

The crash occurs in the following subroutine at the line marked in BOLD.  As nearly as I can tell this is a perfectly legal statement....

 

// Read the ADIS16405 IMU...
int SpiBRead16( int address )
{
int input;

*pSPIDMACB = 0; // Disable SPIB DMA
*pSPICTLB = (TXFLSH | RXFLSH); // Flush TX and RX buffers
*pSPIBAUDB = 114; // Measured 1 MHz baud rate divider...
*pSPIFLGB = DS0EN; // CPHASE with AUTOSDS
*pSPICTLB =
  SPIMS |  // The processer is SPI master
  MSBF |   // Most Significant Bit First
  WL16 |   // Word length is 16-bits
  CPHASE |  // Start SPICLK at the beginning (rather than middle) of the first bit
  CLKPL |  // Active low SPI clock
  AUTOSDS; // Device select is controlled by SPI hardware

*pTXSPIB = address;

*pSPISTATB = 0xFF; // Clear any SPI errors
*pSPICTLB |= SPIEN; // Enable SPIB port

// A dummy read starts the SPI. Then we have to trasmit a dummy word
// to get the real data...
input = *pRXSPIB; // do a dummy read to allow the SPI to start
while ((*pSPISTATB & SPIF) == 0); // wait for transmission to complete

// Enable SPIB port
*pSPISTATB = 0xFF; // Clear any SPI errors
*pSPICTLB |= SPIEN;

*pTXSPIB = 0x0000;
input = *pRXSPIB; // do a dummy read to allow the SPI to start
while ((*pSPISTATB & SPIF) == 0); // wait for transmission to complete

*pSPISTATB = 0xFF; // Clear any SPI errors
*pSPICTLB |= SPIEN; // Enable SPIB port

// copy the SPI data into the raw data buffer
input = *pRXSPI;

*pSPICTL = 0; // disable

return input;
}

 

How can I tell what is causing the crash?  Is there available a canned set of interrupts which would indicate the source of the problem?  Am I using the SPIB Master Core Read functionality correctly?

 

Thanks in advance for your help,

 

Patrick Mealey

Sr. Software Engineer

AOptix

Pin

Name

Function

New Function

Description

Switch

24

DPI3

SPI_CLK

SPI_CLK

SPI Clock Signal

SW3.3

25

DPI1

SPI_MOSI

SPI_MOSI

SPI Master Out Slave In

SW3.1

26

DPI5

SPI_CS

SPI_CS

SPI Slave Device Select

SW3.5

27

DPI2

SPI_MISO

SPI_MISO

SPI Master In Slave Out

SW3.2

28

DPI6

LED1

LED1

LED 1

SW3.6

29

DPI8

TEMP_SCK

SPIB_CS

SPI B Slave Device Select

SW3.8

30

DPI7

TEMP_SDA

SPIB_MISO

SPI B Master In Slave Out

SW3.7

31

DPI9

UART_TX

UART_TX

UART Transmit

32

DPI10

UART_RX

UART_RX

UART Receive

33

DPI12

UART_CTS

SPIB_MOSI

SPI B Master Out Slave In

SW14.4

34

DPI11

UART_RTS

SPIB_CLK

SPI B Clock Signal

SW14.3

35

RESET

Reset

Reset

Reset Signal Output

36

NC

No Connection

No Connection

37

FLAG0

TEMP_THERM

MUX_CONTROL 1

MUX Control Line 1

SW13.3

38

FLAG1

PB1

MUX_CONTROL 2

MUX Control Line 2

SW13.4

39

FLAG2

PB2

MUX_CONTROL 3

MUX Control Line 3

SW13.5

 

Attachments

Outcomes