I need help for SPI connection MC56F8367

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

I need help for SPI connection MC56F8367

Jump to solution
10,458 Views
TroyCorser
Contributor III
Hi all,
 
I'm trying to use the SPI port to connect the DSP with a "12bit spi DAC" (digital to analogic converter). The output of the DAC is read from the A/D  port on the DSP board.
The SPI is used as a simple transmitter, only the output line is used MOSI. I also use the CLOCK pin to comand the data synchronization. 
MISO isn't used.
 
The problem is that seems that the DSP don't write into the SPI.
I say this because I see, during the debug, that no data is inserted into the SPDTR register.
 
that's the simple code i used to try the SPI:
 byte smEnable = 0;
 byte smSndChr = 0;
 byte valAna   = 0;
 SM1_TComData Chr = 4000;
 word *valoreA;
 word valA = 0;
 valoreA = &valA;

 PE_low_level_init();

 smEnable = SM1_Enable();
 
 for(;:smileywink: {
 
 Bit1_PutVal(0);
 smSndChr = SM1_SendChar(Chr);
 valAna = AD1_GetValue16(valoreA);
 Bit1_PutVal(1);
 
 }
 
can somebody help me please ?
0 Kudos
1 Solution
2,002 Views
TroyCorser
Contributor III

I found the problem.

There was an insufficient voltage on the board of the "SPI 12bit DAC" and the debugger work so slow that I couldn't see any change in the transmit register.

With an oscilloscope I tested that the SPI on the evaluation board work correctly.

Thanks to all.

View solution in original post

0 Kudos
3 Replies
2,003 Views
TroyCorser
Contributor III

I found the problem.

There was an insufficient voltage on the board of the "SPI 12bit DAC" and the debugger work so slow that I couldn't see any change in the transmit register.

With an oscilloscope I tested that the SPI on the evaluation board work correctly.

Thanks to all.

0 Kudos
2,003 Views
alex_spotw
Contributor III
HI:

Is your SPI Bean configured to work Interrupt-driven or polling-drive?

Does your DAC require a Chip Select or Latch Enable signal? If so, you have to add it to your code.

Is the SPI clock frequency set up to a frequency that the DAC can work with?

Regards,

ALex
0 Kudos
2,002 Views
TroyCorser
Contributor III

My SPI Bean is configured to use polling-drive.

The DAC need a signal (work low) to allow the conversion of the data, so I use a general purpose bit to enable the conversion:

Bit1_PutVal(0);       (I also tried to set it to 1 before the SendChar and put it low after, but without results)

In the datasheet of the DAC:

Data Hold time                (Min) :   80 ns
Clock Pulse Width Hight (Min) :   90 ns
Clock Pulse Width Low   (Min) : 120 ns
Load Pulse Width            (Min) : 120 ns
LSB Clock Into Input Register
 to load DAC Register Time (Min) : 0 ns

now The SPI bean is configured to use 0,267 Micro s
I also tried to use others clock configuration without good results

0 Kudos