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.

CCS/TMS570LS0432: Adjacent pins influencing each other.

Part Number: TMS570LS0432
Other Parts Discussed in Thread: HALCOGEN, TMS570LS1224

Tool/software: Code Composer Studio

Hello,

I would like to use adjacent GIO-Pins to read two square wave signals or more exactly their freuqncies.

Everytime a rising edge is detected on the pin, an interrupt-notification should occure and the ISR is executed. 

However these frequencies seem to influence each other:
When I am only using one GIO-Pin and the adjacent pins are all wireless, the measured pin works fine (visualized by a pin toggled by the ISR).

But when I am connecting a wire with another square wave signal to any adjacent pin, the signal is influencing the measured signal.

I also recognized this using multiple ADC-Pins to measure voltage depending on potentiometers. The adjacent pins are influenced by the voltage of their neighbors...
This is especially noticable when no wire is connected to the measured ADC-Pin and vary the voltage of one of its adjacent pins!

Do you know why this is the case? Or better how I can fix the issue?

Thank you in advance!

  • Hello,
    Please, refer to this application note concerning ADC: www.ti.com/.../spna118b.pdf
    I am not sure what do you mean by "the signal is influencing the measured signal". What is happening when you connect two adjacent pins?
    Keep on mind that Hercules MCUs are not supporting nested interrupts. When GIO pin generates interrupt, then next interrupt will be serviced after previous ISR is completed. You can consider N2HET module for measuring frequencies.

    Best regards,
    Miro
  • Hello Miro,
    I would like to measure two different frequencies with my microcontroller. Currently I am using GIO-Pins and an ISR, which counts the interrupts created by a rising adge in a specific time period.
    With one pin in use this works totally fine and the results are as expected. But when I connect a second wire adjacent to the pin I am using to measure the first frequency, the results are totally false:
    E.g.: Via a frequency generator I am creating two square wave signals, one with 1 Hz, the other with 1 kHz. When I only connect the 1Hz-Channel to the GIO-Pin the result is correct (and an LED is toggling every second due to an extra line in the ISR).
    When i connect the second wire with 1kHz to any adjacent PIN, the result is completely wrong and the LED is flickering randomly...

    Maybe its easier to capture the frequency with the N2HET module, but I dont't know how, because the tutorial is only for creating a pwm and not for capturing the signal... Furthermore I have to detect if an edge in the frequency is missing (a sensor is reading a gear for measuring the revolutions per minute and might miss an edge) and I don't know if this is possible with the N2HET.

    Furthermore I am reading different 6 Analog-Inputs on adjacent pins (ADIN0 - ADIN5). If for example ADIN1 is connected to ground it still reads a value depending on the voltage of ADIN0...

    Thank you again for your help :)
  • Hello again,

    I have just read in the TVM that you can only select a 10- or 12-Bit-ADC, but in Halcogen there is an option for 8-Bit (which I am using). May this be a problem?

    I am using the TMS570LS043...
  • Hello,
    Both GIOs that you are using generates interrupt which is serviced by the same handler. In ISR you should determine which pin is causing the interrupt to make difference when counting interrupts.
    Please, increase sampling time of ADC.

    Best regards,
    Miro
  • void gioNotification(gioPORT_t* port, uint32 bit)
    {
    if((port==gioPORTA)&&(bit==0))
    {
    gioToggleBit(gioPORTA,6);
    v_Left_Counter++;
    calculateTimePeriod(0);
    //Zeit erfassen und vergleichen mit alter Zeit.. wenn ganzzahliges Vielfache +-5% dann zusätzlich Counter erhöhen
    }

    if((port==gioPORTA)&&(bit==1))
    {
    v_Right_Counter++;
    calculateTimePeriod(1);
    }


    }

    I am actually doing this.. or did I miss something here?

    I solved the ADC Problem via using the ADC- Self- Test Mode :D Thanks for your help over there too!!!
  • Hello Christian,
    When GIO pin generates interrupt, then next interrupt (from the other GIO) will be serviced after previous ISR is completed. This could lead to wrong measurements because interrupts may overlap.
    I recommend you to use HET for this. You can try using HALCoGen generated functions for capturing period and duty.

    Best regards,
    Miro
  • yes, I know. That's what you meant with not supporting nested interrupts.

    But even if i connect the 1kHz wire to the NHET21 pin (another adjacent PIN of GIOA0) and only have GIOA0 configured in Halcogen to execute an interrupt, it still creates mistakes in the result of the frequency on GIOA0.

    Thanks for your continuos support!
  • Hello,
    It is good to check with oscilloscope whether this comes from cross-talking.
    You could try connecting external capacitors from pin to ground (few picofarads - your signals are low frequency and this is not going to ruin them) or external pull-down resistors.

    Best regards,
    Miro
  • It would actually be pretty nice to capture the duty of the frequence as well..
    With the N2HET Module this is possible, but I have no example code for capturing frequences with the N2HET Module.

    I only found one small example for Pulse Measurement in the Technical Reference Manual but there is no instructions how to initialize and writ the code..
  • /* USER CODE BEGIN (0) */
    #include "gio.h"
    #include "het.h"
    #include "sci.h"
    #include "stdlib.h"
    /* USER CODE END */

    /* Include Files */

    #include "sys_common.h"

    /* USER CODE BEGIN (1) */
    hetSIGNAL_t* signal;

    float period;
    unsigned char period_inChars[16]; //Strings zur PC-Visualisierung über SCI
    /* USER CODE END */

    /** @fn void main(void)
    * @brief Application main function
    * @note This function is empty by default.
    *
    * This function is called after startup.
    * The user can use this function to implement the application.
    */

    /* USER CODE BEGIN (2) */
    /* USER CODE END */

    int main(void)
    {
    /* USER CODE BEGIN (3) */
    uint8 NumberOf_Chars; //Anzahl der Chars für die SCI-Übermittlung

    gioInit();
    sciInit();
    gioSetDirection(hetPORT1, 0x00000000);
    gioSetDirection(gioPORTA, 0xFFFFFFFF);



    hetInit();
    hetREG1->GCR |= (1<<26);

    while(1)
    {
    capGetSignal(hetRAM1, cap0, signal);

    period = signal->period;


    NumberOf_Chars = ltoa(period, (char*) period_inChars); //Pin-Nummer in Chars umwandeln
    sciSend(scilinREG, NumberOf_Chars, period_inChars); //AD-Pin Nummer ausgeben
    sciSend(scilinREG, 2, (unsigned char *) "\r\n");


    gioToggleBit(gioPORTA,6);
    _delay_cycles(16000000-1); //delay
    }

    /* USER CODE END */

    return 0;


    This just returns me the same value everytime independent on the frequence.
    In Halcogen I only did the follwoing adjustments:
    HET->edge0-7: Edge 0 = Rising Edge
    HET->edge interrupts: edge 0 = enable, HighLevel
    HET->Cap0-7: Cap0 = High Polarity

    this isn't working.. Can you give me advice or a simple example?
  • Hello,

    Attached is example project for TMS570LS1224 that uses HET to generate PWM (PWM0 on HET1[9]) and capture it (CAP0 on NHET1[10]). Also capturing of external signal is implemented - CAP1 on pin HET1[12]. Both HALCoGen and CCS projects are included. You can use it as a reference.

    Take a look at this link as well:

    5140.e2e_PWM_HET_1224.zip

    Best regards,

    Miro