Other Parts Discussed in Thread: SYSCONFIG,
I am currently learning to use TI microcontrollers. I am using sysconfig to generate the driver code for SPI. I am using TMS320F280039C launchpad as a slave device and an arduino as a master. I am sending the data 0x2 from arduino but TMS320F280039C is getting some data but its not 0x2. The data received by TMS320F280039C always varies and its not consistent.
I have connected the SPI pins as follows
POCI - MISO (Arduino UNO)
PICO - MOSI (Arduino UNO)
CLK - CLK (Arduino UNO)
PTE - CS (Arduino UNO)
#include "driverlib.h"
#include "device.h"
#include "board.h"
#include <stdio.h>
//
// Main
//
#define CPU_RATE 8.33L
#define CPU_FRQ_120MHZ 1
uint16_t test =0;
#define DELAY_US(A) F28x_usDelay(((((long double) A * 1000.0L) / (long double)CPU_RATE) - 9.0L) / 5.0L)
static void UART_TX(char a[]) {
while ((*a) != '\0') {
SCI_writeCharBlockingNonFIFO(mySCI0_BASE,*a);
a = a + 1;
}
char test = '\n';
SCI_writeCharBlockingNonFIFO(mySCI0_BASE, test);
}
void main(void)
{
// Device Initialization
Device_init();
//
// Initializes Peripheral Interrupt Expansion module (PIE) and clears PIE registers. Disables CPU interrupts.
//
Interrupt_initModule();
//
// Initializes the PIE vector table with pointers to the shell Interrupt
// Service Routines (ISR).
//
Interrupt_initVectorTable();
Board_init();
//
// Enable Global Interrupt (INTM) and realtime interrupt (DBGM)
//
EINT;
ERTM;
char data[100] = "Hello world";
while(1)
{
test = SPI_readDataBlockingNonFIFO(mySPI0_BASE);
sprintf( data,"Data Received %u",test);
UART_TX(data);
}
}