This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Communicating between two F28335 using SCI

Hello,

I am trying to write a very basic program to test communication between two DSP's using SCI.

I am connecting pin no 3 of EZdsp1 to Pin no 4 of EZdsp 2 and Pin no 3 of EZdsp 2 to pin no 4 of Ez dsp1. all  from  port 8 for both the EZdsp kits. 

for transmitter i am using this code

Tx.txt
Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#include "DSP28x_Project.h" // Device Headerfile and Examples Include File
// Prototype statements for functions found within this file.
void scia_loopback_init(void);
void scia_fifo_init(void);
void scia_xmit(int a);
void error();
interrupt void scia_rx_isr(void);
interrupt void scia_tx_isr(void);
// Global counts used in this example
Uint16 LoopCount;
Uint16 ErrorCount;
void main(void)
{
Uint16 SendChar;
Uint16 ReceivedChar;
// Step 1. Initialize System Control registers, PLL, WatchDog, Clocks to default state:
// This function is found in the DSP2833x_SysCtrl.c file.
InitSysCtrl();
// Step 2. Select GPIO for the device or for the specific application:
// This function is found in the DSP2833x_Gpio.c file.
// InitGpio(); skip this as this is example selects the I/O
// for SCI-A in this file itself
InitSciGpio();
// Step 3. Initialize PIE vector table:
// The PIE vector table is initialized with pointers to shell Interrupt
// Service Routines (ISR). The shell routines are found in DSP2833x_DefaultIsr.c.
// Insert user specific ISR code in the appropriate shell ISR routine in
// the DSP28_DefaultIsr.c file.
// Disable and clear all CPU interrupts:
DINT;
IER = 0x0000;
IFR = 0x0000;
// Initialize Pie Control Registers To Default State:
// This function is found in the DSP2833x_PieCtrl.c file.
// InitPieCtrl(); PIE is not used for this example
// Initialize the PIE Vector Table To a Known State:
// This function is found in DSP2833x_PieVect.c.
// This function populates the PIE vector table with pointers
// to the shell ISR functions found in DSP2833x_DefaultIsr.c.
InitPieVectTable();
// Enable CPU and PIE interrupts
// This example function is found in the DSP2833x_PieCtrl.c file.
EnableInterrupts();
// Step 4. Initialize all the Device Peripherals to a known state:
// This function is found in DSP2833x_InitPeripherals.c
// InitPeripherals(); skip this for SCI tests
// Step 5. User specific functions, Reassign vectors (optional), Enable Interrupts:
LoopCount = 0;
ErrorCount = 0;
scia_fifo_init(); // Initialize the SCI FIFO
scia_loopback_init(); // Initalize SCI for digital loop back
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
 and for Receiver i am using 

Rx.txt
Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#include "DSP28x_Project.h" // Device Headerfile and Examples Include File
// Prototype statements for functions found within this file.
void scia_loopback_init(void);
void scia_fifo_init(void);
void scia_xmit(int a);
void error();
interrupt void scia_rx_isr(void);
interrupt void scia_tx_isr(void);
// Global counts used in this example
Uint16 LoopCount;
Uint16 ErrorCount;
void main(void)
{
Uint16 SendChar;
Uint16 ReceivedChar;
// Step 1. Initialize System Control registers, PLL, WatchDog, Clocks to default state:
// This function is found in the DSP2833x_SysCtrl.c file.
InitSysCtrl();
// Step 2. Select GPIO for the device or for the specific application:
// This function is found in the DSP2833x_Gpio.c file.
// InitGpio(); skip this as this is example selects the I/O
// for SCI-A in this file itself
InitSciGpio();
// Step 3. Initialize PIE vector table:
// The PIE vector table is initialized with pointers to shell Interrupt
// Service Routines (ISR). The shell routines are found in DSP2833x_DefaultIsr.c.
// Insert user specific ISR code in the appropriate shell ISR routine in
// the DSP28_DefaultIsr.c file.
// Disable and clear all CPU interrupts:
DINT;
IER = 0x0000;
IFR = 0x0000;
// Initialize Pie Control Registers To Default State:
// This function is found in the DSP2833x_PieCtrl.c file.
// InitPieCtrl(); PIE is not used for this example
// Initialize the PIE Vector Table To a Known State:
// This function is found in DSP2833x_PieVect.c.
// This function populates the PIE vector table with pointers
// to the shell ISR functions found in DSP2833x_DefaultIsr.c.
InitPieVectTable();
// Enable CPU and PIE interrupts
// This example function is found in the DSP2833x_PieCtrl.c file.
EnableInterrupts();
// Step 4. Initialize all the Device Peripherals to a known state:
// This function is found in DSP2833x_InitPeripherals.c
// InitPeripherals(); skip this for SCI tests
// Step 5. User specific functions, Reassign vectors (optional), Enable Interrupts:
LoopCount = 0;
ErrorCount = 0;
scia_fifo_init(); // Initialize the SCI FIFO
scia_loopback_init(); // Initalize SCI for digital loop back
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
I am able to send the data through the transmitter but not able to receive it on the receiver. I have read the other thread on the same issue but not able to resolve the problem.

Am i doing something wrong with the code or the hardware connection?

  • I'm not very familiar with the ezDSP, but it seems like your HW sate up is reasonable. Have you verified the transmitter output with an oscilloscope?
    Glancing at the code I don't see anything obviously wrong. A good first step would be to use the memory browser/registers view to confirm that the SCI registers are being programmed correctly.

    Let me know what you find out!
    Cody
  • Hi Cody,

    previously I was not getting any output at GPIO 29, but I figured out that I need to change the position of the SW2 switch in ezDSP. Now I am getting an output at the transmitter. (attached)

    however, still, I am not able to receive anything on the GPIO28. I even tried to send the data to the receiver of the same DSP and used the loopback code. I disabled the internal loopback and connected them externally.

    I am not really sure but I there something wrong with my initialization of SCI?

      

  • Ankit,

    Can you enable internal loopback to check that your receiver side has been configured correctly? If it works, then disable internal loopback and check that GPIO 28 has been correctly as an input.

    Regards,
    Cody

  • Thanks for pointing that out, I was able to make it work. 

    I made a mistake. The receiver has to be turned on before the transmitter. Once I did that I am able to send the data at a Baud rate of 2343750 without encountering any error.

    Thank you

  • Ankit,

    when using two ezDSP boards, are the grounds connected? One more test you could try is sending data SCIa-SCIb on the same ezDSP.

    Excited to hear back!
    Cody

  • Hi Cody,

    No the grounds of both the DSP's are seperate. I am sure it will work as now i am able to communicate between two seperate DSP boards which are not in sync.

    Ankit
  • Ankit,

    I'm glad to hear your issue has been resolved. Note it is always a good idea to use a common ground with "single-ended" communication methods as ground is the signal reference.

    Regards,
    Cody