Debug printf to trainer port

More
25 Apr 2013 07:52 #9192 by victzh
Debug printf to trainer port was created by victzh
I am now debugging my V202 protocol, and I need to see debug printfs. As far as I understand, USART is connected to trainer port, and all printout can go there. Do I need to activate it in the code, or is it always on?

Please Log in or Create an account to join the conversation.

More
25 Apr 2013 12:54 #9196 by PhracturedBlue
Replied by PhracturedBlue on topic Debug printf to trainer port
to enable printf you need to:
make clean
make TYPE=dev

you also need a UART->USB adapter. I use a CP2102 based $3 module from ebay.
The signal comes out the 'tip' of he phono plug.

Please Log in or Create an account to join the conversation.

More
25 Apr 2013 18:20 #9208 by victzh
Replied by victzh on topic Debug printf to trainer port
Thanks, will try today. I really need some view into what happens inside, but too lazy to attach debugger etc.

Please Log in or Create an account to join the conversation.

More
25 Apr 2013 19:55 #9209 by PhracturedBlue
Replied by PhracturedBlue on topic Debug printf to trainer port
be aware that the entire protocol code runs in interrupt context. using printf inside an interrupt is generally unsafe as I do not use a re-entrant printf implementation.

Please Log in or Create an account to join the conversation.

More
26 Apr 2013 10:11 - 26 Apr 2013 10:13 #9221 by kenkenlau
Replied by kenkenlau on topic Debug printf to trainer port
PB,

may I know where is the IRQ handler located? I wish to try some code to receive data from trainer.

Thanks.

EDIT: and the TYPE=DEV only affect the std.h?
Last edit: 26 Apr 2013 10:13 by kenkenlau.

Please Log in or Create an account to join the conversation.

More
26 Apr 2013 12:42 #9227 by PhracturedBlue
Replied by PhracturedBlue on topic Debug printf to trainer port
TYPE=dev only affects std.h, but it is included by every single c file

all of the low-level code is handled in target/common_devo OR target/devoXX. They are not all together though. The PPM-in stuff is in target/common_devo/ppmin.c
There is other irq stuff stuff in target/common_devo/clock.c as well as other places.

Please Log in or Create an account to join the conversation.

More
26 Apr 2013 14:33 #9231 by victzh
Replied by victzh on topic Debug printf to trainer port
Hmm... It probably explains that I see the signal on the oscilloscope but my USB-Serial adapter (coincidentally, also based on CP2102 as yours) can't decode it. I'll check it again, but I solved the first problem using oscilloscope, not the debug print. One more to solve - correspondence between Channels and stick positions, and I have it implemented.

Please Log in or Create an account to join the conversation.

More
26 Apr 2013 14:48 #9232 by PhracturedBlue
Replied by PhracturedBlue on topic Debug printf to trainer port
If it helps, the baud rate is 115200 N81

Please Log in or Create an account to join the conversation.

More
26 Apr 2013 15:27 #9235 by victzh
Replied by victzh on topic Debug printf to trainer port
That I figured from the code, thanks. In Devo 10 the trainer port is connected with 4 wires, may be I am using the wrong jack so that signal is visible on oscilloscope but too week to be interpreted by the dongle I have.

Please Log in or Create an account to join the conversation.

More
26 Apr 2013 17:40 - 26 Apr 2013 17:41 #9236 by PhracturedBlue
Replied by PhracturedBlue on topic Debug printf to trainer port
Make sure your dongle is set to 3.3V i think they can be configured for 3.3 or 5V.

The devo8 only has 3 wires. I need to look at my devo10. I guess they actually support bidi on the devo10

well, there are 4 wires on the connector, but only 3 are actually used on the devo8 is what I meant.
Last edit: 26 Apr 2013 17:41 by PhracturedBlue.

Please Log in or Create an account to join the conversation.

More
26 Apr 2013 18:23 #9238 by victzh
Replied by victzh on topic Debug printf to trainer port
Yea, I will check with another dongle which proves to be working on 3.3v. The one I used for Devo does the echo when RX and TX shorted together, but that does not mean anything about the voltage. But usually it should pick up anything higher than 2.5v (actually, even less than that) as 1, so the dongle's voltage level should not be a problem. I still think that the timing may be wrong - I looked at the oscillogramm, it does not read as clean async serial - to short space between the stop bit of a previous byte and start bit of the next. So it still needs to be investigated - I want it to be functional for more complex cases.

Please Log in or Create an account to join the conversation.

More
26 Apr 2013 22:28 #9252 by kenkenlau
Replied by kenkenlau on topic Debug printf to trainer port
Thanks PB. I will try to take a look in it.

Victzh,

whats the chipset? If it is a CP2102, it should be fine. If it is CH314, it may be ok. If it is PLXXXX, it does not work for me.

Please Log in or Create an account to join the conversation.

More
27 Apr 2013 02:48 #9254 by victzh
Replied by victzh on topic Debug printf to trainer port
Thanks, everything is as usual is simpler and wilder than my guesses. People making this, admittedly dirt cheap, adapters mixed up TX and RX and all this time I was trying to get something sensible connecting different Devo's contacts to what is proved to be TX. I figured this with the help of oscilloscope, and everything started to work. And debug print helps a lot.

Please Log in or Create an account to join the conversation.

Time to create page: 0.051 seconds
Powered by Kunena Forum