I am wondering how feasible it is to use bitbanging to drive a 9600 baud serial via the GPIO pins on the Raspberry Pi.
Obviously, Linux is not a terribly good platform for bitbanging, as there is a large number of drivers and other interrupts which may block the CPU for extended periods of time (1-10ms). However, the situation has gotten a lot better recently, and some pre-emption is now regularily enabled in kernels. I also suspect a real-time patched kernel can easily be used on the Raspberry Pi, and the connected hardware and drivers can be selected carefully.
My standard for reliability is that it should stay within normal 9600 baud serial tolerances most of the time. I am currently unsure how many errors are tolerable in practice, but there are retransmissions and acknowledgements in the protocol, so it is atleast somewhat tolerant.
So, my questions are:
- Can userland software reliably bit-bang 9600 baud speed?
- Does this need a real-time patched kernel?
- How many errors should I expect in general?
Also, is there any example code doing serial via GPIO bit banging? I know of Arduino SoftSerial, but that's about it.
Just in case, to limit the question: this is not a standard serial interface and the UART of Raspberry Pi is already used for another serial link. I do not wish for answers that suggest external hardware (such as Gertboard or Arduino) nor answers that depend on the UART.