I have a Raspberry PI B+ with a C++ application that is able to communicate with an Arduino. I'm able to read, write, serial connection perfeclty stable.
Now, I bought a Raspberry PI3 in order to have more performances and wifi integrated. After a lot of time spent, I got the QT application working again but the serial communication wouldn't work. I connected the serial monitor of Arduino IDE and checked that with RPI 1 it is working fine, and I saw all messages sent following my protocol, so I'm sure that I can analyze what I'm writing out of Raspberry P3. Unfortunaltely, I receive only weird characters: I tried different baudrate, for example 115200 and 9600 (expected baudrate!) but the result is different but equally wrong.
I would like to report what I did in my Raspberry P3: I disabled the serial port for the console (as I understood on the web) This settings would modify automatically the option:
enable_uart=0
it's strange because in the web I found who is suggesting to enable, who clearly write that it should be disabled because refers to "console over serial". Then, I added some lines (you can see into red shape) in order to move the bluetooth handling in the miniuart, fixing the cpu frequency to 250 and fixing the default baudrate to 9600. Then, I disable the bluetooth with this command: I'm really not sure of that but.. something suggested in some posts. Finally, this is the setup in my QT c++ application: Where I changed the name of the port to "ttyS0", (same "serial1").
So.. what I would like to achieve is setup my pi3 serial communication as was working with piB+, connected on same pins GPIO14 and GPIO15. Doesn't matter to bluetooth, I will not use it.
What I miss or made wrongly?
The PINOUT of Raspberry PI3 seems equal to PINOUT of Raspberry PI B+:
And the PINOUT of Raspberry B+ is:
But I found one interesting thing: It seems the configuration somehow is wrong because GPIO14 and GPIO15 are both INPUTS !!
I finally fixed! As I wrote, I found many suggestions on the web but quite often discordant.. so I will report here how I setup my Raspberry p3 in order to work fine.
1) Upgraded my system
sudo apt-get update
sudo apt-get dist-upgrade
2) Enabled the UART console
sudo raspi-config
Advanced options --> serial:
Note: it will automatically set 1 the enable_uart in the file config.txt.
3) Edit config.txt
sudo nano /boot/config.txt
I added basically one line in order to disable the bluetooth port (not used in my case)
I also removed the limitation of cpu frequency to 250, found many times as hint in forums, as you can see it's commented (#). You can also see the setup of "enable_uart=1" done with raspi-config interface.
4) Edit file cmdline.txt
sudo /boot/cmdline.txt
I removed the piece of string where there was something like:
.... console=serial0,115200 ....
5) Application refers to serial0
6) DONE !
I Hope this step-by-step guide works for someone else or in general will be helpful.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With