Dimple Bhuta / Mbed 2 deprecated mbed_adns9800_v2

Dependencies:   mbed

Fork of mbed_adns9800_simlink_interface by Dimple Bhuta

Files at this revision

API Documentation at this revision

Comitter:
gigabite
Date:
Mon Jan 09 15:55:05 2017 +0000
Child:
1:b6f857ea3ce2
Commit message:
Event based implementation

Changed in this revision

adns9800.cpp Show annotated file Show diff for this revision Revisions of this file
adns9800.h Show annotated file Show diff for this revision Revisions of this file
firmware.h Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/adns9800.cpp	Mon Jan 09 15:55:05 2017 +0000
@@ -0,0 +1,150 @@
+#include "mbed.h"
+#include "adns9800.h"
+#include "firmware.h"
+
+ADNS9800::ADNS9800(PinName MOSI, PinName MISO, PinName SCK, PinName NCS):mySPI(MOSI, MISO, SCK), ncs(NCS)
+{
+    // initialize
+    initComplete = 0;
+    mySPI.format(8, 3);
+    mySPI.frequency(1000000);
+}
+
+void ADNS9800::initialize()
+{
+    comm_end();
+    comm_begin();
+    comm_end();
+
+    write_reg(REG_Power_Up_Reset, 0x5a); // force reset
+    wait_ms(50);
+
+    // read registers and discard data
+    read_reg(REG_Motion);
+    read_reg(REG_Delta_X_L);
+    read_reg(REG_Delta_X_H);
+    read_reg(REG_Delta_Y_L);
+    read_reg(REG_Delta_Y_H);
+    
+    // upload firmware
+    printf("Uploading firmware... \r\n");
+    upload_firmware();
+    wait_ms(10);
+    printf("Done... \r\n");
+    
+    // enable laser(bit 0 = 0b), in normal mode (bits 3,2,1 = 000b)
+    // reading the actual value of the register is important because the real
+    // default value is different from what is said in the datasheet, and if you
+    // change the reserved bytes (like by writing 0x00...) it would not work.
+    uint8_t laser_ctrl0 = read_reg(REG_LASER_CTRL0);
+    write_reg(REG_LASER_CTRL0, laser_ctrl0 & 0xf0);
+
+    wait_ms(1);
+
+    // initialized!
+    initComplete = 1;
+}
+
+
+void ADNS9800::comm_begin()
+{
+    ncs = 0;
+}
+
+void ADNS9800::comm_end()
+{
+    ncs = 1;
+}
+
+void ADNS9800::reset_movePin()
+{
+    // writes movement register to reset pin
+    write_reg(REG_Motion, 1);
+}
+
+uint8_t ADNS9800::read_reg(uint8_t reg_addr)
+{
+    uint8_t val;
+    comm_begin();
+    mySPI.write(reg_addr);      // send register address to read
+    wait_us(100);
+    val = mySPI.write(0x00);    // read value
+    comm_end();
+    return val;
+}
+
+void ADNS9800::write_reg(uint8_t reg_addr, uint8_t val)
+{
+    comm_begin();
+    mySPI.write(reg_addr | 0x80);
+    mySPI.write(val);
+    wait_us(20);
+    comm_end();
+    wait_us(100);
+}
+
+void ADNS9800::upload_firmware()
+{
+    write_reg(REG_Configuration_IV, 0x02);
+    write_reg(REG_SROM_Enable, 0x1d);
+    wait_ms(10);
+    
+    write_reg(REG_SROM_Enable, 0x18);
+    comm_begin();
+
+    mySPI.write(REG_SROM_Load_Burst | 0x80);
+    wait_us(15);
+
+    uint8_t c;
+    for (int i=0; i<FIRMWARE_LENGTH; i++) {
+        c = firmware_data[i];
+        mySPI.write(c);
+        wait_us(15);
+    }
+    comm_end();
+}
+
+void ADNS9800::getMovement(uint8_t *mot, int* x, int* y)
+{
+    uint8_t dx_lo, dx_hi, dy_lo, dy_hi;
+    
+    if(initComplete == 1)
+    {
+        comm_begin();
+        *mot = read_reg(REG_Motion);
+        dx_lo = read_reg(REG_Delta_X_L);
+        dx_hi = read_reg(REG_Delta_X_H);
+        dy_lo = read_reg(REG_Delta_Y_L);
+        dy_hi = read_reg(REG_Delta_Y_H);
+        comm_end();
+        
+        *x = (dx_hi << 8 | dx_lo);
+        *y = (dy_hi << 8 | dy_lo);        
+    }
+}
+
+void ADNS9800::read_burst(int* movement, int* observe, int* delta_x, int* delta_y)
+{
+    uint8_t dx_lo, dx_hi, dy_lo, dy_hi;
+    
+    // reads multiple registers in a burst
+    comm_begin();
+    mySPI.write(REG_Motion_Burst);
+    wait_us(500);
+    
+    // first reg is movement, followed by obervation, dx_lo, dx_hi, dy_lo, dy_hi, 
+    // squal, pixel_sum, max_px, min_px, shutter_upper, shutter_lower, frame_period_upper, frame_period_lower
+    // we only read the first 6 bytes
+    
+    *movement = mySPI.write(0);
+    *observe = mySPI.write(0);
+    dx_lo = mySPI.write(0);
+    dx_hi = mySPI.write(0);
+    dy_lo = mySPI.write(0);
+    dy_hi = mySPI.write(0);
+    
+    comm_end();
+    
+    *delta_x = (dx_hi << 8 | dx_lo);
+    *delta_y = (dy_hi << 8 | dy_lo);    
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/adns9800.h	Mon Jan 09 15:55:05 2017 +0000
@@ -0,0 +1,79 @@
+#ifndef ADNS9800_H
+#define ADNS9800_H
+
+#include "mbed.h"
+
+// Registers
+#define REG_Product_ID                           0x00
+#define REG_Revision_ID                          0x01
+#define REG_Motion                               0x02
+#define REG_Delta_X_L                            0x03
+#define REG_Delta_X_H                            0x04
+#define REG_Delta_Y_L                            0x05
+#define REG_Delta_Y_H                            0x06
+#define REG_SQUAL                                0x07
+#define REG_Pixel_Sum                            0x08
+#define REG_Maximum_Pixel                        0x09
+#define REG_Minimum_Pixel                        0x0a
+#define REG_Shutter_Lower                        0x0b
+#define REG_Shutter_Upper                        0x0c
+#define REG_Frame_Period_Lower                   0x0d
+#define REG_Frame_Period_Upper                   0x0e
+#define REG_Configuration_I                      0x0f
+#define REG_Configuration_II                     0x10
+#define REG_Frame_Capture                        0x12
+#define REG_SROM_Enable                          0x13
+#define REG_Run_Downshift                        0x14
+#define REG_Rest1_Rate                           0x15
+#define REG_Rest1_Downshift                      0x16
+#define REG_Rest2_Rate                           0x17
+#define REG_Rest2_Downshift                      0x18
+#define REG_Rest3_Rate                           0x19
+#define REG_Frame_Period_Max_Bound_Lower         0x1a
+#define REG_Frame_Period_Max_Bound_Upper         0x1b
+#define REG_Frame_Period_Min_Bound_Lower         0x1c
+#define REG_Frame_Period_Min_Bound_Upper         0x1d
+#define REG_Shutter_Max_Bound_Lower              0x1e
+#define REG_Shutter_Max_Bound_Upper              0x1f
+#define REG_LASER_CTRL0                          0x20
+#define REG_Observation                          0x24
+#define REG_Data_Out_Lower                       0x25
+#define REG_Data_Out_Upper                       0x26
+#define REG_SROM_ID                              0x2a
+#define REG_Lift_Detection_Thr                   0x2e
+#define REG_Configuration_V                      0x2f
+#define REG_Configuration_IV                     0x39
+#define REG_Power_Up_Reset                       0x3a
+#define REG_Shutdown                             0x3b
+#define REG_Inverse_Product_ID                   0x3f
+#define REG_Motion_Burst                         0x50
+#define REG_SROM_Load_Burst                      0x62
+#define REG_Pixel_Burst                          0x64
+
+
+class ADNS9800
+{
+public:
+    // constructor
+    ADNS9800(PinName MOSI, PinName MISO, PinName SCK, PinName NCS);
+    void initialize();
+    void read_burst(int *movement, int *observe, int *delta_x, int *delta_y);
+    void getMovement(uint8_t *mot, int *delta_x, int *delta_y);  
+    uint8_t read_reg(uint8_t);
+    void write_reg(uint8_t, uint8_t);  
+    void comm_begin();
+    void comm_end();
+    void reset_movePin();
+    
+private:
+    int initComplete;
+    SPI mySPI;
+    DigitalOut ncs;
+    
+    void upload_firmware();
+};
+
+
+
+
+#endif
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/firmware.h	Mon Jan 09 15:55:05 2017 +0000
@@ -0,0 +1,3083 @@
+#ifndef FIRMWARE_H
+#define FIRMWARE_H
+
+#include "mbed.h"
+#define FIRMWARE_LENGTH 3070
+
+// Firmware "adns9800_srom_A4.txt" from 
+// This firmware is Copyright Avago, please refer to them concerning modifications.
+
+const unsigned char firmware_data[] = {
+0x03,
+0xa6,
+0x68,
+0x1e,
+0x7d,
+0x10,
+0x7e,
+0x7e,
+0x5f,
+0x1c,
+0xb8,
+0xf2,
+0x47,
+0x0c,
+0x7b,
+0x74,
+0x4b,
+0x14,
+0x8b,
+0x75,
+0x66,
+0x51,
+0x0b,
+0x8c,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,
+0xf1,
+0x79,
+0x08,
+0x86,
+0x0f,
+0x52,
+0x98,
+0x73,
+0xc4,
+0x92,
+0x90,
+0x2b,
+0x47,
+0x09,
+0xd0,
+0x43,
+0x6c,
+0x2f,
+0x20,
+0xeb,
+0xdc,
+0xda,
+0xc5,
+0x08,
+0x7b,
+0x94,
+0x42,
+0x30,
+0x6a,
+0xc7,
+0xda,
+0x8c,
+0xc3,
+0x76,
+0xa7,
+0xa5,
+0xcc,
+0x62,
+0x13,
+0x00,
+0x60,
+0x31,
+0x58,
+0x44,
+0x9b,
+0xf5,
+0x64,
+0x14,
+0xf5,
+0x11,
+0xc5,
+0x54,
+0x52,
+0x83,
+0xd4,
+0x73,
+0x01,
+0x16,
+0x0e,
+0xb3,
+0x7a,
+0x29,
+0x69,
+0x35,
+0x56,
+0xd4,
+0xee,
+0x8a,
+0x17,
+0xa2,
+0x99,
+0x24,
+0x9c,
+0xd7,
+0x8f,
+0xdb,
+0x55,
+0xb5,
+0x3e
+};
+
+#endif
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Mon Jan 09 15:55:05 2017 +0000
@@ -0,0 +1,133 @@
+#include "mbed.h"
+#include "adns9800.h"
+
+InterruptIn pulse(p8); // connects to FPGA and listens for start recording pulse
+DigitalOut gndPin(p7);
+DigitalOut ledPin(LED1);
+ADNS9800 adns(p11,p12,p13,p10);
+Serial pc(USBTX, USBRX);
+int dx, dy, movementFlag, recFlag;
+Ticker tmr;
+uint32_t time_start, time_now, time_elapsed;
+
+void displayRegisters()
+{
+  int oreg[4] = {0x00,0x3F,0x2A,0x02};
+  char* oregname[] = {"Product_ID:","Inverse_Product_ID:","SROM_Version:","Motion:"};
+  uint8_t regres;
+  
+  int rctr;
+  
+  for(rctr=0; rctr<4; rctr++){
+    pc.printf("---\r\n");
+    regres = adns.read_reg(oreg[rctr]);
+    pc.printf(oregname[rctr]);
+    pc.printf("%02x\r\n", regres);
+    wait_ms(1);
+  }
+}
+
+void read_motion()
+{
+    int motion, obs;
+    adns.read_burst(&motion, &obs, &dx, &dy);
+    if(recFlag == 1 && (dx > 0 || dy > 0))
+    {
+        time_now = us_ticker_read();
+        time_elapsed = time_now - time_start;
+        time_start = time_now;
+        
+        movementFlag = 1;
+    }
+}
+
+void start_rec()
+{
+    recFlag = 1;
+    ledPin = 1;
+    time_start = us_ticker_read();
+}
+
+void stop_rec()
+{
+    ledPin = 0;
+    recFlag = 0;
+}
+
+void format_and_send()
+{
+    // follow LSA's packet format
+    /*
+     * Data format from microblaze to PC:
+     * 1PZZZMTT_0TTTTTTT_0TTTTTTT_00XXXXXX_00YYYYYY
+     * Where T = timestamp, P = polarity, X = xcoord, Y = ycoord, Z = type of spike, M = mouse pkt bit
+     * Only first byte has MSB set
+     * M bit will be used to indicate this is a mouse sensor data
+     * timestamp in 100us per increment
+     * dx = 0(PX)XXXXXX where 2nd bit is polarity
+     */ 
+     
+     uint8_t outPkt[5];
+     time_elapsed = time_elapsed / 100;
+     
+     outPkt[0] = 0x84 | ((time_elapsed >> 14) & 0x00000003);
+     outPkt[1] = ((time_elapsed >> 7) & 0x0000007F);
+     outPkt[2] = (time_elapsed & 0x0000007F);
+     
+     if(dx & 0x8000)
+     {
+         dx = (dx^0xFFFF) + 1;
+         outPkt[3] = 0x40 | (dx & 0x3F); // negative
+     }
+     else
+     {
+         outPkt[3] = dx & 0x3F;
+     }
+     
+     if(dy & 0x8000)
+     {
+         dy = (dy^0xFFFF) + 1;
+         outPkt[4] = 0x40 | (dy & 0x3F);
+     }
+     else
+     {
+         outPkt[4] = dy & 0x3F;
+     }
+     
+     // send packet
+     for (int i=0; i<5; i++)
+     {
+        pc.putc(outPkt[i]);
+     }        
+}
+
+int main() {
+    gndPin = 0; // lazy to connect to true ground pin
+    movementFlag = 0;
+    recFlag = 0;
+    
+    pc.baud(115200);
+    pc.printf("ADNS9800 test\r\n");
+    
+    adns.initialize();
+    
+    // display registers
+    displayRegisters();
+    
+    pc.printf("Sensor initialized\r\n");
+    
+    // for sync with FPGA
+    pulse.rise(&start_rec);
+    pulse.fall(&stop_rec);
+    
+    tmr.attach_us(&read_motion, 1000); // timer interrupt to read registers
+    
+    while(1) {
+        
+        if(movementFlag == 1)
+        {
+            format_and_send();
+            movementFlag = 0;
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Mon Jan 09 15:55:05 2017 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/2241e3a39974
\ No newline at end of file