My sharring - IMX 28 to MC56f8257 SPI in 15 mega bit

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

My sharring - IMX 28 to MC56f8257 SPI in 15 mega bit

1,062 Views
EliArad
Contributor I

Hi,

 

We are working on both IMX28 and MC56f8x000 family. 

 

I found that the support from freescale is not very helpfull , so i think all programmers should share there findings to help each other. 

 

I will share with you..

 

tring to achive 15000000 mega bit between IMX 28 and MC56f8257 was not an easy task,

 

First we tried using the processor expert.

The PE has two options:

 

1) Works in interrupt

2) Works in polling.

 

Using the code that the PE generate in interrupt as is you can get no more than 1Mbit.

using the code that the PE generae in polling you can get up to 4Mbit (even less)

 

But in order to get 15 mega bit we need to do something else

 

1)  Works in interrupt. 

2) In the interrupt routine  , after getting the first byte poll the reset of the data

3) be 100% effeciency in the code and dont waiste even 1 cycle

 

The Spi routine in the intrrupt must get first the entire data , it cannot parse the data , perform even check for overrun. 

 

This is the code that will work in 15 mega in the Controller side:

 

in the SPI RX intrrupts:

 

for (i = 0; i < size ; i++)
{

    while (!(getRegBit(QSPI0_SCTRL,SPRF)))
    {
    }
    RxBuffer[i] = getReg(QSPI0_DRCV);
}
if (getRegBit(QSPI0_SCTRL,OVRF))
{
   /* Occured any overflow condition between QSPI0_SCTRL and QSPI0_DRCV reading? */
   getReg(QSPI0_DRCV); /* Clear the overflow flag */
}

 

note:

 

If the controller does not know the size and it should accept it via an header , then the header must be send slowly from IMX. 

 

For example:

 

Suppose my header has 3 bytes:

Sequence indication one byte

Size - two bytes 

 

In IMX side i will send the data as follow:

 

for (i = 0 ; i < 3 i++)

{

    write (fd , data  , 1) 

}

 

and then the data 

write (fd , data , size) 

 

where size is more than 1. 

 

When sending in IMX data using write more than 1 it being sent as a burst , fast as you configure the SPI. 

 

Eli

Labels (1)
Tags (1)
0 Kudos
Reply
0 Replies