I am trying to use SPIM2 on an NRF52840 based board. The SDK is 17.0.2.
For the life of me I cannot understand how to 'consistently' determine the values to be specified as 'tx_length' and 'rx_length' to be provided to the calls to the transfer function.
My SPI slave device is the MCP2515 which uses a protocol where the first byte of the transfer represents the command and subsequent bytes are either input or output data bytes.
Take for example a command to read 10 bytes. The command itself takes 1 byte, and therefore the total transaction spans 11 bytes (1 + 10).
So far, the only way I have been able to get this transaction to happen correctly is if I set the tx_length and rx_length input parameters BOTH to 11.
Intuitively that makes sense since the channel has to transfer 11 bytes in each direction.
BUT --- WHY BOTHER ASKING THE USERS TO SPECIFY BOTH PARAMETERS.
Why not use a single parameter and use it -- or conversely when (if at all in the case of SPI interactions) would the driver require and leverage different values for TX and RX length?