How to tx data exceed 16 bytes?

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

cross mob
Anonymous
Not applicable

Hi,

The document named "WICED Smart Hardware Interfaces" tell the maximum transaction size is 16 bytes for SPIFFY1 and SPIFFY2.

I tried to send 24 bytes data by the following code.

static const int CS_PORT = 33 / 16;

static const int CS_PIN = 33 % 16;

static const int MAX_BYTES = 16;

void

SPI_write(int pinCS, uint8_t* data, int length) {

    while (length > 0) {

        int bytes = length;

        if (bytes > MAX_BYTES)

            bytes = MAX_BYTES;

   

        gpio_setPinOutput(CS_PORT, CS_PIN, GPIO_PIN_OUTPUT_LOW);

        spiffyd_txData(SPIFFYD_2, bytes, data);

        gpio_setPinOutput(CS_PORT, CS_PIN, GPIO_PIN_OUTPUT_HIGH);

        length -= bytes;

        data += bytes;

    }

}

But the firmware crashed in spiffyd_txData.

How to send data exceed 16 bytes?

0 Likes
1 Solution
Anonymous
Not applicable

Hi boont,

Thanks for the reply.

I checked out the spi_comm_master sample app.

It starts to send SPI data as master in application_spiffy2_send_bytes called from the following functions.

- spi_comm_master_fine_timeout ... Fine Timer Callback

- application_gpio_interrupt_handler ... GPIO interrupt handler

- spi_comm_master_write_handler ... BLE write handler

I understood that my app must use Fine Timer Callback to send data more than 15  bytes if it does not support FlowControl with slave !

View solution in original post

0 Likes
2 Replies
BoonT_56
Employee
Employee
500 likes received 250 likes received 100 likes received

Check out this thread.

Very long SPI Transfer on the BCM20737

You may also like to check out the spi_comm_master/slave apps in the SDK.

moicci

0 Likes
Anonymous
Not applicable

Hi boont,

Thanks for the reply.

I checked out the spi_comm_master sample app.

It starts to send SPI data as master in application_spiffy2_send_bytes called from the following functions.

- spi_comm_master_fine_timeout ... Fine Timer Callback

- application_gpio_interrupt_handler ... GPIO interrupt handler

- spi_comm_master_write_handler ... BLE write handler

I understood that my app must use Fine Timer Callback to send data more than 15  bytes if it does not support FlowControl with slave !

0 Likes