Quote:
Quote:
Sure, but how do you generate the I2C clock using a GPIO pin?
I2C is a synchronous protocol and thus SCL can be generated by an IO even if the program is sometimes stopped by the OS scheduler. If you use the 5200B as a master, the clock is generated by an (output only) PIN.
Okay I understand that you would generate the clock by just toggling the pin on and off, but you can't just stop the clock, right? Or doesn't it matter? The slave devices will simply not transfer data if the clock is not being used?
Quote:
SDA have to be bidir.
Well that's easy, just turn the GPIO from input to output mode.
What I'm worried about is this becomes a really CPU-intensive process, and if you want to sample input you would have to poll it incessantly..
Anyway, the only real problem I see is that as far as I can tell, the PSC6 controller is completely misnamed IRDA in the documentation, at least in parts. This is a giddy holdover from the original MPC5200 where there was no PSC6, only a dedicated IRDA controller.
So, you basically access the GPS port configuration register, which as previously mentioned as MBAR + 0xb00, and set the IRDA bits to 0 (the firmware does this anyway, but it may not in the future..)
Then you can use the GPS Simple GPIO Enables (MBAR + 0xb04) register to enable the TX pin on the IrDA connector. This is bit 28. Just toggle it on.
The same bit in the GPS Simple GPIO Data Direction register (MBAR + 0xb0c) sets input or output. Input is 0, output is 1.
The very same bit on the GPS Simple Data Output Values register (MBAR + 0xb10) drives the pin high (1) or low (0). This is your "write port". The GPS Simple Data Input Values register (MBAR + 0xb14) is your read port. Same bit.
...
The other two pins are wakeup-enabled so they are controlled by the wakeup set. The enables register is MBAR + 0xc00 and onwards and upwards.
It's all in chapter 7-3 (around page ~196) of the manual, just read through.
Something to note, the actual pinout of the IrDA connector (from the back of the board, nearest the USB ports) is
[ POWER PSC6_1 PSC6_0 GROUND PSC6_2 ]
PSC6_2 is otherwise known as IRDA_TX. PSC6_3 - otherwise known as IR_USB_CLK - is not connected. This is described in Chapter 2-78 (page ~104).
1 and 0 are wakeup and 2 is simple.