How to access all USARTs/SPIs/I2Cs on Fez Cerbuino Bee?

Hi, folks,

I have some experience on MSP430 and worked briefly on Fez Panda II. Panda seems really easy thanks to GHI’s comprehensive documentation, but Cerbuino seems not that easy.

STM32F405/407, on which cerbuino is built, has 6/USARTs, 3 SPIs and 3 I2Cs. On cerbuino bee, xbee adapter is connected USART#6 and termed as Serialport “COM1”. What do I need to do if I want to use other USART ports, and SPIs? I know which pins to connect to but I do not know how to initialize each port. Could somebody educate me on this? Many thanks.

Check the documents at the following location:

https://www.ghielectronics.com/docs

https://www.ghielectronics.com/docs/15/uart
https://www.ghielectronics.com/docs/14/spi
https://www.ghielectronics.com/docs/12/i2c

Hi, Architect,

Thanks for the links. I actually checked those documents, that’s how I figured out how to get xbee running on cerbuino bee. But how about the other 5 USARTs? Say, if I connect another xbee(just an example) to USART#3, how do I initialize that port in visualstudio?

There are only 2 other UARTs on Cerbuino Bee. You distinguish them by the name COM2 or COM3.

i.e.



SerialPort com2 = new SerialPort("COM2", 115200); 
SerialPort com3 = new SerialPort("COM3", 115200); 


I see. So 3 out of 6 UARTs of STM32F4 are exposed on cerbuino bee: xbee adapter which is connected to USART#6, and another two ports through gadgeteering sockets, I will figure out the connection through schematic.

How about SPIs? Do I have to use them through gadgeteering?

I am working on a project that requires F407 because F405 which is used on cerbuino boards does not have enough GPIOs. Also I noticed that the analog ground and supply, voltage reference are all briefly tied to digital side of circuit. This needs to improve if serious measurement is needed.

You don’t have to.

You will need to create two spi configuration instances for each SPI and switch them on the actual spi instance.

Example 2 on the doc page

https://www.ghielectronics.com/docs/14/spi

shows how to use two devices on the same SPI. It is same for different SPI (you have to change last parameter on the config object.

When I went through cerbuino bee schematic, it seems UART1,2,3,4 as well as UART6 are exposed. UART5 is not because it conflicts with SDIO. I will just experiment with these UART ports and figure out which COM each port is named as.

Sounds like a plan. Have fun! Datasheet for the MCU should help.

Again after I went through the schematic, I realized that only one SPI bus, SPI1, was exposed. As exampled in the link, because each SPI bus can support multiple devices, one bus is enough for me.

The only thing I am not quite sure about SPI is what PINs connections go to. Bus SPI1 can either go through either PA5,6,7 or PB3,4,5, both these pins in schematic are labeled as SPI1 but the document in the following only designate PB3,4,5 as SPI1.

I think you are right. Only 3 UART ports are exposed on cerb-family firmware.

COM1: connected UART#6 of STM32F405/407, Pin PC6 & PC7
COM2: connected UART#2 of STM32F405/407, Pin PA2 & PA3
COM3: connected UART#3 of STM32F405/407, Pin PB10 & PB11

The other three ports, #1, #4 & #5 are not exposed. I can see why #5 is not because the pins are multiplexed with SDIO, it is still nice to expose #1 & #4.