-
Notifications
You must be signed in to change notification settings - Fork 182
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
TLV493d - ADC hang up in Master Controlled or Fast Mode #21
Comments
Same here.. works for a few minutes, then stops. Any suggestions? |
@Burke111-DEV This code (https://github.com/Launcherspider/3D-Spacemouse) worked for me on Windows.. No hangups. |
@geroulas Thanks for sharing that project. I've made a lot of changes to Salim's original
I'm quite happy with how it has turned out, and sounds like you might be interested in these features. But I don't want to release my project details and files until I've got a solution to the intermittent hangup issue,, For awareness, this is definitely a bug in the magnetometer, and not a quirk in the code.
Additionally, the datasheet even mentions that it is a known issue, and comments in the official Infineon library for this sensor make reference to it. Supposedly, the fix is to try to "reset" the device. But none of my attempts to do so have been successful. Was hoping someone might know something. |
@Burke111-DEV woww man.. I was sure that was a different code.. but you are right! I was comparing it to the code I was running and I have altered some things compared to the original. I've been running it all moring without issues. Now that i got back from work, it hangs if I leave it alone for some minutes.. I also noticed that it wont work If Serial Monitor is not open. Íf I plug in the device, it will run for a few seconds then stops, if I open Arduino and Serial Monitor it stars working again. I close serial monitor and stops working. Maybe I've done something wrong, or maybe that helps you in some way... In my case, I use the Waveshare RP2040-Zero, and in order to make it work I changes this I will follow your links and try the reset method, see if I come up with something. I'm not really familiar with Arduino projects, but I will experiment. I would love to see your project when you decide to release it! It will give life to this device for sure! |
@geroulas Salim uses the Adafruit QT PY RP2040 in the original design. In particular, it is good for this project because it has the STEMMA connector which makes connecting up to the Adafruit TLV493d magnetometer module much simpler. The Adafruit QT PY RP2040 has two I2C interfaces - i2c0 and i2c1. Both are usable, just two separate busses. So presumably, the I2C bus you wired your magnetometer to on your RP2040uC board is the i2c0 one, so you need If I can't find a solution to the intermittent issue soon, I'll likely just publish the details of my project anyway and hope someone sees it and can help solve the I2C lockup on there. |
@Burke111-DEV Thanks for the input, I did read about all these, and now i'm in a good place now. I think I have a something that might be working. I'm trying to re-initialize the sensor when it hangs. I've added a code that compares the last values of the sensor with the previous ones. If xCurrent, yCurrent & zCurrent are exactly the same with xLast, yLast, zLast that must mean the sensor hang and reports the same values again and again. I've also remapped the two buttons. One button is jsut running the code to initialise the sensor. So when I see the knob not responding, I press the button and it's live again. I read somewhere that by sending a 0x00 singal to the I2C it resets the sensor, so that's what i did here. I think it might be working even wihtout this and you just have initialize.... Also the entire code is doing Keyboard.press() and Keyboard.release all the time, I thinks that's bad for the controller. So I changed that part as well and I think it helps. Especially the shift key was not behaving well. The program was freezing and the Shift button was still pressed. For now I have it running only in Orbit mode (Fusion360).. just to see how it behaves. Check the code, see if you can replicate this.
EDIT: I Changed to code to compare Last Values but over a period of iterations maxUnchangedCount=100. So If the sensor report the exact same values for 100 times it will reset. |
@geroulas On my end, I think I may have solved it. Due to the completely random occurence of the bug, it's difficult to say with 100% certIainty that this is a definite fix. So I will post my code and 3D files when my free time permits :) |
I made a fork of Infineon's lirbary, adding the required fix to get it working. Also find a basic usage example on the readme. I'll also put the rest of my project code and files up when I get a chance to organise it. |
How are you guys getting around the ADC hangup issue for the magnetometer?
I'm constantly getting lockups making it unusable.
The text was updated successfully, but these errors were encountered: