AFE4400

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
lock attach
Attachments are accessible only for community members.
moro_1580446
Level 5
Level 5
100 replies posted 50 replies posted 25 replies posted

Hi everybody. I want to run AFE4400 to calculate SPO2 and Heart rate from AFE4400.I design a pcb file and connect AFE4400 with PSOC5 CY8C5468LTI_LP026

and connect spi and other pin that need to microcontroller.but I dont know why AFE4400 not responce to my write and read register function. Is there any body to know where is my mistake?

AFE4400 has a structure to read and write that I checked and I did them.Psoc creater and PCB and Schematic file attached here...

I checked SPI thata on MOSI to ensure data transfer has not any mistak but I do not seen MISO responce.here is my oscilloscope screenshot. Psoc creator file attached please tell me where is wrong?

please guide me to solve problem to read AFE4400 register data correctly.

Thanks for attention...

IMG_20200701_123112.jpg

0 Likes
1 Solution
MotooTanaka
Level 9
Level 9
Distributor - Marubun (Japan)
First comment on blog Beta tester First comment on KBA

Hi,

First of all, can you try "loop back" test?

Which is short MISO and MOSI with a jumper wire.

Then send data from PSoC.

This time you should receive the same data you have sent.

If you do not, some configuration of the firmware must be wrong.

If you received the data ok.

Then please check

(1) If PSoC's MOSI is connected to the sensor's SIMO.

(2) If the sensor is correctly powered.

(3) If the sensor's reset is not asserted always (which means always low)

If all above are fine, may be it's time to go TI's community to ask help for your sensor.

moto

P.S. BTW, in the previous 4 color wave form, the sensor was returning value,

I wonder what went wrong since then?

View solution in original post

10 Replies
lock attach
Attachments are accessible only for community members.
MotooTanaka
Level 9
Level 9
Distributor - Marubun (Japan)
First comment on blog Beta tester First comment on KBA

Hi,

I copied your SPIM_AFE44xx component to my test program for CY8CKIT-059

schematic

004-schematic.JPG

main.c

Note: I also tried "PutArray()" but result was same.

============================

int main(void)

{

    int i ;

    int num_data = 4 ;

    uint8_t tx_data[4] ;

    uint8_t rx_data[4] ;

    uint8_t address = 0x23 ;

    uint8_t value_MSB = 0x45 ;

    uint8_t value_MID = 0x67 ;

    uint8_t value_LSB = 0x89 ;

    tx_data[0] = address ;

    tx_data[1] = value_MSB ;

    tx_data[2] = value_MID ;

    tx_data[3] = value_LSB ;

   

    init_hardware() ;

   

    splash("SPIM Test") ;

   

    for(;;)

    {

#if 0

        SPIM_AFE44xx_WriteTxData(address) ;

        SPIM_AFE44xx_WriteTxData(value_MSB) ;

        SPIM_AFE44xx_WriteTxData(value_MID) ;

        SPIM_AFE44xx_WriteTxData(value_LSB) ;

#else

        SPIM_AFE44xx_ClearTxBuffer() ;

        SPIM_AFE44xx_PutArray(tx_data, 4) ;

        while(SPIM_AFE44xx_GetTxBufferSize() != 0) ;

#endif

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

            rx_data = SPIM_AFE44xx_ReadRxData() ;

        }

       

        print_result(tx_data, rx_data, num_data) ;

        CyDelay(1000) ;

    }

}

============================

wave form

Yellow: CS

Cyan: SCLK

Magenta: MOSI

Green: MISO

Note: CS return to high for each bytes

TEK0000.jpg

In the AFE4400 datasheet the SPI times are described as below

NOTE: During the 32bit transaction, CS (SPISTE) is always 0

002-SPI_Write_Timing.JPG

003-SPI_Read_Timing.JPG

So I modified the schematic as below

Note: I made CS_AFE44xx as an GPIO (initial value is 1)

005-schematic.JPG

main.c

Note: I called

        CS_AFE44xx_Write(0) ;

before writing data to SPIM

then after GetTxBufferSize() == 0

I called

        CS_AFE44xx_Write(1) ;

======================

int main(void)

{

    int i ;

    int num_data = 4 ;

    uint8_t tx_data[4] ;

    uint8_t rx_data[4] ;

    uint8_t address = 0x23 ;

    uint8_t value_MSB = 0x45 ;

    uint8_t value_MID = 0x67 ;

    uint8_t value_LSB = 0x89 ;

    tx_data[0] = address ;

    tx_data[1] = value_MSB ;

    tx_data[2] = value_MID ;

    tx_data[3] = value_LSB ;

   

    init_hardware() ;

   

    splash("SPIM Test") ;

   

    for(;;)

    {

        CS_AFE44xx_Write(0) ;

#if 1

        SPIM_AFE44xx_WriteTxData(address) ;

        SPIM_AFE44xx_WriteTxData(value_MSB) ;

        SPIM_AFE44xx_WriteTxData(value_MID) ;

        SPIM_AFE44xx_WriteTxData(value_LSB) ;

#else

        SPIM_AFE44xx_ClearTxBuffer() ;

        SPIM_AFE44xx_PutArray(tx_data, 4) ;

        while(SPIM_AFE44xx_GetTxBufferSize() != 0) ;

#endif

        CS_AFE44xx_Write(1) ;

       

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

            rx_data = SPIM_AFE44xx_ReadRxData() ;

        }

       

        print_result(tx_data, rx_data, num_data) ;

        CyDelay(1000) ;

    }

}

