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.

Using NHET pins as simple inputs

Other Parts Discussed in Thread: HALCOGEN, DRV8301

Hi,

I'm trying to read the 3 digital hall sensors from the motor with theDRV8301-LS12-Kit.  Seems like it should be simple, but its eluded me so far.  One of the hall sensors is connected to the cpu on GIOB5 and I can read this just fine.  The other 2 are connected to NHET7 & 9. 

I have the DIR register set to input, HR sharing, AND & XOR turned off and yet no signal.  The physical signal is on my scope, but I can't read it from the pin in software.

How do I read a HET pin?

All help appreciated!

Mike

  • Hi Michael

    You have to read DIN register.

  • I am reading the DIN register.

    I'm trying to read NHET1.7 and NHET1.9.  This my code to read the pins...

        uint8 result = 0;

        uint32 hetDin = hetPORT1->DIN;

        if ((hetDin & 0x0020) == 0x0020) {

            result |= 0x01;

        }

        if ((hetDin & 0x0008) == 0x0008) {

            result |= 0x02;

        }

    I'm not just trying to read any old HET pins.  I'm trying to read the digital hall sensor on the DRV8301-LS12 kit.  If I've misinterpreted the schematic and I'm looking at the wrong pins, please let me know.

    Thanks,

    Mike

  • Mike,

    I'll let Henry comment on the DRV kit and whether you've got the right pins.  I looked at the schematics and they looked right.  Also didn't see anything like switches or other logic between the pins and the MCU that would interfere.  And these pins have no input mux that could be getting in the way.

    If you attach CCS can you see the pins toggle when you inspect the HET DIN register?   You should be able to open the register window,  make the HET DIN register visible (highlighted below), press the 'continous refresh' button (also highlighted below),  and then do something on the kit to make the pin toggle.  (Can you simply rotate the motor rotor by hand to make the pin toggle?)

    If you see the pin toggle in the register window, then I suspect the problem with the C code might have something to do with the 'volatile' qualifier.

    I don't see it applied in your code; although the het structure is volatile...  I'd need to look up the rules on this, but it could very well be that the code generated only reads the physical register one time if it's not volatile.

    -Anthony

  • Hi Anthony,

    I can spin the motor by hand and see the halls on my oscilloscope.  I get the pattern I expect.

    I setup the debugger on refresh and looked at the HET->DIN register.  I see these bit toggling as I turn the motor: 0x1000000A.  That is bits 28, 3, & 1.  None of these pins' state correlates to the signals I see on the scope.  And my expectation is to see pins 7 & 9 toggling.

    The hall sensor that is connected to GIOB5 works fine (what I see with the scope relates to what I see in the debugger and sw).

    Thanks,

    Mike

  • NHET7 and NHET9 are connected through 50 ohm resistors to ECAP6 and ECAP5 respectively.  I assumed that ECAP 5 & 6 were inputs so I didn't pay much attention to them, but by default the pins are not muxed to ECAP 5 & 6.

  • When I change my HALCoGen project to mux the pins to ECAP 5 & 6, rebuild and retest, it does not make a difference.

  • Mike,

    Huh - this is turning into quite a puzzle.

    Pins N2HET1[3] and N2HET1[1] are multiplexed with the EQEP2 module,  which goes to pins 40 and 90 on the DIMM.

    Could your hall sensor hookup be going to theset pins?   Which connector on the DRV8301 board did you connect the sensor to?

    Thanks and Best Regards,

    Anthony

  • The Teknic motor comes with two 5 pin headers, one is the Encoder interface, which should be connected to J4 in the DRV8301 monther board, the other one is the Hall sensor interface, which should be connected to the J10 in the DRV8301. J4 and J10 are next to each other close to the edge of the board.

    Sounds to me that you connect the hall sensor to J4 instead of J10.

    I attached part of the code to run with the Hall sensor with this kit. The total project is too big to be posted. The sys_main.c starts with the pin mux code (I did not use the HalCoGen pin mux). rm46hall_gpio_BLDC.c is the code to get the hall sensor information. 7612.sys_main.c2086.rm46hall_gpio_BLDC.c0647.rm46hall_gpio_BLDC.h

     hetREG1->DIR = hetREG1->DIR & 0xDFFFFD7F;//(1<<29)+(1<<7)+(1<<9)
     hetREG1->SFPRLD = 5; //5 VLCK Counter delay amount to validate/debounce GPIO readings
     hetREG1->SFENA = 0x20000280;
     temp = hetREG1->DIN;
     hall->HallGpio =  ((temp >>29) & 0x1) +((temp >>6) & 0x2) + ((temp >>7) & 0x4);

    Good Luck!

    Haixiao

  • The cables from the motor are label J4 and J10 and I have them plugged into to the right connectors on the board.

  • Michael,

    I checked the 8301 board document and they said J10 is connected to CAP1/2/3 hall sensor 1/2/3 respectively.

    The CAP 1/2/3 are connected to DIM100 pin 30,80,31 respectively.

    That translate to HET1[13],HET1[17], GIOB5 respectively.

    can you please double the connection again?

  • Michael,

    Look at the attached document page 11 (table 4-18) and page 8.

    1222.DRV830x-HC-C2-KIT_HWGuide.pdf

  • Mike,

    I think the idea that the cables are swapped matches what you are reporting, so it's highly likely that this is the issue.

    Look at the picture below, you can see how swapping the cables would move the signals from HET1[7],[9] to HET1[3],[1]....

     

    It could be a quality issue with the cable, maybe the labels are on the wrong cables? 

    Probably the only way to prove this is to ohm out a few connections from the J4/J10 header to the motor side connector.

     

  • I believe this is the motor that comes with the kit, there's a pinout for the motor connector in this document:

    http://www.teknic.com/files/product_info/N23_Industrial_Grade_Motors_v5.2.pdf

     

  • Mike,

    Sorry - one more thought.

    It may be that the cables *are* labeled correctly, and you've got them going to the correct headers on the DRV8301 board;  but have the J10 connector 'backward'.

    This would also result in you seeing the encoder inputs toggle but no activity on the hall sensor as you rotate the rotor.

    In the quick start guide there is a color photo showing the wire color order.  You might also check that the wire color order there matches how you have the cables plugged into the board.   There isn't any sort of key - so it would be very easy to flip this around.

    Best Regards,

    -Anthony 

  • Okay,

    I think I've got this issue... The halls coming from the motor are connected to J10.  The hall signals on the DRV board go from J10 to U7 level shifter (5V to 3.3V).  The output of U7 is labeled CAP1, 2, & 3.  CAP1, 2, & 3. go to DIMM 100 as pins 30, 80, & 31 and to J5 as pin 14, 16, & 11.

    I attached my scope to J5 and saw the pins toggling, but CAP1 & 2 where only toggling from 0 to 1.1V.  Looking at the schematic for the controlCARD, CAP 1 & 2 are connected to NHET09/ETPWM7A and NHET07/ETPWM7B.  Page 2 of the schematic shows ETPWM7A and ETPWM7B connected to GND through R16 & R17 ( 2.2K).  The level shifter (U7 on DRV board) has an internal pull up/down of 4K.  Hence the U7 level shifter is fighting the 2.2K pull down resistors and the voltage doesn't get high enough to register as logic high.

    Once I removed R16 & R17 on the controlCARD, NHET09/ETPWM7A and NHET07/ETPWM7B toggle from 0 to 3.3V just like GIOB5!

  • Excellent work Mike.

    Looks like the 4K resistor in the DRV board are actually in series with the output on the level shifter, so no matter how strong you would drive the signal on J10, you would have this problem. 

    Thanks for debugging this one.   Looks like we have something to fix.

    Best Regards,
    Anthony