bcm2835-1.60 UART support

311 views
Skip to first unread message

Jorgen Sandberg

unread,
Nov 24, 2019, 7:54:39 AM11/24/19
to bcm2835
I want to use the UART on the Raspberry Pi 3 model B and the Raspberry Pi 4 Model B, but I am in doubt on the best way to do it. I have searched the net and found a patch to bcm2835 from 2013, but this patch is not included in bcm2835-1.60. Why is that? It seems to me handy to have all interfaces covered by one library for programs in C i.e. covering GPIO, SPI, I2C and UART. 

Alexandre Gesp

unread,
Nov 24, 2019, 8:35:48 AM11/24/19
to bcm...@googlegroups.com
I don't use the UART, but to have the bmc2835 working on both PI3 and PI4, I had to compile the whole library bcm2835 1.60 on pi4
I use I2c (RTC), 1-wire ( temperature) and gpio (luminosity sensor). The same binary works on pi3 and pi4
Just compiling the bcm2835.cpp whith my app doesn't work (bcm init failed). I had to install the library as describe in the readme.

Le dimanche 24 novembre 2019, Jorgen Sandberg <jor...@123sandberg.eu> a écrit :
I want to use the UART on the Raspberry Pi 3 model B and the Raspberry Pi 4 Model B, but I am in doubt on the best way to do it. I have searched the net and found a patch to bcm2835 from 2013, but this patch is not included in bcm2835-1.60. Why is that? It seems to me handy to have all interfaces covered by one library for programs in C i.e. covering GPIO, SPI, I2C and UART. 

--
You received this message because you are subscribed to the Google Groups "bcm2835" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bcm2835+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/bcm2835/f6edc013-7162-4923-8076-fe543abfdd88%40googlegroups.com.

jor...@123sandberg.eu

unread,
Nov 24, 2019, 9:02:09 AM11/24/19
to bcm...@googlegroups.com

Dear Alexandre,

 

Thank you for sharing your experience with me.

I have done several searches on the internet on the use of the UART on Raspberry Pi, but I have not managed to find an approach that is straight forward within a C program. In case it would be included in bcm2835-1.60 it would be a self-contained solution provided one remembers to end with the bcm2835_close() function such that the UART will be reset to output system data as it is originally set to.

 

Regards,

 

Jorgen Sandberg  

 

From: bcm...@googlegroups.com <bcm...@googlegroups.com> On Behalf Of Alexandre Gesp
Sent: 24 November 2019 14:36
To: bcm...@googlegroups.com
Subject: Re: [bcm2835] bcm2835-1.60 UART support

 

I don't use the UART, but to have the bmc2835 working on both PI3 and PI4, I had to compile the whole library bcm2835 1.60 on pi4

I use I2c (RTC), 1-wire ( temperature) and gpio (luminosity sensor). The same binary works on pi3 and pi4

Just compiling the bcm2835.cpp whith my app doesn't work (bcm init failed). I had to install the library as describe in the readme.


Le dimanche 24 novembre 2019, Jorgen Sandberg <jor...@123sandberg.eu> a écrit :

I want to use the UART on the Raspberry Pi 3 model B and the Raspberry Pi 4 Model B, but I am in doubt on the best way to do it. I have searched the net and found a patch to bcm2835 from 2013, but this patch is not included in bcm2835-1.60. Why is that? It seems to me handy to have all interfaces covered by one library for programs in C i.e. covering GPIO, SPI, I2C and UART. 

 

--
You received this message because you are subscribed to the Google Groups "bcm2835" group.

To unsubscribe from this group and stop receiving emails from it, send an email to bcm2835+u...@googlegroups.com.

--

You received this message because you are subscribed to the Google Groups "bcm2835" group.

To unsubscribe from this group and stop receiving emails from it, send an email to bcm2835+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/bcm2835/CAOdHUsXSf%3DVdT5uD8Py0vT1aXNKK-trZu2gc52PBL1RH2_YFfQ%40mail.gmail.com.

Alexandre Gesp

unread,
Nov 24, 2019, 12:40:49 PM11/24/19
to bcm2835
Well, every time I have to deal with serial port on raspberry, I use the standard C function (tcsetattr() and tcgetattr() to write/read the settings, ioctl(), flock(), open("/dev/ttyxx)  and close, and have no problems. But I haven't test yet on PI4. I don't need to link with the bcm2835 library for that.

Mike McCauley

unread,
Nov 24, 2019, 8:17:12 PM11/24/19
to bcm...@googlegroups.com, jor...@123sandberg.eu
Hello,

I think the only reason you might access the uart through the bcm2835 library
would be if you wanted to do sonthing very unusual. If you just want a
standard serial connection, I would just use standard file iO with the tty
device.

Cheers.

On Monday, 25 November 2019 00:02:04 AEST jor...@123sandberg.eu wrote:
> Dear Alexandre,
>
>
>
> Thank you for sharing your experience with me.
>
> I have done several searches on the internet on the use of the UART on
> Raspberry Pi, but I have not managed to find an approach that is straight
> forward within a C program. In case it would be included in bcm2835-1.60 it
> would be a self-contained solution provided one remembers to end with the
> bcm2835_close() function such that the UART will be reset to output system
> data as it is originally set to.
>
>
>
> Regards,
>
>
>
> Jorgen Sandberg
>
>
>
> From: bcm...@googlegroups.com <bcm...@googlegroups.com> On Behalf Of
> Alexandre Gesp Sent: 24 November 2019 14:36
> To: bcm...@googlegroups.com
> Subject: Re: [bcm2835] bcm2835-1.60 UART support
>
>
>
> I don't use the UART, but to have the bmc2835 working on both PI3 and PI4, I
> had to compile the whole library bcm2835 1.60 on pi4
>
> I use I2c (RTC), 1-wire ( temperature) and gpio (luminosity sensor). The
> same binary works on pi3 and pi4
>
> Just compiling the bcm2835.cpp whith my app doesn't work (bcm init failed).
> I had to install the library as describe in the readme.
>
>
> Le dimanche 24 novembre 2019, Jorgen Sandberg <jor...@123sandberg.eu
> <mailto:jor...@123sandberg.eu> > a écrit :
>
> I want to use the UART on the Raspberry Pi 3 model B and the Raspberry Pi 4
> Model B, but I am in doubt on the best way to do it. I have searched the
> net and found a patch to bcm2835 from 2013, but this patch is not included
> in bcm2835-1.60. Why is that? It seems to me handy to have all interfaces
> covered by one library for programs in C i.e. covering GPIO, SPI, I2C and
> UART.


--
Mike McCauley VK4AMM mi...@airspayce.com
Airspayce Pty Ltd 9 Bulbul Place Currumbin Waters QLD 4223 Australia
http://www.airspayce.com 5R3MRFM2+X6
Phone +61 7 5598-7474



jor...@123sandberg.eu

unread,
Nov 25, 2019, 4:12:12 AM11/25/19
to Mike McCauley, bcm...@googlegroups.com
Dear Mike,

Thank you for the advice. I need a standard connection reading data from a
GPS module.

Regards,
Jorgen

jor...@123sandberg.eu

unread,
Nov 25, 2019, 4:19:03 AM11/25/19
to bcm...@googlegroups.com

Dear Alexandre,

 

Thank you for your advice. I want a simple way to use the UART to receive data from a GPS module. Your solution is what I was looking for.

 

Regards,

Jorgen

--

You received this message because you are subscribed to the Google Groups "bcm2835" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bcm2835+u...@googlegroups.com.

Reply all
Reply to author
Forward
0 new messages