Had a fiddle with the I2C_Sniffer code to see if I could increase the capture rate, space was tight in the firmware, so I used the Optimization flag to see if it could help me out
I compiled I2C.c with '-g -Wall -mlarge-code -mlarge-data -O' and managed to squeeze it in
Optimized Output:
if(termMode) //output for the terminal
350: 0d 04 e0 cp0.b w13
352: 00 00 32 bra Z, 0x354
{
RingBuffer[RingWritePostion++]='0';
354: 00 c3 b3 mov.b #0x30, w0
356: 00 73 7c mov.b w0, [w6+w8]
RingBuffer[RingWritePostion++&0xfff]='x';
358: 06 00 e8 inc.w w6, w0
35a: 0a 00 60 and.w w0, w10, w0
35c: 81 c7 b3 mov.b #0x78, w1
35e: 01 70 7c mov.b w1, [w0+w8]
RingBuffer[RingWritePostion++&0xfff]=HXASCII[dat>>4];
360: 06 80 e8 inc2.w w6, w0
362: 0a 00 60 and.w w0, w10, w0
364: 0c 81 fb ze w12, w2
366: c4 10 de lsr.w w2, #0x4, w1
368: e1 40 7f mov.b [w1+w14], w1
36a: 01 70 7c mov.b w1, [w0+w8]
RingBuffer[RingWritePostion++&0xfff]=HXASCII[dat&0x0f];
36c: 63 00 43 add.w w6, #0x3, w0
36e: 0a 00 60 and.w w0, w10, w0
370: 6f 01 61 and.w w2, #0xf, w2
372: 62 41 7f mov.b [w2+w14], w2
374: 02 70 7c mov.b w2, [w0+w8]
376: 64 00 43 add.w w6, #0x4, w0
RingWritePostion&=0xfff;
378: 8a 00 60 and.w w0, w10, w1
37a: 00 00 37 bra 0x37c <.L101>
Unoptimized Output:
if(termMode) //output for the terminal
422: 6e 48 90 mov.b [w14+14], w0
424: 00 04 e0 cp0.b w0
426: 00 00 32 bra Z, 0x428
{
RingBuffer[RingWritePostion++]='0';
428: 9e 00 78 mov.w [w14], w1
42a: 2e 00 90 mov.w [w14+4], w0
42c: 80 80 40 add.w w1, w0, w1
42e: 00 c3 b3 mov.b #0x30, w0
430: 80 48 78 mov.b w0, [w1]
432: 1e 0f e8 inc.w [w14], [w14]
RingBuffer[RingWritePostion++&0xfff]='x';
434: f0 ff 20 mov.w #0xfff, w0
436: 1e 00 60 and.w w0, [w14], w0
438: 80 00 78 mov.w w0, w1
43a: 2e 00 90 mov.w [w14+4], w0
43c: 80 80 40 add.w w1, w0, w1
43e: 80 c7 b3 mov.b #0x78, w0
440: 80 48 78 mov.b w0, [w1]
442: 1e 0f e8 inc.w [w14], [w14]
RingBuffer[RingWritePostion++&0xfff]=HXASCII[dat>>4];
444: f0 ff 20 mov.w #0xfff, w0
446: 1e 00 60 and.w w0, [w14], w0
448: 80 00 78 mov.w w0, w1
44a: 2e 00 90 mov.w [w14+4], w0
44c: 00 81 40 add.w w1, w0, w2
44e: 6e 40 90 mov.b [w14+6], w0
450: 00 80 fb ze w0, w0
452: 44 00 de lsr.w w0, #0x4, w0
454: 80 80 fb ze w0, w1
456: 00 00 20 mov.w #0x0, w0
458: 00 80 40 add.w w1, w0, w0
45a: 10 40 78 mov.b [w0], w0
45c: 00 49 78 mov.b w0, [w2]
45e: 1e 0f e8 inc.w [w14], [w14]
RingBuffer[RingWritePostion++&0xfff]=HXASCII[dat&0x0f];
460: f0 ff 20 mov.w #0xfff, w0
462: 1e 00 60 and.w w0, [w14], w0
464: 80 00 78 mov.w w0, w1
466: 2e 00 90 mov.w [w14+4], w0
468: 00 81 40 add.w w1, w0, w2
46a: 6e 40 90 mov.b [w14+6], w0
46c: 00 80 fb ze w0, w0
46e: ef 00 60 and.w w0, #0xf, w1
470: 00 00 20 mov.w #0x0, w0
472: 00 80 40 add.w w1, w0, w0
474: 10 40 78 mov.b [w0], w0
476: 00 49 78 mov.b w0, [w2]
478: 1e 0f e8 inc.w [w14], [w14]
RingWritePostion&=0xfff;
47a: f0 ff 20 mov.w #0xfff, w0
47c: 1e 0f 60 and.w w0, [w14], [w14]
47e: 00 00 37 bra 0x480 <.L106>
It helped out alot on this section of the code, I've uploaded a Hex file and source snippet, would be interesting to hear if it can capture 400khz traffic now, as I've not got anything here to test that with and of course if the code is useful, your welcome to use and abuse however you like