-
Notifications
You must be signed in to change notification settings - Fork 23
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
Change to I2C returning Serial #22
Comments
I'm sorry for the delay. You've probably figured it out by this time. |
Here is the code.
"sendCommand" for I2C returns "Ready" but the readings continue via RX
[image: image.png]
…On Thu, Dec 31, 2020 at 3:24 PM Bud Ryerson ***@***.***> wrote:
I'm sorry for the delay. You've probably figured it out by this time.
But will you please send me all your code so I can duplicate your problem?
Thanks,
Bud
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#22 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AB7X5DUEXLGVLV5REPHHOODSXUBZZANCNFSM4VFXBPYQ>
.
|
There was no attachment with your last message. |
We'll fix this. Bud |
1. I am confused. There are several lines of output. I used your example
and added this at line 50
// - - - - - - - - - - - - - - - - - - - - - - - -
printf( "SET_Mode I2C: ");
if( tfmP.sendCommand(SET_I2C_MODE , 0))//SET_I2C_MODE, SET_SERIAL_MODE
{
tfmP.printReply();
}
else
{
printf( "Failed: ");
tfmP.printReply();
}
//This is the output I get
[image: image.png]
2. I was following the instructions "Delete the comment slashes // on lines
37 and 38 to invoke the library, and be sure to choose // the correct RX
and TX pins: pins 10 and 11"
I am using - "Nano V3.0 Module ATmega328P 5V 16MHz CH340G" with D0 & D1 as
TX & RX
3. Yes, the sensor is working and giving me the correct distance with
serial, but I prefer to use I2C to simplify multiple sensors from the same
board.
…On Fri, Jan 1, 2021 at 9:07 PM Bud Ryerson ***@***.***> wrote:
1.
You listed only two lines of output:
SET_Mode: Status: SERIAL
00 00 00 00 00 00 00 00
Is that it? Only two lines? No "Hello"?
Something like:
TFMPlus Library Example - 18JUN2020
2.
Your Software Serial assignment of Pins 0 & 1
SoftwareSerial mySerial( 0, 1);
appears to use the same pins as the hardware serial port.
Are you sure about those pin assignments?
Which Arduino board (and revision) are you using?
3.
Is the Arduino working? Is the sensor working?
Is the Arduino working okay with the sensor in Serial mode?
We'll fix this.
Bud
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#22 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AB7X5DTWUDYPUMH3XPFHGLTSX2S2TANCNFSM4VFXBPYQ>
.
|
Bud Ryerson |
Thanks so much for your help with this!
1. Here is the output and a wire pic. The Distance changes if I put my hand
above it. I do have to unplug the tx/rx wires to flash but then I plug back
in and hit the rest button and monitor the output.
TFMPlus Library Example - 18JUN2020
SET_Mode I2C: Status: READY
00 00 00 00 00 00 00 00
System reset: Status: TIMEOUT
44 0A 90 09 6F 00 00 00
Firmware version: Status: TIMEOUT
D6 00 38 0A 90 09 C3 00
Data-Frame rate: Status: TIMEOUT
00 37 0B 90 09 62 00 00
Dist:0214cm Flux:02616 Temp:50°C
Dist:0214cm Flux:02611 Temp:50°C
Dist:0214cm Flux:02615 Temp:50°C
[image: MiniWiring.jpg]
2. When I change to "SoftwareSerial mySerial(9,10);" Pins D6 D7, the result
from 12c sendCommand is "Serial" instead of "Ready" and I don't get any
distance readings.
TFMPlus Library Example - 18JUN2020
SET_Mode I2C: Status: SERIAL
00 00 00 00 00 00 00 00
System reset: Status: TIMEOUT
00 00 00 00 00 00 00 00
Firmware version: Status: TIMEOUT
00 00 00 00 00 00 00 00
Data-Frame rate: Status: TIMEOUT
00 00 00 00 00 00 00 00
[image: MiniWiring9_10.jpeg]
…On Sat, Jan 2, 2021 at 10:39 AM Bud Ryerson ***@***.***> wrote:
1.
I apologize for any confusion. Your [images] are not showing up here.
Please save your output into a text file and attach or send me the file.
2.
The D0 & D1 pins on the *Nano V3.0 Module ATmega328P 5V 16MHz CH340G*
are the hardware serial lines that you use to program and communicate with
the *Nano* from your IDE (running on your PC). The *Nano* has an
onboard USB to TTL converter (CH340G) that requires the use of these pins.
You cannot use these same pins to communicate with your *TFMini-Plus*.
That's why we use the Software Serial library - because the ATmega328P does
not have a second hardware serial port. I believe that pins 9 & 10 will
work for that purpose (11 & 12 are for the SPI interface) ; but please
check the Software Serial documentation for your particular board.
You say that your *Nano* and your *TFMini-Plus* are working together
just fine in Serial Mode. I don't see how that is possible, so I must
really be misunderstanding something. Again, please send me a text file of
your output from running the example sketch in the Serial Mode. Pictures of
your wiring would be helpful, too.
3.
You are correct that the I2C Mode is the way to go. It will allow you
to use more than one *TFMini-Plus* on the same bus.
Bud Ryerson
San Francisco
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#22 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AB7X5DT6AAX3OFUNMAZW7GTSX5R7HANCNFSM4VFXBPYQ>
.
|
Your images are still not showing. You wrote that, "the sensor is working and giving me the correct distance with serial." So I asked to see the output from You wrote, "I do have to unplug the tx/rx wires to flash but then I plug back in and hit the rest button and monitor the output." I get the uneasy feeling that you are still confusing hardware and software serial ports. The hardware serial port is for programming and monitoring ONLY. The Software Serial port is for communicating with the Lidar. Am I wrong? Please let me know. Bud |
1. Correct , the other commands seem to timeout, but the distance is
working.
2. *Why are you plugging and unplugging wires? Which "tx/rx wires" are you
talking about?*
*The white to tx and the green from RX (I shared pics on google drive with
you)*
3. *How do you "monitor the the output?" *
*I use the Serial monitor from arduino UI.*
4. *I get the uneasy feeling that you are still confusing hardware and
software serial ports. The hardware serial port is for programming and
monitoring ONLY. The Software Serial port is for communicating with the
Lidar. Am I wrong?*
*I may be, I have only used the RX and TX for a GPS chip. before. I tried
using D6 and D7 (See other pic on Google drive) and I don't get any output
the serial monitor. I have an Uno, but it also only has the one serial line
on 0 & 1. *
…On Sat, Jan 2, 2021 at 2:03 PM Bud Ryerson ***@***.***> wrote:
Your images are still not showing.
You wrote that, *"the sensor is working and giving me the correct
distance with serial."* So I asked to see the output from TFMP_example.ino,
the Serial Mode example sketch, running correctly. I don't see that. In the
output you show above, every command has failed.
You wrote, *"I do have to unplug the tx/rx wires to flash but then I plug
back in and hit the rest button and monitor the output."*
Why are you plugging and unplugging wires? Which *"tx/rx wires"* are you
talking about? How do you *"monitor the the output?"*
I get the uneasy feeling that you are still confusing hardware and
software serial ports. The hardware serial port is for programming and
monitoring ONLY. The Software Serial port is for communicating with the
Lidar. Am I wrong?
Please let me know.
Bud
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#22 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AB7X5DVPJOLIR7JKJM3CWRDSX6J4TANCNFSM4VFXBPYQ>
.
|
Please understand that the Lidar device communicates with the Arduino - and the Arduino then turns around and communicates with the user (you). This requires two independent data channels. The USB cable connects the Arduino with your computer. It uses the D0 & D1 (TX/RX) pins. You cannot EVER use those to connect to the Lidar. You must use the Software Serial pins. BUT As soon as you send a |
I make a call in the beginning of the code to change to I2C but it always returns "Serial" but no error with the SetCommand. Do I need a parameter with the SET_I2C_MODE command?
Using Example code
void setup()
{
Serial.begin(115200); // Intialize terminal serial port
delay(20); // Give port time to initalize
printf_begin(); // Initialize printf.
printf("\r\nTFMPlus Library Example - 18JUN2020\r\n"); // say 'hello'
//.....
Output
SET_Mode: Status: SERIAL
00 00 00 00 00 00 00 00
The text was updated successfully, but these errors were encountered: