This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

SPI read and write

Dose this capture from the Nordic Specification means that to read bytes from SPI i need to send before. Each byte i send i get a byte!!! MLy case i have read only sensor that sends periodically. If it is mandatory to send in order to receive so i have to send 4 bytes to receive the 4 bytes i am looking for.11.PNG

Parents
  • Hi,

    SPI is typically implemented using shift registers, meaning that data is clocked out of the master shift register and into the slave register through the MOSI line, and similarly, out of the slave shift register and into the master register through the MISO line.

    In theory, you should be able to clock in the data through the MISO line without having the MOSI line connected. You are still required to "send" dummy data from the master, to make the clock run.

    This operation will depend on your sensor. Could you provide details on the device? Then I might be able to help you with your setup.

    Best regards,

    Jørgen

  • I have another question : i am using the header provided by Nordic "nrf_spim.h" and it give an API it says :

    nrf_spim_task_trigger(&stSPI_iNRF_SPI_Type,NRF_SPIM_TASK_START);
    

    So TASK start is launching an SPI transaction as in the documentation

    /**
     * @brief SPIM tasks.
     */
    typedef enum
    {
        /*lint -save -e30*/
        NRF_SPIM_TASK_START   = offsetof(NRF_SPIM_Type, TASKS_START),   ///< Start SPI transaction.
        NRF_SPIM_TASK_STOP    = offsetof(NRF_SPIM_Type, TASKS_STOP),    ///< Stop SPI transaction.
        NRF_SPIM_TASK_SUSPEND = offsetof(NRF_SPIM_Type, TASKS_SUSPEND), ///< Suspend SPI transaction.
        NRF_SPIM_TASK_RESUME  = offsetof(NRF_SPIM_Type, TASKS_RESUME)   ///< Resume SPI transaction.
        /*lint -restore*/
    } nrf_spim_task_t;
    

    When you launch a transaction dose it launch clk ???

Reply
  • I have another question : i am using the header provided by Nordic "nrf_spim.h" and it give an API it says :

    nrf_spim_task_trigger(&stSPI_iNRF_SPI_Type,NRF_SPIM_TASK_START);
    

    So TASK start is launching an SPI transaction as in the documentation

    /**
     * @brief SPIM tasks.
     */
    typedef enum
    {
        /*lint -save -e30*/
        NRF_SPIM_TASK_START   = offsetof(NRF_SPIM_Type, TASKS_START),   ///< Start SPI transaction.
        NRF_SPIM_TASK_STOP    = offsetof(NRF_SPIM_Type, TASKS_STOP),    ///< Stop SPI transaction.
        NRF_SPIM_TASK_SUSPEND = offsetof(NRF_SPIM_Type, TASKS_SUSPEND), ///< Suspend SPI transaction.
        NRF_SPIM_TASK_RESUME  = offsetof(NRF_SPIM_Type, TASKS_RESUME)   ///< Resume SPI transaction.
        /*lint -restore*/
    } nrf_spim_task_t;
    

    When you launch a transaction dose it launch clk ???

Children
No Data
Related