Part Number: TMS320F28374D
Other Parts Discussed in Thread: C2000WARE
Tool/software: Code Composer Studio
Hi friends
I have made a PCB+components using a Microcontroller TMS320F28374D so that I can make the SPI to communicate with other devices. I use C2000Ware, I wrote the following code which is very simple but it does not function.
// Included Files
#include "driverlib.h"
#include "device.h"
// Function Prototypes
void initSPIAMaster(void);
void configGPIOs(void);
// Main
void main(void)
{
// Initialize device clock and peripherals
Device_init();
// Disable pin locks and enable internal pullups.
Device_initGPIO();
// Initialize PIE and clear PIE registers. Disables CPU interrupts.
Interrupt_initModule();
// Initialize the PIE vector table with pointers to the shell Interrupt
// Service Routines (ISR).
Interrupt_initVectorTable();
// Configure GPIOs for external loopback.
configGPIOs();
// Set up SPI A as master, initializing it for FIFO mode
initSPIAMaster();
// Enable Global Interrupt (INTM) and realtime interrupt (DBGM)
EINT;
ERTM;
// Loop forever. Suspend or place breakpoints to observe the buffers.
while(1)
{
SPI_writeDataNonBlocking(SPIB_BASE, 0xAA);
DEVICE_DELAY_US(500000);
}
}
// Function to configure SPI A as master with FIFO enabled.
void initSPIAMaster(void)
{
// Must put SPI into reset before configuring it
SPI_disableModule(SPIB_BASE);
// SPI configuration. Use a 500kHz SPICLK and 8-bit word size.
SPI_setConfig(SPIA_BASE, DEVICE_LSPCLK_FREQ, SPI_PROT_POL0PHA0,
SPI_MODE_MASTER, 500000, 8);
SPI_disableLoopback(SPIA_BASE);
SPI_setEmulationMode(SPIA_BASE, SPI_EMULATION_FREE_RUN);
// Configuration complete. Enable the module.
SPI_enableModule(SPIB_BASE);
}
// Configure GPIOs for external loopback.
void configGPIOs(void)
{
// GPIO17 is the SPISOMIA.
GPIO_setMasterCore(17, GPIO_CORE_CPU1);
GPIO_setPinConfig(GPIO_17_SPISOMIA);
GPIO_setPadConfig(17, GPIO_PIN_TYPE_PULLUP);
GPIO_setQualificationMode(17, GPIO_QUAL_ASYNC);
// GPIO16 is the SPISIMOA clock pin.
GPIO_setMasterCore(16, GPIO_CORE_CPU1);
GPIO_setPinConfig(GPIO_16_SPISIMOA);
GPIO_setPadConfig(16, GPIO_PIN_TYPE_PULLUP);
GPIO_setQualificationMode(16, GPIO_QUAL_ASYNC);
// GPIO19 is the SPISTEA.
GPIO_setMasterCore(19, GPIO_CORE_CPU1);
GPIO_setPinConfig(GPIO_19_SPISTEA);
GPIO_setPadConfig(19, GPIO_PIN_TYPE_PULLUP);
GPIO_setQualificationMode(19, GPIO_QUAL_ASYNC);
// GPIO18 is the SPICLKA.
GPIO_setMasterCore(18, GPIO_CORE_CPU1);
GPIO_setPinConfig(GPIO_18_SPICLKA);
GPIO_setPadConfig(18, GPIO_PIN_TYPE_PULLUP);
GPIO_setQualificationMode(18, GPIO_QUAL_ASYNC);
}
// End of File
Using an oscilloscope I measured the output of SPICLKA, which seemed to be correct, in every 500 ms I witness 8 clock cycles on it. But, SPISIMOA I did not get any pulse . I would appreciate any help or any comments.