This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

eCap input on GPIO 19 tms320f28027

Other Parts Discussed in Thread: DRV8305, MOTORWARE

In my hal.c file in the HAL_setupGpios function I have:

// ECAP
GPIO_setMode(obj->gpioHandle, GPIO_Number_19, GPIO_19_Mode_ECAP1);

Does ecap mode enable the pull-up by default?  I have a 3.3k/6.8k resistor divider to drop a 5V level (4.6V in this case) pwm signal coming into GPIO 19.  The ecap module is correctly measuring the incoming signal duty cycle but the voltage at the pin shows 2.1V instead of the expected 3.1V.  The 2.1V level would indicate that the 140uA pull-up is enabled.  I tried the following code to disable the pull-up;

GPIO_setPullUp(obj->gpioHandle, GPIO_Number_19, GPIO_PullUp_Disable);

But this shows the same functionality.  Is the pull-up allowed to be disabled in ecap mode?  If so, what am I missing here?   

  • Hi Shay,

    If the internal pull-up was enabled, wouldn't it increase the voltage on the pin (not decrease it)?  Or am I missing something?


    Thank you,
    Brett

  • I'm assuming the pull-ups are not resistors but an active device such as a pnp/pmos? I realize my earlier calculation isn't correct as I was just subtracting 140uA from the divider node and it just happened to match the voltage level on the scope. For a sanity check I'm setting up a simple sim using the gpio model on pg.118 of the datasheet. As far as the configuration of the pin, is there anything I could be missing?
  • Hi Shay,

    You are correct that they are active circuits, but the circuit is connected to VDDIO, so the internal pull-up will source current to the net.

    How are you measuring the voltage on the pin?


    Thank you,
    Brett

  • I'm using a scope to capture the waveforms.  

  • OK.  I cannot think of something that would explain your observations then.

    Note that you can check the status of the pull-up during run-time by populating GpioCtrlRegs.GPAPUD.bit.GPIO19 into a CCS Watch Window.  If 1, the pull-up is disabled. 

    The value of any register field, after a reset, can be found within your device's reference guides.  GPIO details are located within the 'System Control and Interrupts' guide.  GPAPUD.bit.GPIO19 shows that the pullup will be enabled after a reset.  Software may then affect the setting.


    Thank you,
    Brett

  • The expression didn't populate correctly, but GPAPUD shows x000A0FFF on the registers tab. Is bit order displayed in the watch window [0:31] as the description suggests?
  • Hello Shay,

    In the Expressions window, GpioCtrlRegs.GPAPUD.bit.GPIO19 should be valid.

    The order of bits should be [31:0], as the User's Guide suggests.  What description are you referring to?


    Thank you,
    Brett

  • The expression you gave shows an identifier not found error.
    In the registers tab the Description column for GPAPUD has the description "GPIO A Pull Up Disable Register (GPIO0 to 31)" . I assumed the display order was [31:0] but the description column is what prompted my question as the (GPIO0 to 31) could be read to suggest otherwise.
    I think the issue is more likely a hardware issue then.
  • [for what it's worth, I now realize why the expression wouldn't work - you are using the driver-based example set.  The expression I was asking you to put into the watch window is not defined in these examples - only the bitfield struct style examples]

    Good luck debugging!

  • Brett,

    Thanks for the reply.  I did find that the issue was in hardware.

    I do have a question about watch window expressions as I am trying to debug why now lab02c immediately faults every time I try to run it.  It was working fine with the motors I have but now it won't work at all.  I'm pretty new to this stuff, do you have any examples on the proper way to read out the status registers of the drv8305 to the gDrvSpi8305Vars in the watch window?  

  • Hi Shay,

    First, I must admit that I am not very knowledgeable about this particular motorware solution.  If were me, I'd re-see if I could get the Universal GUI to work.  However, I feel you'll likely get better comments than what I'm offering by posting a question on the issue you're having into the InstaSpin forum.

    ===

    That being said, assuming gDrvSpi8305Vars is an object, whose memory is allocated in code, you should just be able to type "gDrvSpi8305Vars" into the expression window (assuming the project's .out file has been loaded to the device).  You can then click on '+'s to expand things so that you can see the various elements of the structure.  Using real-time mode, you can even view the variable in real-time without effecting the processor.

    My last sentence may make more sense after the following video (around 8:40).  Note that the video was made around the time of CCS4, however only minor cosmetics have changed since then...
    https://www.youtube.com/watch?v=gVDRo9m-4ng

    Hopefully this helps!


    Thank you,
    Brett

  • Brett,
    Sorry, I should have explained my issue more clearly. Currently I have the expression in the watch window but the problem is that on my scope the nfault pin is going low but the FAULT bit in the drv8305 status register in the watch window does not update even though real-time mode & continuous refresh is enabled.
  • Hi Shay,

    As above, I'd recommend posting this to the InstaSPIN forum so that you can get the best response.


    Thank you,
    Brett