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

SPI time between sending the register address and obtaining the data

Hey! I'm writing a program for communicating  the laser sensor pmw 3610 (pixart) with the micro nrf52832. In the sensor datasheet it is said that the time between sending the address to be read and reading the data from the SDIO needs to be 4us. I'm writing my code from spi example so what I understand with nrf_drv_spi_transfer function is that it automatically retrieves data from SDIO without waiting any time. Is there some place where to set the timing between sending and receiving data? or maybe would it be possible to send something like the following? I think it can't be done but just to be sure.

Fullscreen
1
2
3
4
m_tx_buf[0]= addr;
nrf_drv_spi_transfer(&spi, m_tx_buf, 1, null, 0);
nrf_delay_us(4);
nrf_drv_spi_transfer(&spi, null, 0, m_rx_buf, 2);
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Thanks for the future help!

  • Yes - you're going to have to manually code 

    1. A transfer to send the address
    2. A delay
    3. A transfer to red  the data
  • I don't see a lot of detail but it looks like there may be a delay rx parameter you can use in the extended config struct. Take a look here.

  • Hi Patrick. I have been taken a look to what you said and (correct me if I'm wrong) I think the extended config struct is not able for nrf52832. I tried to configure it but it seems to be just for pca10056(nrf52840) not for pca10040 (the one with nrf52)

  • I believe you are correct. I did not realize at the time I replied to you. Apologies for the misdirection. 

  • I apologize, this comment will not be an answer to your question, but I'm wondering if you were able to get this working? I am currently trying to interface with the pmw 3610 sensor and am unable to find much of any information on it. You mentioned a datasheet you had for it specified 4us between address specification and reading data. Can you provide a link to said datasheet or any other SPI parameters you have configured here? I purchased a module for this sensor online and no information was provided with it. I've tried to search for the relevant datasheets online and the only one that I can find merely states that it is 3-wire SPI and what the registers are, but provides nothing else as far as the communication parameters (SPI mode, MSB vs LSB, timing requirements (ie. 4us above), etc.). I've had a heck of a time trying to get any sort of reading from this module, and unfortunately reaching out to Pixart directly has not been very fruitful either.. Any help is greatly appreciated.