mrjohnk / adns-9800 Goto Github PK
View Code? Open in Web Editor NEWAvago ADNS-9800 Test
Avago ADNS-9800 Test
Hi,
I 've got the issue that I do get x, y, squal-value and so on, but I don't upload the firmware, cause it doesn't work. The target is to read the frame data. At the moment the 900 pixels do have the value 255 or 0.
I'm working with a Atmega328P and C. My code for uploading the firmware looks like that:
`
void adns9800_srom_up(void)
{
int SROM_ID;
char buffer[10];
USART_Transmit_string("Uploud.SROM\r\n");
adns9800_write(0x39,0x02); // select 3K bytes Srom size
adns9800_write(0x13,0x1d); // srom_enable register fot initializing
_delay_us(10); // wait for one frame
adns9800_write(0x13,0x18); // srom enable register to start srom downloading
PORT_CS &= ~(1<<CS_Pin); // enable serial port
SPI_MasterTransmit(0x62 | 0x80); // start with srom burst
_delay_us(15);
int i;
unsigned char c;
for(i=0;i<firmware_length;i++)
{
c=pgm_read_byte(firmware_data + i); // load byte from firmware file
SPI_MasterTransmit(c); // transmit firmware byte
_delay_us(15);
}
//_delay_us(10);
_delay_us(161);
SROM_ID = adns9800_read(0x2a);
itoa(SROM_ID,buffer,10);
USART_Transmit_string("SROM_ID=");
USART_Transmit_string(buffer);
USART_Transmit_string("\r\n");
PORT_CS |= (1<<CS_Pin); // disable serial port
if (SROM_ID == 0x00)
{
USART_Transmit_string("Upload failed\r\n");
}
else
{
USART_Transmit_string("Upload succeed\r\n");
}
}
`
I always get 0 as SROM_ID. Might this be the reason why I don't get the real pixel data?
It would be great if you could help me with this issue!
Thanks,
Marian
I succeeded in communicating with ADNS-9800 sensor with your help. Thanks.
Further, I made some modifications to test frame capture mode.
Finally I've got some image.
But, the lower part of image is constant and the left-top of image is identical to the right-top one.)
So, the valid area in image is only 15x15 pixels, not 30x30 pixels.
I cannot figure out why I can only get a quarter of whole image.
If you have any interest, I uploaded my modified codes to https://github.com/doosik71/AdnsOpticalSensor and https://github.com/doosik71/ArduinoNanoLibrary separately.
I prefer to develop in Eclipse then Arduino IDE. I used Arduino Nano instead of Arduino Mega. So there are many changes, but the main logic flow is identical with yours.
Could you give any help again?
hi, I buy this in tindie. When I try to upload the 'ADNS9800test-serial.ino' to arduino uno, it appear below error:
'C:\Users\86150\AppData\Local\Temp\cchAhD27.ltrans0.ltrans.o: In function adns_upload_firmware': C:\CAD\arduino\ADNS-9800-master\ADNS-9800-master\Arduino Example Sketches\ADNS9800test-serial/ADNS9800test-serial.ino:140: undefined reference to
firmware_length'
C:\CAD\arduino\ADNS-9800-master\ADNS-9800-master\Arduino Example Sketches\ADNS9800test-serial/ADNS9800test-serial.ino:140: undefined reference to firmware_length' C:\CAD\arduino\ADNS-9800-master\ADNS-9800-master\Arduino Example Sketches\ADNS9800test-serial/ADNS9800test-serial.ino:141: undefined reference to
firmware_data'
C:\CAD\arduino\ADNS-9800-master\ADNS-9800-master\Arduino Example Sketches\ADNS9800test-serial/ADNS9800test-serial.ino:141: undefined reference to `firmware_data'
collect2.exe: error: ld returned 1 exit status
exit status 1
Compilation error: exit status 1'
Hey.
I'm experimenting with ADSN-9800.
For some reason, the coordinates received from the sensor do not move the cursor smoothly. If you move the sensor very slowly, the cursor moves with jerks and angularly.
If you move the sensor quickly, it is not so noticeable.
Is it possible to somehow increase the number of coordinates per second. I think that REG_Motion_Burst should help in this. Or am I wrong?
What's the difference between V2.1 and V2?
Hello there!
I am attempting to build a PCB with an intergrated ADNS-9800 and I have found your sketches to be a lovely starting point. I did however have a question about your V2.1 design: is the solder pad and resistor portion necessary to interface with the Teensy? I saw that a previous version of your .sch file didn't use them at all. I would only need to interface with the 3.3V from the Teensy, and don't need the 5V. Any help is appreciated!
The eagle files seem to differ from the actual hardware. There are no resistors on the eagle files and the jumpers are labelled differently. Is there a more up-to-date version or am I making a mistake?
Hi,
Are you just polling lower 8 bits of delta_X in
xydat[0] = (int)adns_read_reg(REG_Delta_X_L);.
If that is the case, then we could not expect any value to be more than 127 right? If so, can you guide on how to poll in both upper and lower 8 bits of dellta _X ?
Thanks
Hey, I'm trying to make this work with the Teensy 3.1. No luck so far.
When I upload the sketch, I see this in the console. Nothing happens when I move the sensor.
Uploading firmware...
Optical Chip Initialized
---
Product_ID
0
110011
33
---
Inverse_Product_ID
3F
11001100
CC
---
SROM_Version
2A
10100100
A4
---
Motion
2
100000
20
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
These are the modifications I made.
Basically I changed the motion interrupt, because Teensy 3 allows interrupts on any pin.
I also slowed down the SPI for testing and because the ARM is faster than the AVR.
Then a bit of debugging.
diff --git a/ADNS9800test.ino b/ADNS9800test.ino
index ddffcd2..7709f3e 100644
--- a/ADNS9800test.ino
+++ b/ADNS9800test.ino
@@ -50,7 +50,8 @@
byte initComplete=0;
-const int ncs = 0;
+const int ncs = 8;
+const int mot = 9;
extern const unsigned short firmware_length;
extern prog_uchar firmware_data[];
@@ -60,13 +61,14 @@ void setup() {
pinMode (ncs, OUTPUT);
- attachInterrupt(0, UpdatePointer, FALLING);
+ attachInterrupt(mot, UpdatePointer, FALLING);
SPI.begin();
SPI.setDataMode(SPI_MODE3);
SPI.setBitOrder(MSBFIRST);
- SPI.setClockDivider(2);
+ SPI.setClockDivider(64);
+ delay(5000);
performStartup();
dispRegisters();
delay(100);
@@ -175,7 +177,7 @@ void UpdatePointer(void){
readXY(&xydat[0]);
Mouse.move(xydat[0],xydat[1]);
}
- //Serial.print("x");
+ Serial.print("x");
}
void dispRegisters(void){
Any idea what is wrong?
Thanks.
I bought four ADNS-9800 sensors and tested them with your code.
But I cannot get any meaningful sensor values.
Following is the results. Could you give me any advise?
Uploading firmware... Optical Chip Initialized ADNS9800testPolling --- Product_ID 0 110011 33 --- Inverse_Product_ID 3F 0 0 --- SROM_Version 2A 0 0 --- Motion 2 0 0 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14
There is no testcode for grabbing a frame and convert it to a image.
Is this possible to add?
It would be great if someone could confirm my thoughts here:
If I want to set the sensor resolution using Teensy example (ADNS9800test.ino) to a (higher) value, I would write:
//set sensor resolution: Configuration_I for x-Axis, Configuration_V for y-Axis
//0x12 = 3600 cpi
adns_write_reg(REG_Configuration_I, 0x12 );
adns_write_reg(REG_Configuration_V, 0x12 );
in performStartup() after the laser is set & delay(1)?
And if I want to check i could then call
adns_read_reg(REG_Configuration_I);
Could someone please confirm, I am uneasy in these things : |
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.