0

Is Arduino uno SPI comunication can be also master and slave in the same time?

OR master 2 slaves in the same time?

I want to recevice data from a sensor and display on OLED (all data transfer with SPI bus)

Can I master those two device (sensor & OLED) in the same time? (with SS pin to select slave )

OR Can I be both slave(recevices the data from sensor) and master (sent data to OLED) in the same time ?

What should I do ? and How can I do?

(I read the SPI example code on the Official website , but I still have no ideal about it)

1

2 Answers 2

1

You can have several devices on an SPI bus. Each must have a chip select. The Arduino SS pin (Uno pin 10) is often used for chip select. Chip select pins should then be in output mode.

Connect the sensor and display to the SPI bus (MOSI, MISO, SCK) and use a chip select pin for each.

A driver (library) for a device connect to the SPI bus will typically assert the chip select pin and transfer commands and data. The SPI transfer is both read and write at the same time.

2
1

SPI is bi-directional, so sending data or receiving data doesn't indicate if it's a master or a slave.

The master is the one that initiates the communications, that's all. So the arduino is a master in both cases. The master send data to the OLED. The master requests data from the sensor.

1
  • Thanks a lot about your answer ! I got it. But can I ask you more about this condition ? What example code should I read,I still have no ideal about how to implement this system. Jan 24, 2016 at 6:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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