FRDM-KL25Z SPI1 no serial clock signal

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

FRDM-KL25Z SPI1 no serial clock signal

Jump to solution
917 Views
dianas
Contributor I

Hi there!

I am a student working on a project to read ECG using the TI ADS1298 frontend (for which I purchased the development kit and want to use the EVM without the MMBO) connected to FRDM-KL25Z in order to develop a data-logger that saves data on the SD card mounted on FRDM-FXS-MULTI-B .

For what concernes the firmware I'm programming with CodeWarrior 10.6 using processor expert components.

There have been several excellent posts on this topic, but I still cannot get things going.

Here the details of my setup:

everything is supplied from the battery provided with the FRDM-FXS-MULTI-B board. Voltages on test point are all ok.

SD card is connected to my microcontroller through the SPI0 and works fine.

Frontend is connected through the SPI1 to the micro, with this pin configuration:

MISO: PTD7

MOSI: PTD6

SCK: PTE2

CS: PTE4

DRDY: PTA12

START: PTC8.

SPI1 configuration(I'm using the processor expert component):

clock polarity:      low

clock phase:        change on leading edge

parity:                  none

clock rate:            2MHz

The frontend, without any register configuration, puts data on MISO line and a data ready signal on an interrupt line at 250Hz. It needs only to be powered and enabled, setting the start pin to 1.

In a preliminary test I just powered on the boards to see if the frontend is sending some kind of data.

This is the programming algorithm:

-general initialization of al the peripherals

-start of the endless loop

-if an interrupt from the frontend occurred retrieve data and save in a temporary buffer (this is the only operation exploited in the interrupt service routine)

-store data on SD card

for the retrieval of data I'm using the function SPI1_ReceiveBlock() that returns always with the ERR_BUSY error.

With the oscilloscope i can see the DRDY signal coming from the frontend at the right frequency, but NO SERIAL CLOCK SIGNAL is present when I'm trying to retrieve data. Not only, the CS pin never moves from a high level (oscilloscope tells me an average of 2,8V).

Is there something that I am missing about the settings of the SPI module? Or maybe about the connections?

I think this couldn't be dued to a loop between the cable that brings SCK and gnd because SCK signal is steady near 0V, it never moves.

Any help you could give would be greatly appreciated.

Diana

0 Kudos
1 Solution
504 Views
Jorge_Gonzalez
NXP Employee
NXP Employee

Hello dianas:

In the SPI module you have to make a dummy write to get a clock signal.

So, in this case with Processor Expert you have to call the SPI1_SendBlock() method before calling SPI1_ReceiveBlock(), considering the same amount of bytes you are expecting to receive.


Regards!,
Jorge Gonzalez

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

View solution in original post

0 Kudos
2 Replies
505 Views
Jorge_Gonzalez
NXP Employee
NXP Employee

Hello dianas:

In the SPI module you have to make a dummy write to get a clock signal.

So, in this case with Processor Expert you have to call the SPI1_SendBlock() method before calling SPI1_ReceiveBlock(), considering the same amount of bytes you are expecting to receive.


Regards!,
Jorge Gonzalez

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos
503 Views
dianas
Contributor I

Hi Jorge!

Great! Now it works a little more than before!

I put the SPI1_SendBlock() before the SPI1_ReceiveBlock(), and I can now get some data! But there's still some problem.

I can get data only once every two requests. That is, one lecture is ok and the next one returns me ERR_BUSY, again.

Now, the frontend gives me data at 250 Hz and I get them in an interrupt routine called from the frontend itself. I  don't think it takes too long for data to be transferred, even if the block is 27 bytes long.

What am I missing?

Many thanks in advance,

Diana

0 Kudos