- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I downloaded the sample apps and am able to confirm that connection to the USB port works.
However, when I try the python code at Infineon/magnetic-3d-mini-controller (github.com)
the processing stops at the file magnetic-3d-mini-controller/m97_sensorCom.py at master · Infineon/magnetic-3d-mini-controller (githu...
line 49 which is: msg_b = serial.read(8)
I followed the steps in the Readme.md file and I am stuck at this line.
Solved! Go to Solution.
- Labels:
-
3D Hall Sensors
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi @ByronForWork ,
Apologies for late reply.
Thanks for figuring it out, the device is not flashed thus, not able to program.
For specifying target interface give: SWD
Then speed = 4000KHz
Best regards,
Yashraj
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello @ByronForWork ,
Is the code stuck when you are running m01_StoreCalibData.py script?
If yes, you have to align the magnet and the sensor position properly and follow the instructions of moving and tilting the MiniControl2Go kit. Because , if the magnet and sensor is not aligned properly then it is stuck.
Best regards,
Yashraj
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yes, it is stuck when running that script. I have tried to align, I'm not sure at exactly what point is acceptable.
If I run the TLx93D MS2go software all of the samples work, so why not these scripts?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Byron,
So the actual reason why the code example is sensitive to calibration, we can find the reason in the code itself. Check the line 102-109 in m01_StoreCalibData.py which explains the process. The check fails minDist is below 160, and thus ensuring strict calibration.
if dev_mean < 2: # threshhold=2 seems good
print("yes")
# test if this state was already stored
minDist = np.amin(np.linalg.norm(CALIB_DATA-BUF_av,axis=1)) # min dist to other stored states
if minDist > 160:
# different calib states are at least ~200LSB apart. By choosing a large threshhold
# here we avoid to accidently sample states that are close to each other.
# E.g. after tilting we move back to the center. The system then detects a new stable
# center state that will be close to the first one. But because we have rotated the
# system a little bit by accident it will not be very close. This must be caught by
# this theshhold.
# This is also the reason why we initialize CALIB_DATA with very 'distant' states.
print('State ' + str(s1) + ' detected!')
if ii == 19:
print('Done')
else:
#print( s2 + ' to next position ' + str(S1[ii+1]))
print(text_output[ii])
print('##################')
Best regards,
Yashraj
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Yashraj,
I do not think you understand. No value check can be made because no bytes are being read. The program code stops on the read statement and does not continue.
m01_StoreCalibData.py line 87 calls
m97_sensorCom.py and stops on line 49
The WPF sample software works, but there is no source code available for it.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi @ByronForWork ,
Well if the code was stuck it should eventually throw up an error on console window. I hope you are not seeing any error code, if yes please share that.
To check if nothing is being read, please try printing "msg_b" variable.
Add the following line in the m97_sensorCom.py:
msg_b = serial.read(8)
print(msg_b)
If this doesn't print read bytes, then it means that there is serial communication. If there is any such error please share.
Best regards,
Yashraj
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Yashraj,
No error. It just stops on line 49 and does not get to the print (msg_b)
Here's the output:
----
XMC found on port: COM4
Serial Connection Done
------------------------
Start calibration scheme
Please verify that the direction knob is initially pointing to the Forward position (Relative to the 0°). Press enter when ready.
######################
----
And that's it.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I'm wondering if I ran the flash.bat correctly. Not knowing what values to select, I just push enter choosing the defaults. Here is the output:
Flash.bat output
PS C:\All\3DMouse\magnetic-3d-mini-controller\flash_xmc> .\flash.bat
C:\All\3DMouse\magnetic-3d-mini-controller\flash_xmc>JLink.exe -CommanderScript flash2GoKit.jlink
SEGGER J-Link Commander V6.80a (Compiled May 29 2020 16:28:01)
DLL version V6.80a, compiled May 29 2020 16:27:00
J-Link Command File read successfully.
Processing script file...
J-Link connection not established yet but required for command.
Connecting to J-Link via USB...O.K.
Firmware: J-Link Lite-XMC4200 Rev.1 compiled Mar 1 2019 11:28:26
Hardware version: V1.00
S/N: 591152897
VTref=3.300V
Target connection not established yet but required for command.
Please specify target interface:
- J) JTAG (Default)
- S) SWD
- T) cJTAG
TIF>
Device position in JTAG chain (IRPre,DRPre) <Default>: -1,-1 => Auto-detect
JTAGConf>
Specify target interface speed [kHz]. <Default>: 4000 kHz
Speed>
Device "XMC1100-0064" selected.
Connecting to target via JTAG
TotalIRLen = ?, IRPrint = 0x..000000000000000000000000
TotalIRLen = ?, IRPrint = 0x..000000000000000000000000
TotalIRLen = ?, IRPrint = 0x..000000000000000000000000
TotalIRLen = ?, IRPrint = 0x..000000000000000000000000
Cannot connect to target.
Target connection not established yet but required for command.
Device "XMC1100-0064" selected.
Connecting to target via JTAG
TotalIRLen = ?, IRPrint = 0x..000000000000000000000000
TotalIRLen = ?, IRPrint = 0x..000000000000000000000000
TotalIRLen = ?, IRPrint = 0x..000000000000000000000000
TotalIRLen = ?, IRPrint = 0x..000000000000000000000000
Cannot connect to target.
Target connection not established yet but required for command.
Device "XMC1100-0064" selected.
Connecting to target via JTAG
TotalIRLen = ?, IRPrint = 0x..000000000000000000000000
TotalIRLen = ?, IRPrint = 0x..000000000000000000000000
TotalIRLen = ?, IRPrint = 0x..000000000000000000000000
TotalIRLen = ?, IRPrint = 0x..000000000000000000000000
Cannot connect to target.
Script processing completed.
PS C:\All\3DMouse\magnetic-3d-mini-controller\flash_xmc>
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi @ByronForWork ,
Apologies for late reply.
Thanks for figuring it out, the device is not flashed thus, not able to program.
For specifying target interface give: SWD
Then speed = 4000KHz
Best regards,
Yashraj
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello @ByronForWork ,
Hope the issue is resolved now.
Due to inactivity we are closing the thread. Please create a new case for further queries.
Best regards,
Yashraj