Weird code wrt open-drain and initialization?

OpenOCD JTAG debugging with the Bus Pirate.

Weird code wrt open-drain and initialization?

Postby matthijs » Mon Oct 21, 2013 6:21 am

Looking around the firmware sources, I found something weird (I don't really know PIC programming, so my interpretations might be wrong):


The code says:
Code: Select all
#define OOCD_TDO_ODC    BP_MISO
#define OOCD_TMS_ODC    BP_CS
#define OOCD_CLK_ODC    BP_CLK
#define OOCD_TDI_ODC    BP_MOSI
#define OOCD_SRST_ODC   BP_AUX0


See also http://code.google.com/p/dangerous-prot ... enOCD.c#29

Unless I'm mistaken, these should refer to e.g BP_MISO_ODC instead of the regular BP_MISO variables, right? Reading on in binOpenOCDPinMode it looks like now configuring open-drain mode doesn't actually use open drain mode, but instead just initializes the value of the pins to 1 instead of 0?

Additionally, in the binOpenOCDPinMode I see:
Code: Select all
        // reset all pins
        OOCD_TMS=0;
        OOCD_TDI=0;
        OOCD_CLK=0;
        OOCD_SRST=0;
#if defined (BUSPIRATEV3)
        OOCD_TRST=0;
#endif

Unless I'm mistaken, this pullse the SRST and TRST lines low (perhaps not directly, but when the TRIS bits are cleared a few lines down)? Should't the reset lines default to high instead of low? Note that I haven't actually observed my target resetting without explicitly telling openocd to reset it, so either my interpretation is wrong, or perhaps the reset low pulse generated by this is too short for a reset (since shortly after setting the pinmode, openocd clears the reset flag).

Are these hidden bugs?
matthijs
Newbie
Newbie
 
Posts: 13
Joined: Wed Jan 30, 2013 3:23 pm

Return to OpenOCD JTAG

cron