Interfacing

BCM2835 gpio library

13 2246
jobi23  
Compiling the bcm2835 source is ok.

Trying now to compile the source for the LCD returns errors, that the following base addresses are not available:
* bcm2835_gpio
* bcm2835_spi0

I'm currently stuck, how i can make these addesses available.

bcm2835.h says:
  1. /// The base address of the various peripheral registers are available with the following
  2. /// externals:
  3. /// bcm2835_gpio
  4. /// bcm2835_pwm
  5. /// bcm2835_clk
  6. /// bcm2835_pads
  7. /// bcm2835_spio0
  8. /// bcm2835_st
  9. /// bcm2835_bsc0
  10. /// bcm2835_bsc1
  11. ///
Copy the Code


Can you give me and advice, how I can solve this problem?

Thank you

jobi23  
I still can't compile my LCD test-program because of missing references:

  1. make
  2. gcc -Os -c tft.c
  3. tft.c: In function 'TFT_init_board':
  4. tft.c:104:32: error: 'bcm2835_spi0' undeclared (first use in this function)
  5.      volatile uint32_t* paddr = bcm2835_spi0 + BCM2835_SPI0_CS/8;
  6.                                 ^~~~~~~~~~~~
  7. tft.c:104:32: note: each undeclared identifier is reported only once for each function it appears in
  8. tft.c: In function 'TFT_DataMultiWrite':
  9. tft.c:255:32: error: 'bcm2835_spi0' undeclared (first use in this function)
  10.      volatile uint32_t* paddr = bcm2835_spi0 + BCM2835_SPI0_CS/4;
  11.                                 ^~~~~~~~~~~~
  12. tft.c:258:34: error: 'bcm2835_gpio' undeclared (first use in this function)
  13.   volatile uint32_t* gpio_set   = bcm2835_gpio + BCM2835_GPSET0/4;
  14.                                   ^~~~~~~~~~~~
  15. make: *** [makefile:7: tft.o] Error 1
Copy the Code


Do you have any idea, how I can initialize these addresses?

bcm2835.h
  1. /// \version 1.13 New GPIO pin definitions for RPi version 2 plug P5
  2. ///               Hardware base pointers are now available (after initialisation) externally as bcm2835_gpio
  3. ///               bcm2835_pwm bcm2835_clk bcm2835_pads bcm2835_spi0.
Copy the Code


Hello I have one simple question. I would like to use Banana PI like master I2C device which communicates with ATmega328.  If I use bcm2835 library, which works at Raspberry PI well, it does not work for Banana.

Comunication model:
Banana sends register address to slave bcm2835_i2c_write(register, 1)
Banana waits for 10ms
Banana  reads from slave 3 bytes bcm2835_i2c_read(buf,3)

After I see communication data at logical analyzer,  it seems that Banana PI makes not one transfer with 3 byte reads, but three one byte reads. Example: bytes to read (0x20, 0x30, 0x40) is read like (0x20); (0x20); (0x20) all times it reads only first byte, stop communication and starts from begining...

What I am doing wrong?
Thanks
Richard

Richard3 replied at Nov 18, 2016 02:53
Hello I have one simple question. I would like to use Banana PI like master I2C device which communi ...

1. The raspberry pi original bcm2835 library can not be used on banana pro.2. you can use the one download from here:  http://wiki.lemaker.org/BCM2835
3. You need make sure you use i2c-2 device node on Banana Pro.

You have to log in before you can reply Login | Sign Up

Points Rules