bcm2835_aux_spi_begin is disabling the other aux peripherals

76 views
Skip to first unread message

Radek Hladík

unread,
Jul 20, 2020, 6:02:50 AM7/20/20
to bcm2835
Hi,
first thanks for a great library. I am using it on CM3+ and I am trying to use it for the second aux SPI. It seems to be working fine but I've noticed one detail. The function bcm2835_aux_spi_begin does set the spi0 bit and resets all the others:
bcm2835_peri_write (enable, BCM2835_AUX_ENABLE_SPI0);
Is there any reason for not using:
bcm2835_peri_set_bits (enable, BCM2835_AUX_ENABLE_SPI0,BCM2835_AUX_ENABLE_SPI0);
?
The peri_write does disable all previously enabled peripherals. I.e. we have a OLED on AUX_SPI0 (via overlay and system driver) and we use AUX_SPI1 via bcm2835 library. Enabling SPI1 with peri_write does disable the SPI0...

Also what is the preferred way to send patches? I have a code with working AUX_SPI1 and AUX_SPI0 and even though it is mostly copy/paste, it is tested on CM3+....

Radek

Mike McCauley

unread,
Jul 20, 2020, 6:48:31 AM7/20/20
to bcm...@googlegroups.com
Hello,

On Monday, 20 July 2020 20:02:50 AEST Radek Hladík wrote:
> Hi,
> first thanks for a great library. I am using it on CM3+ and I am trying to
> use it for the second aux SPI. It seems to be working fine but I've noticed
> one detail. The function bcm2835_aux_spi_begin does set the spi0 bit and
> resets all the others:
> bcm2835_peri_write (enable, BCM2835_AUX_ENABLE_SPI0);
> Is there any reason for not using:
> bcm2835_peri_set_bits (enable,
> BCM2835_AUX_ENABLE_SPI0,BCM2835_AUX_ENABLE_SPI0);

I think this is old code, written long before there was a SPI1 available on
the RPi. So you, it should prob best bit setting not word setting, as you
suggest.

> ?
> The peri_write does disable all previously enabled peripherals. I.e. we
> have a OLED on AUX_SPI0 (via overlay and system driver) and we use AUX_SPI1
> via bcm2835 library. Enabling SPI1 with peri_write does disable the SPI0...
>
> Also what is the preferred way to send patches? I have a code with working
> AUX_SPI1 and AUX_SPI0 and even though it is mostly copy/paste, it is tested
> on CM3+....

I prefer unified diffs of code that is thoroughtly tested, documenteted and
consistent with the rest of the code.

Cheers.


>
> Radek


--
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



Reply all
Reply to author
Forward
0 new messages