Andy K
/
AD9951TEST
Attempt to read the AD9951 DSP serial output via SSP and \"IRQ driven bit-reading\".
main.cpp@0:e45bbd4486df, 2011-01-18 (annotated)
- Committer:
- AjK
- Date:
- Tue Jan 18 01:27:57 2011 +0000
- Revision:
- 0:e45bbd4486df
0.1 A test failure case!
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
AjK | 0:e45bbd4486df | 1 | |
AjK | 0:e45bbd4486df | 2 | #include "mbed.h" |
AjK | 0:e45bbd4486df | 3 | #include "iomacros.h" |
AjK | 0:e45bbd4486df | 4 | |
AjK | 0:e45bbd4486df | 5 | DigitalOut led1(LED1); |
AjK | 0:e45bbd4486df | 6 | Serial pc(USBTX, USBRX); |
AjK | 0:e45bbd4486df | 7 | |
AjK | 0:e45bbd4486df | 8 | // The two main functions, call one or the other |
AjK | 0:e45bbd4486df | 9 | // depending on P20, one Mbed or the other. |
AjK | 0:e45bbd4486df | 10 | void tx(Serial *, DigitalOut *); |
AjK | 0:e45bbd4486df | 11 | void rx(Serial *, DigitalOut *); |
AjK | 0:e45bbd4486df | 12 | |
AjK | 0:e45bbd4486df | 13 | int main() { |
AjK | 0:e45bbd4486df | 14 | |
AjK | 0:e45bbd4486df | 15 | p20_AS_INPUT; |
AjK | 0:e45bbd4486df | 16 | p20_MODE(PIN_PULLUP); |
AjK | 0:e45bbd4486df | 17 | |
AjK | 0:e45bbd4486df | 18 | pc.baud(115200); |
AjK | 0:e45bbd4486df | 19 | |
AjK | 0:e45bbd4486df | 20 | if (p20_IS_SET) tx(&pc, &led1); // This is the sending Mbed that creates the waveforms |
AjK | 0:e45bbd4486df | 21 | else rx(&pc, &led1); // This is the receiving Mbed that tries to read it. |
AjK | 0:e45bbd4486df | 22 | |
AjK | 0:e45bbd4486df | 23 | // Note, I used two Mbeds. I could just use one but I didn't want the |
AjK | 0:e45bbd4486df | 24 | // software creating the waveforms to steal CPU time. I wanted the receiver |
AjK | 0:e45bbd4486df | 25 | // to have all available CPU time it needed. End result, no where enough |
AjK | 0:e45bbd4486df | 26 | // with a software soluttion and the SSP failed totally by missing the first bit. |
AjK | 0:e45bbd4486df | 27 | |
AjK | 0:e45bbd4486df | 28 | // With the software solution I did manage to read the data but only to about |
AjK | 0:e45bbd4486df | 29 | // 500kHz. The Mbed libs are known to be slow so I could have tried using direct |
AjK | 0:e45bbd4486df | 30 | // peripheral usage. But I know from experience that even doing that I would prob |
AjK | 0:e45bbd4486df | 31 | // get upto about maybe 1.5MHz. No where near the 6.5MHz needed to read the |
AjK | 0:e45bbd4486df | 32 | // AD9951 DSP serial output. Shame on Maxim for having a, err, dumb ass serial |
AjK | 0:e45bbd4486df | 33 | // protocol! |
AjK | 0:e45bbd4486df | 34 | |
AjK | 0:e45bbd4486df | 35 | |
AjK | 0:e45bbd4486df | 36 | } |