I've been trying to experiment with the CMUCam (http://cmucam.org/), I've got it working on previous chips, but I've been trying to get it working on XMOS.
On the camera's booting it should dump a message over the RX pin, so I have this code set up to *hopefully* catch the chars coming out:
Code: Select all
#include <xs1.h>
#include <print.h>
# define BIT_RATE 19200
# define BIT_TIME XS1_TIMER_HZ / BIT_RATE
in port RXD = XS1_PORT_1A;
void txByte(out port txd, int byte)
{
unsigned time;
txd <: 0 @ time;
for (int i = 0; i < 8; i++) {
time += BIT_TIME;
txd @ time <: >> byte;
}
time += BIT_TIME;
txd @ time <: 1;
time += BIT_TIME;
txd @ time <: 1;
}
char rxByte(in port rxd)
{
unsigned byte, time;
rxd when pinseq (0) :> void @ time;
time += BIT_TIME / 2;
for (int i = 0; i < 8; i++) {
time += BIT_TIME;
rxd @ time :> >> byte;
}
time += BIT_TIME;
rxd @ time :> void;
return (byte >> 24);
}
void main(){
printstrln("CMUCam Output");
printstrln("==================");
while (1){
printcharln(rxByte(RXD));
}
}
Links:
Command Reference:
http://cmucam.org/attachments/download/ ... st-102.pdf
Product Home:
http://cmucam.org/projects/cmucam4
Hardware:
XC-1A
CMUCam v4
I have the XC-1A's 1A (first port in prototyping area) hooked up to the RX pin of the camera.
Any ideas are greatly appreciated!
Thanks,
John
EDIT: To test I boot up the XMOS, upload the code, then restart the camera. The camera is receiving power and functioning, this I know because the TV output is working (stuff is showing on the TV).