SPI timing

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

cross mob
Anonymous
Not applicable

Hi all,

I have a problem when I use SPI as slave mode ( BCM20732).

When I receive data from external MCU via SPI, I try to write this data to a characteristic value.

Code below:

                    spiffyd_slaveRxData(SPIFFYD_2, length, &buffer[1]);                 

                    db_pdu.len = length;

                    memcpy(db_pdu.pdu, &buffer[1],length);

                    bleprofile_WriteHandle(HANDLE_SPI_CHARACTERISTIC_SEND_DATA_VALUE, &db_pdu);

                    bleprofile_sendNotification(HANDLE_SPI_CHARACTERISTIC_SEND_DATA_VALUE, (UINT8 *)db_pdu.pdu, db_pdu.len);

It's take about 3ms to do this.

And when I don't write data to characteristic value:

                    spiffyd_slaveRxData(SPIFFYD_2, length, &buffer[1]);                 

                    db_pdu.len = length;

                    memcpy(db_pdu.pdu, &buffer[1],length);

                   // bleprofile_WriteHandle(HANDLE_SPI_CHARACTERISTIC_SEND_DATA_VALUE, &db_pdu);

                  //  bleprofile_sendNotification(HANDLE_SPI_CHARACTERISTIC_SEND_DATA_VALUE, (UINT8 *)db_pdu.pdu, db_pdu.len);


It's take only about 100us.

Why do bleprofile_WriteHandle() and bleprofile_sendNotification() functions take a long time?

How can I speed up this?

0 Likes
1 Reply
JaWa_2142591
Level 5
Level 5
25 likes received 10 likes received First like received

Can I know how do you measure the time? Start and stop at where?

If you are talking about late receiving at central side, you can try to use an aggressive connection interval by calling lel2cap_sendConnParamUpdateReq() after connection is up but that could consume more battery power.