Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 17 of 17

Thread: How to read data from an SPI device

  1. #1

    How to read data from an SPI device

    Hello all
    I have an infrared camera that detects up to 16 blobs and gives the x and y coordinates.
    But how do i retrieve this data from the device registries?
    Below is the link to the products page
    There is only a data sheet there too.
    Any help would be awesome.

    http://www.pixart.com.tw/product_dat...mber=PAJ7025R2

  2. #2
    Senior Member+ manitou's Avatar
    Join Date
    Jan 2013
    Posts
    2,198
    Google wasn't much help -- often someone has already written a library for common SPI devices. The data sheet does describe each of the registers that can be read or written with SPI, but not what the exact values are in the registers, nor the order of register access that might be required. maybe someone at pixart can provide you more details.

    if you've never written a sketch to utilize a SPI device you might bring up the Arduino/Teensy IDE and look at Examples > SPI > BarometricPressureSensor. That sketch shows how to read and write the registers on that sensor. And you need to wire up 3.3v and grnd, plus the 4 SPI pins (MOSI,MISO,CLK,CS). sparkfun.com and adafruit.com have tutorials for various SPI devices, showing how to wire-up and program those devices.

    good luck

  3. #3
    Yes, i was trying use someother example to kinda find my way to the data on the chip but i couldn't. Is there a way to call up all the registers like a "*.*" ?
    I did email them at pixart to see if i can get some sample code.

  4. #4
    Alright so after a lot of work i was able to get the device to give me a 0-255 reading through serial print. Where do you suggest going from there?

  5. #5
    Junior Member
    Join Date
    Jun 2017
    Posts
    2
    Hi,

    ben10teensy can you please share code with me ? I' trying to make PAJ7025R3 (newer version of PAJ7025) but still not successful.

  6. #6
    Junior Member
    Join Date
    Jun 2017
    Posts
    2
    If I wire it correctly, should the sensor draw current even if I don't configure it correctly ?

  7. #7
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    20,576
    That depends on the sensor.

    But with many SPI chips, this is normal to see them power up in active mode. Many only go into a very low power mode if specifically told to do so. Some use a command over the SPI, but also very common is a dedicated pin to put the chip into a deep power-down mode.

  8. #8
    Hey guys
    So ive just bought a new teensy 3.2
    I was looking over the spi.transfer
    And I need to read from a register
    As i look over the documentation on spi
    It says it writes and also reads at the same time.
    But if i send a dummy number to initiate
    How do i know its going to the right registry
    And its reading from the right reg?

  9. #9
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    5,424
    Depends on what you are talking to. What device?

  10. #10
    Its not a device that has a written library
    So im trying to get the basic transaction
    To send it settings and also know how to recieve
    Data

  11. #11
    Junior Member
    Join Date
    Aug 2018
    Posts
    3
    Hello,
    did anyone managed to receive data from this device and can share the code.
    thanks

  12. #12
    Reading data is based upon how better your sensors are working. And with the help of sample coded you can read the data. Following syntax and description make you to do this.

  13. #13
    Junior Member
    Join Date
    Aug 2018
    Posts
    3
    I didn't really understand your answer. let me clarify my question:
    I would like to know if anyone have managed to work with the sensor PAJ7025R2. and if so can he share a sample code
    thanks

  14. #14
    Senior Member
    Join Date
    Jul 2014
    Posts
    2,335
    Quote Originally Posted by baklawe View Post
    I didn't really understand your answer. let me clarify my question:
    I would like to know if anyone have managed to work with the sensor PAJ7025R2. and if so can he share a sample code
    thanks
    if you have a device, maybe you can post the register descriptions of the sensor, and communication protocol, so we can help.
    The Pixart.com provided documentation is completely useless.

  15. #15
    Junior Member
    Join Date
    Aug 2018
    Posts
    3
    I have uploaded a data sheet i found with the register data. im New to using SPI communication so i dont really know how to use it
    Click image for larger version. 

Name:	rigister bank.PNG 
Views:	68 
Size:	307.1 KB 
ID:	14504Click image for larger version. 

Name:	rigister bank2.PNG 
Views:	37 
Size:	175.4 KB 
ID:	14505

    I hope this provide some information

  16. #16
    Senior Member+ Theremingenieur's Avatar
    Join Date
    Feb 2014
    Location
    Colmar, France
    Posts
    2,534
    In the data sheet, there should, besides of the register reference, be a description how and which reading commands would have to be sent to the chip over SPI to get the register content back. But...

    ...as far as I could find out with the help of Mrs Google, these technical details seem to be closed source by Pixar Inc and nowhere published on the www. Thus, you'll probably have to look for a different sensor model.

    Edit: Here is something which could be helpful for you: http://www.stephenhobley.com/blog/20.../#comment-4173
    Last edited by Theremingenieur; 08-21-2018 at 11:51 AM.

  17. #17
    Junior Member
    Join Date
    Nov 2018
    Posts
    3
    Necroing a thread here, I wrote a driver for this fantastic little chip but it's in no shape to be released and needs a TON of cleanup and optimization work done on it. Above posters were correct in saying that the datasheets are NDA locked, it's a bit of a pain to get them to even talk to you and sign the NDA but look deep enough on the net and you'll find prior generations (under a different part number) datasheets out there. I did get permission from PXI to release an open source driver for it but I'm gonna hold on that until I can get it into a standard arduino compatible library format.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •