Skip to content
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

UART communication #6

Closed
m2oswald opened this issue Nov 30, 2018 · 22 comments
Closed

UART communication #6

m2oswald opened this issue Nov 30, 2018 · 22 comments

Comments

@m2oswald
Copy link

Hi there. I am using the Hillcrest FSM300 board with an Arduino Mega and your code works perfectly. I was wondering if you have ever tried to communicate via UART instead of I2C? I tried converting the BNO080_2 code to talk to the FSM300 through the Mega's Serial1 connection, but have had no luck at all. Serial1.available never goes > 0, so I don't know whether I'm not sending the setup commands correctly or not listening correctly. I tried looking through Hillcrests' Nucleo code but that hasn't helped at all, and their tech support hasn't either.

Any help/advice you could give would be greatly appreciated, as I've been banging my head against the wall for a few days now and have gotten nowhere (except a headache).

Michael

@jps2000
Copy link
Owner

jps2000 commented Nov 30, 2018

Hi Michael
I never tried that
In Hillcrest data sheet there is a description of how to use the uart interface. it is meant for robot vacuum cleaners. Would try that to see if interface works. You need a 3v Uart of course.
This is what the spec says
1.3.3.1 UART operation
The UART is configured for 3Mkb/s, 8 data bits, 1 stop bit and no parity. The UART protocol relies on an idle line being ‘high’. A transmission is started with the assertion of a start bit (pulling the line low), followed by the data, LSB first. After the data segment is sent (in this case 8-bits), the line is pulled high (the stop signal) for a minimum number of bits (1 for the BNO08X) to indicate end of that segment. Bytes sent from the host to the BNO08X must be separated by at least 100us. Bytes sent from the BNO to the host have no extra spacing

I never heard about this 3Mkb/s?
sanity check TX goes to RX and vice versa?

@m2oswald
Copy link
Author

m2oswald commented Nov 30, 2018 via email

@jps2000
Copy link
Owner

jps2000 commented Nov 30, 2018

not sure but can the mega do this speed?
After power on/ reset better wait for 600ms or longer
Have you digested the SHTP transport protocol chapter 4?

@ramiss
Copy link

ramiss commented Nov 30, 2018

I commend you for trying this. Unfortunately others have confirmed the mega uart only handles at most 250,000 bps.

Are you just trying for science or do you really not have i2c/SPI available?

@m2oswald
Copy link
Author

m2oswald commented Nov 30, 2018 via email

@m2oswald
Copy link
Author

Sorry, I forgot to respond to ramiss. For my application, the arduino and the sensor will be separated by 2-4 m, which I think is pushing it for reliable I2C. And this is going to be mounted on platform in a fairly remote location, so once it's in place it really needs to work because I can't go back in to change it.

@jps2000
Copy link
Owner

jps2000 commented Dec 1, 2018

That is not a distance that can not be made with I2C.
Maybe the P82B715 is the guy for you
https://www.nxp.com/products/analog/interfaces/ic-bus/ic-bus-repeaters-hubs-extenders:MC_41849
additionally you may use low capacitance cables known from audio electronics ( microphones etc).
In Europe they are called "diode cable" like this
https://www.conrad.at/de/diodenkabel-2-x-008-mm-schwarz-kabeltronik-640200800-meterware-486055.html
These are just shielded cables with thick isolation and thin inner conductor.
You can even try such a cable in your application without repeater just by reducing the pullups to minimum allowed.
Pullups should be preferably equal on both sides. Minimum value is determined by the low level what the output stage can achieve at a certain current. 470 ohms should in fact be no problem.
You can test your setup by adding small capacitors ( e.g. multiples of 47pF) between SCL & SDA to GND to see what you can sustain and what margin is left.

@ramiss
Copy link

ramiss commented Dec 1, 2018

I agree with Peter. I2C will be ok at 4M with shielded cables and pullups. You may have to reduce transmission rate, but on the whole it would be no less reliable than using serial. The I2C repeater should guarantee the distance.

@m2oswald
Copy link
Author

m2oswald commented Dec 3, 2018

