Hi,
I'm using SPI from ASF and there is a problem on the function spi_write_packet. Per example:
spi_write_packet(&SPIC, data, 3);
it will send only 2 bytes and not 3.
spi_write_packet(&SPIC, data, 1);
it will send 1 byte but
spi_write_packet(&SPIC, data, 2);
also send only one byte :s
I checked it on the logic analyser after spend some time wondering why the radio transceiver was discard the packets because incorrect payload, the problem comes from this function that send one byte less that the one I pass as argument.
Do you have any idea why that happens?
This is how I'm using it:
void spi_write_multiple_teste(uint8_t * data, uint8_t len){ struct spi_device spi_device_conf = { .id = IOPORT_CREATE_PIN(PORTR, 0) }; spi_select_device(&SPIC, &spi_device_conf); spi_write_packet(&SPIC, data, 3); spi_deselect_device(&SPIC, &spi_device_conf); }
I hardcoded the len value for debug purpose. You can see the attached image of this case.
Thank you