======================

Waveform

Note: In this test, I shorted MOSI and MISO, so MISO has signal in this wavefrom.

TEK0001.jpg

So with this, I hope that with this the sensor may return something.

moto

lock attach
Attachments are accessible only for community members.

thanks for reply. I try to make the first data to write and read register.so I do like below.but AFE4400 does not answer to me.

1-select RST and PDN pin's to high.

2-write on register 0x00->0x01 to enable read function on AFE4400

3-read register 0x30(here is not working and i cant get data from AFE4400)

I checked data from oscilloscope to be sure.data structure is true as TI reference said on below picture:

8231.Figure2.jpg-550x0.jpg

but the SOMI pin has not any data to read.Is there any body know where is mistake?

I checked my MOSI and SCLK and CS situation to be true but MISO is not back any data.

please guide me...I attached schematic and PCB and PSOC file program...

It is important for me...

Thanks for attention...

0 Likes
MotooTanaka
Level 9
Level 9
Distributor - Marubun (Japan)
First comment on blog Beta tester First comment on KBA

Hi,

I think that MISO (SOMI?) is returning value(s) in your waveform.

In the SPI communication, the value(s) returns only when SCLK (CLK) is active.

So in your case, assuming that the green signal is MISO (SOMI),

the sensor is returning value when SCLK is flipping. (The yellow box in the picture below).

001-return-value-from-MISO.JPG

moto

P.S. You may need to check the connection of MISO (SOMI) signal between the sensor and the PSoC.

yeah AFE4400 say SOMI replace of MISO(no difference)!!! anyway...

now I make a first part of MOSI as say in signal picture.but another part is not produce from AFE4400 to psoc5. Do you have any suggestion to solve that?

another question...How can set SCLK flipping without send any data from psoc5?

thankyou

0 Likes
MotooTanaka
Level 9
Level 9
Distributor - Marubun (Japan)
First comment on blog Beta tester First comment on KBA

Hi,

Basically SPI is "exchanging" protocol, sending data and receiving data are taking place same time.

Have you tried to read data which is received during transferring data to the sensor?

> another question...How can set SCLK flipping without send any data from psoc5?

You (or we) CAN NOT.

To receive data, we need to send same amount of data, although they can be all 0.

So if you need to receive data after sending command or something,

just send 0x00s or whatever, to receive the data.

moto

here is my data screenshot fro, oscilloscope:

MOSI and SCLK signal:

13.jpg

As signal I want to write 0x01 at register 0x00 to enable data read from spi and then write 0x30 to read register 0x30 at second step.

here is another screen shot from spi signal with SS and MOSI and SCLK with both channel osciloscope.

here is SS and SCLK signal :

23.jpg

here is SS and MOSI signal:

33.jpg

but unfortunately I can not see any data in MISO :

40.jpg

Can you suggest me how can I find problem?

thank you...

0 Likes
MotooTanaka
Level 9
Level 9
Distributor - Marubun (Japan)
First comment on blog Beta tester First comment on KBA

Hi,

First of all, can you try "loop back" test?

Which is short MISO and MOSI with a jumper wire.

Then send data from PSoC.

This time you should receive the same data you have sent.

If you do not, some configuration of the firmware must be wrong.

If you received the data ok.

Then please check

(1) If PSoC's MOSI is connected to the sensor's SIMO.

(2) If the sensor is correctly powered.

(3) If the sensor's reset is not asserted always (which means always low)

If all above are fine, may be it's time to go TI's community to ask help for your sensor.

moto

P.S. BTW, in the previous 4 color wave form, the sensor was returning value,

I wonder what went wrong since then?

Now it fixed.

I made a mistake to set resistance on SPI wire between PSOC5 and AFE4400.

Also I got that from EVB KIT TI AFE4400.but I think EVB KIT micro controller's voltage level is not match with AFE4400 so they say to use resistance between them.

Another thing I changed MISO pin configuration from Strong mode to High ampedance digital.

I am so sorry for this trivial mistake.

Sorry for taking time from you....

Thanks for attention dear MoTa_728816

MotooTanaka
Level 9
Level 9
Distributor - Marubun (Japan)
First comment on blog Beta tester First comment on KBA

Dear moro-san,

Thank you very much for the good news!

I know that you have been having hard time.

I'm glad hearing that it is working now.

Congratulations!

Best Regards,

13-Jul-2020

Motoo Tanaka

Thanks alot. I try to calculate spo2 and heart rate and send those data with GSM on MQTT protocol(IOT medical) to help people control their vital situation to prevent spread Covid19. and help doctor to monitor them easy and fast...

all of this feature worked just need to calculate SPO2 and then heart rate finaly.

I work hard to receive this purpose...

Thanks for attention...