0

Since there is little information (and a lot of confusing one) I need a clarification for Raspberry Pi 2, Model B.

According to this post http://terminal28.blogspot.hu/2016/05/enabling-spi1-on-raspberry-pi-bzero23.html

There may be possible to enable the 2'nd SPI module and pins are accessible to 40 pin header of the board.

I am NOT speaking to enable the 2'nd CS (chip select) of first SPI module, just need two separate SPI peripherals, each one with it's own

MISO, MOSI, SCK and one CS

From little information available, the BCM2836 has several SPI peripherals but I am not clear if for RPI 2B there are accessible both in the same time.

Also, from your experience, seems that SPI modules are clocked from APB clock with a 16 bit divisor. Now there is possible to divide with 5 for example? Or should be 2's power only.

I need something around 50...100MHz clock.

Thanks for clarifications.

3

I need something around 50...100MHz clock.

Unfortunately - it is not possible to archive such a speed with RPi. From my experience (I made some add-on cards /intentionally I do not call them HATs, as RPi foundation specification of the HAT is extremely limiting for more complex and intelligent add-ons/ for RPi), about 30MHz is the maximum reliable speed.

You can use both SPI interfaces - and it is easy to configure only changing the config.txt file. The second SPI can have 3 CS lines.

But you can actually work it around by using another micro. This "middle" micro will communicate with your peripheral devices and transfer the results back to RPi. I afraid there is no other way. Most of my add-ons now have their own uC (this ones STM32F3): enter image description here

  • I accepted your answer because of your MCU work addons :) In fact, I already proposed this (MCU, M3 or M4) solution but wasn't accepted. Too many only python/perl "programmers" these days. Thank you! – orfruit May 1 '17 at 14:24
2

Two SPI peripherals are available on the Pis with the 40 pin expansion header.

The main SPI device has two dedicated chip selects.

The auxiliary SPI device has three dedicated chip selects.

You can use both devices at the same time (they use different GPIO).

See http://abyz.me.uk/rpi/pigpio/index.html#Type_3 for the GPIO assignments.

pigpio has in-built drivers for the main and auxiliary SPI device.

The spi_bcm2835 Linux driver supports both the main and auxiliary SPI devices.

You should use device tree to enable the SPI devices for the Linux driver.

See /boot/overlays/README for details.

The clock divisor is forced to be even.

The GPIO pads are unlikely to work very well at frequencies over 30MHz. You will have to experiment with high frequencies.

  • Thanks @joan, well, agree, but I have a ADC and a DAC that needs 50MHz at least. Anyhow, on short distances may work. Do we have a PCB layout to see how are they routed? – orfruit May 1 '17 at 12:50
  • @user1734108 All I am aware of is schematics, I doubt the routing is available. raspberrypi.org/documentation/hardware/raspberrypi/README.md is the place to look. – joan May 1 '17 at 13:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.