-
Notifications
You must be signed in to change notification settings - Fork 197
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Arduino lepton_command SET commands not working? #5
Comments
here is something I found in the IDD document. I think the arduino agc_enable is not correct. |
Right, I saw that as well. This is very confusing because on page 16 it says AGC module ID is B0001, then in your example it says the AGC SDK module is 0x100. I was assuming the 0x100 ID was only used in the SDK, but then it showed it being used in a raw calculation of the Command ID... so I'm confused. |
I was confused as well. I don't think I got it correct for writing only
|
I compiled and reverse engineered the SDK to see how it wrote commands. In so many words, the flow diagram on pg 11 of the LSIDD is generally correct, but exactly what needs to be written to the DATA registers isn't always clear. Instead of having a generic lepton_command function for GETs and SETs, I think it may be best to have a lepton_get function for all GETs and a separate function for SETs because the SETs will need 2 more inputs, 'data' and 'data_length'. C++ and arduino is kinda raw for me, I'm a Matlab/C guy. I'm not sure if you can overload arduino functions. Depending how much time I have to work on it, I'll try to have a patch proposed tomorrow night. |
Any update on this? Why aren't the DATA and DATA_LEN registers set in this function? |
Apologies for forgetting about this. I got a couple specific commands working and was trying to generalize it out to all commands, but got sidetracked. I'll try to upload my limited example after I get back home this weekend. |
So does it isn't as clearcut as writing to the data registers and sending On Sat, Nov 29, 2014 at 11:42 AM, Adam Griffin notifications@github.com
|
In general it is just as simple as sending, in this order, data to the data registers, data length to the data length register, and then the command to the command register. However, while it may be trivial to some people, the details of this were somewhat confusing to me until I ran through the official SDK to see what it was doing. One confusing problem was that the register addresses and sizes are all 16bit, but Wire.write(); only writes single bytes. Another problem was translating the functions in the SDK to data_reg binary values. Finally, unless I misunderstood, several places in the SDK and software interface description document say the data_len register should be populated with the number of data registers written, but it actually needs to be the number of bytes written. (2x the number of written regs) This function works (as of a month or two ago):
It seems intuitive that the AGC enable command is 1 and disable is 0, but what about more complicated commands? There are only 2 versions of output available in this version of lepton RAW14 (default) and RGB888. The command to switch to RGB888 is 0x0003 and the command to switch back to RAW14 is 0x0007. Turns out this is buried in an enum in the SDK. I was hoping to eventually have definitions for LEP_VIDEO_OUTPUT_FORMAT_RGB888, LEP_VIDEO_OUTPUT_FORMAT_RAW14 etc, but got ADD and switched projects. Hopefully the function above can be adapted for whatever you need. |
I just give the lepton 5V power and SCL and SDA signal ,can I read the data of status register |
How did you know what to write to the data register?
Isn't this a SET command not GET? But the code seems to work I am getting a none 0 value from agc read now. |
Nevermind I figured it out 0x01 is to enable AGC and 0x00 is to disable. |
well,I use STM32 SPI to transfer the data,how can i idenftify then avilable 2016-09-23 9:24 GMT+08:00 Patrickyp notifications@github.com:
|
Running
both before and after
yields the same response.
also has no effect.
The Lepton Software Interface Description Document relies heavily on the SDK doing everything for you. It isn't clear to me exactly how you give the lepton the values you want to set. It doesn't seem to be a part of the command. I first thought you didn't need to send anything other than the command -- it would maybe toggle it -- but that doesn't seem to be happening.
The flowchart for Host Write Attribute on page 11 seems to say you must write what you want to 'SET' into the data registers and set the length register prior to writing the SET command, but what 16 bits should I send? 0xffff to turn on and 0x0000 to turn off?
I suppose I could reverse engineer the SDK, but it should be easier than that.
The text was updated successfully, but these errors were encountered: