Pumpkin, Inc.

Pumpkin User Forums

Trying to use DTR_MHX as an input

If you have a general question or comment regarding the CubeSat kit, post it here.

Trying to use DTR_MHX as an input

Postby sncuser » Tue Jun 10, 2014 1:29 am

My project is trying to re-purpose some of the MHX lines for other purposes. So I'm trying to disable the MHX interface and set up DTR_MHX as a digital input. I found the following code in an example file:

Code: Select all
        // Disable MHX interface
        P4      |=  ON_MHX_BAR;
        P4MDOUT |=  ON_MHX_BAR;
        P5      |=  (HS5+HS4+HS3+HS2+HS1+HS0);
        P5MDOUT |=  (HS5+HS4+HS3            );
        P5MDOUT &= ~(            HS2+HS1+HS0);

       // restore -OE_MHX to an input.
       P4      |=  OE_MHX_BAR;
       P4MDOUT &= ~OE_MHX_BAR;

Then I'm trying to make sure that DTR_MHX is set up as an input, like this:

Code: Select all
      P5MDOUT = 0x00;                     // P5.4 is open-drain
      P5     |= 0x10;                     // Set P5.4 latch to '1'

Then I alternate between feeding a HI value into that line, and disconnecting that input to see if anything different happens, testing it like this:

Code: Select all
     if(IMAGING_READY_LOW == 0)

where I have declared IMAGING_READY_LOW to be an sbit to P5^4. So far, no go.

Any help you can give would be greatly appreciated!
Posts: 22
Joined: Thu Feb 13, 2014 2:49 pm

Re: Trying to use DTR_MHX as an input

Postby aek » Wed Jun 25, 2014 1:44 am

Sorry for the late reply. A couple of things to note:

1) For the MHX interface to work / be active, two things need to be true (see schematics 00194E-2.PDF and 00194E-5.PDF):
i) -ON_MHX must be active. This ensures that U2 and U3 are fully powered on both sides, i.e. signals can pass through them.
ii) -OE_MHX must be active. This ensures that signals do pass through them.

2) Enabling the MHX interface is an all-or-nothing affair ... either all of the signals can pass through the U2 & U3 level shifters, or none can. This means that when using the MHX interface, the USB interface must be disabled (via -OE_USB/-INT being disabled). Otherise you will have I/O conflicts.

3) The directions of the signals crossing U2 & U3 are fixed, e.g. HS3, HS4 and HS5 can only be outputs from the C8051 (because they are connected to the input of U3 (signals flow A->B only).

4) Please note that there are library functions in \Pumpkin\CubeSatKit\8051\Src like csk_mhx_open() in csk_mhx.c:
Code: Select all
void csk_mhx_open(void) {

  // Disable all control signals to avoid spurious
  //  writes when -OE_MHX goes active (LOW).   
  P5      |=  (HS5+HS4+HS3+HS2+HS1+HS0);
  P5MDOUT |=  (HS5+HS4+HS3            );
  P5MDOUT &= ~(            HS2+HS1+HS0);
  // Configure -OE_MHX as an output, and make
  //  it active (i.e., LOW)
  P4      &= ~OE_MHX_BAR;

} /* csk_mhx_open() */
that will make it much easier to get these things working ... I would suggest using the USB ones to disable the USB interface, and copying the MHX ones to some new functions of your own, with the requisite pin mode changes (if required).

TL;DR: -DTR_MHX can only be used as an output from the C8051 if it passes through U3 in your system. If JP25 is set to 1-2, -OE_MHX is disabled, you connect (directly) from the C8051 to -DTR_MHX on H1 and you've dealt with any level-shifting issues, then you can use it as an input. IOW, you have to "go around" U3 to do that ... it's much easier to use -CTS_MHX, -DSR_MHX or -DCD_MHX as inputs, as they are already configured to be inputs through U2 into the C8051.
Posts: 1886
Joined: Sat Aug 26, 2000 11:00 pm

Return to CubeSat General

Who is online

Users browsing this forum: No registered users and 1 guest