I'm working on a project where a raspberry pi zero will be the main controller. The pi has to receive information from a GPS module (gy-gps6mv2) over UART. The same pi will be controlling (receive and transmit) a bare Atmega328 (let's call it an Arduino).
I'd like to stay away from USB. The project has to be compact. This means that I've only got one serial port on GPIO of the pi. I have considered softwareserial on the Arduino, passing the information to the pi, but the Arduino is already doing a lot of work and softwareserial is by no means reliable enough. Bitbanging GPIO pins on the pi to establish serial also doesn't seem like an amazing option.This means that I'll have to come up with another way to communicate with the Arduino.
I know both the pi and the Arduino have I2C and SPI, but there seems to be surprisingly little information out these about pi-arduino communication over any of these 2 protocols. The Arduino is already configured as a I2C master, communication to a barometric sensor (slave) so I assume (?) SPI is the only option left.
What would be the best way to establish this communication? Are there other ways to accomplish this? Does anyone have any experience with this?
As some have pointed out, I should've provided more information.
The communication from the gps to the pi happens at baudrate 9600. The pi does not send anything back to the gps. The 2 way pi-Arduino communication has to be at least 9600 as well. There is a constant data stream between the pi and the Arduino, making MUX infeasible. As far as I understand, this also means that making the pi an I2C slave of the Arduino isn't really an option because I2C is needed for the barometer-Arduino communication (I2C is however new to me, my assumptions might not be right). I haven't tried bitbanging/softwareserial, but according to what I'm reading online, this takes a lot of processing power and the losses get up to 10%.