My equipment is actually going to be underwater, off the coast of northern Scotland. So I'm limited in the cables that I can use as they will be exposed to seawater. The arduino is housed in a watertight enclosure, and the FSM300 will be potted and mounted on a adjustable platform a meter or two away. I did the calculations based on the capacitance of the cable I plan to use, and I think 2 m would be ok with small (1.2k) pull-up resistors on the SDA and SCL lines. But it just seems like there's more places something could go wrong with I2C compared to serial.
I spoke with Hillcrest tech support and the FSM300 is stuck at 3Mbps for regular UART mode, so that's out. But I think the UART-RVC mode will be good enough for my purposes, and that only requires 115200 baud.
Thanks again to both of you for all of your help and advice, I appreciate it.

@jps2000
Copy link
Owner

jps2000 commented Dec 3, 2018

Welcome.
At any moment you can try the cable you intended to use with I2C bus and see what happen.
With UART RVC the BNO080 is just spiiting data. So you can not do tare etc.

@jps2000 jps2000 closed this as completed Dec 4, 2018
@choprahetarth
Copy link

choprahetarth commented Oct 9, 2019

Hi
I was trying to work my BNO080 (SparkFun� breakout board) using the UART-RVC mode with Arduino, so I was wondering if there's some source code on how to interpret the data received from the IMU?
Thanks

@jps2000
Copy link
Owner

jps2000 commented Oct 10, 2019

Hi I have not seen so far a software stack using BNO080 with UART. Not sure what you meant with "interpret the data".

@choprahetarth
Copy link

Interpret as in changing the packet to human-readable format

@choprahetarth
Copy link

choprahetarth commented Oct 16, 2019

Anyways, I tried making one code to do so... not perfect but would want suggestions for it - https://github.com/choprahetarth/Sparkfun_VR_IMU_UART_ROS.git

@jps2000
Copy link
Owner

jps2000 commented Oct 16, 2019

unfortunately I do not talk python. Just C++ hobbyist level

@choprahetarth
Copy link

that's okay... let's hope someone comes along and makes a c++ version of the same

@jps2000
Copy link
Owner

jps2000 commented Oct 17, 2019

My suggestion for max functionality would be to output quaternions and linear acceleration
From the quats you have orientation in space (Eulers) and gravity vector. Linac indicates a movement (integral is velocity)
Additionnally cal status info is helpful

@choprahetarth
Copy link

In order to convert the same driver for ROS. I had to add the output in terms of Quaternions and Linac.
Also I had an issue, the data output is very... erratic... it jumps to some position. For eg.- if the yaw is continuously 43, and then I rotate it, it increments from 44....45.... but jumps to a different value in between i.e. let's say 36... and then goes back to 46.
I tried visualizing the data using OpenGL, and it clearly messes up things during rotation.
I am assuming that the data isn't filtered using a Kalman/Complimentary filter, that's why this behavior is showing up. Let me know otherwise if im wrong....

@jps2000
Copy link
Owner

jps2000 commented Oct 30, 2019

No there is a very effective filter. Such a behaviour is known when calibration is poor.
My best practice is
Use rotation vector 0x05
400Hz update rate
Degauss the board.
Be careful with indoor use
In setup call save_periodic_DCD();
and set cal to ME_cal(1,1,1,0);
this achieves best cal 3 status
calibrate the board including iron parts in the vicinity

@Saicharan036
Copy link

Hello,
I am working on FSM300 Interfacing with Raspberry pi compute module 4 and I am getting the similar kind of issue i am able to read the data in UART-RVC mode and unable to read the data in UART-SHTP Mode. I have connected the hardware as
Fsm300 Raspberrypi
Vdd--------->Vdd
Gnd--------->Gnd
Txd --------->Rxd
Rxd--------->Txd
PS1--------->Vdd
PS0--------->Gnd
GPIO11----> BootN
GPIO13----->Nrst

I have Installed the libraries adafruit_circuitpython_BNO08x and run the basic code from the Examples "https://github.com/adafruit/Adafruit_CircuitPython_BNO08x/blob/main/examples/bno08x_simpletest_uart.py " Is there any Initial setting need to be done before Reading the data .?

Any advice you can give would be appreciated

Saicharan

@jps2000
Copy link
Owner

jps2000 commented Jul 17, 2021

I will answer on adafruit forum

@Saicharan036
Copy link

Hello,
The below is the link of the issue in Adafruit forum
https://forums.adafruit.com/viewtopic.php?f=19&t=181183

saicharan

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants