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 pin 55 to generate an interrupt

Other Parts Discussed in Thread: ADS1271, TMS570LS1224, HALCOGEN

Hi

I'm using the TMS570LS1224 for a project and was wondering if I could use the pin 55 to generate the interrupt I need for the DRDY on the ADS1271 to start receiving the data on the MCU.

best regards

  • Hi Miguel,

    Pin 55 is shared between the MIBSPI3NCS[0]/AD2EVT/GIOB[2]/EQEP1I/N2HET2_PIN_nDIS functions. Among these, the input to the GIOB[2] can generate an interrupt. For this to work, you need to switch the input to the GIO module to come from pin 55 instead of the default pin 142. You can do this by configuring the I/O Multiplexing Module. HALCoGen can generate the necessary code for you as part of the muxInit() function once you configure the 'Special Pin Muxing" sub-tab from the PINMUX tab. The option is called "Use GIOB_2 for disablling selected HET2 PWM outputs". Select this check box and the generated muxInit() function will switch the GIOB[2] input for you.

    Regards,
    Sunil

  • but if im using all the pins of the module n2het is there a problem??
    so is just code and use the pin 55 as an interrupt and the 142 as a normal GPIO??
    best regards
  • Hi Miguel,

    No need to worry about that. You can use all the pins of the NHET as usual. For the "NHET Pin Disable" Feature to work, you need to additionally configure the NHET to do so (by setting HETGCR register bit 24).

    Thanks and Regards,

    Vineeth 

  • Hi
    Thanks for the answer and sorry for the extra super late reply.
    I also was wondering about something..
    I was reading the user manual of the MCU and saw the info but i was wondering if I can configure the 3pin mode with HALcogen, or how could i do it by hand..

    best regards
  • Hi Miguel,

    Can you clarify what you mean by "3pin mode"? 

    Thanks and Regards,
    Vineeth

  • Is referred to the point 28.2.2.3 from the reference manual of the MCU. Is a mode where you only connect the SPICLK, the SPISIMO and an interrupt to indicate the MCU the info is ready.

    best regards =) 

  • Hi,

    You can configure SPI to work in 3 pin mode by configuring all the SPI_CS pins and SPI_EN as non-functional. If you are using HALCoGen, you can go to SPI Port Tab and configure those pins as GIO.

    It is possible to configure interrupt for SPI TX and RX interrupts (to the MCU) by configuring the SPIINT0 register. Please refer to the TRM for register details.

    Also, HALCoGen provides API to send and receive data in interrupt mode (Refer HALCoGen API spiSendData and spiGetData).

    Hope this helps!

    Thanks and Regards,

    Veena

  • I have been trying to find the multiplexing option to tell the GIOB2 to be from pin 55 but i dont find it... in which part is that??

    best regards

  • Hii

    Im done with the pin configuration and trying to look on the VIM tab so I can activate the interrupt and the priority but how does it appear? as GIO high? or how do I configure the interrupt on pin 55? and for me to use it...
    I need something like
    if(pin55 interrupt==1)
    {
    clean flag
    stop all interrupts
    disable pin 55 interrupt
    do something
    enable all interrupts
    enable pin 55 interrupt
    }

    thanks for the help
  • Miguel,

    Well, I assume the psuedo-code should be interpreted liberally like the 'function' you want not the 'code' you want to write.

    Because normally:

    Miguel Amezcua Peregrina said:
    if(pin55 interrupt==1)
    {

      This would be handled by the interrupt hardware.   From the GIO which detects the edge, to the
    VIM that detects the interrupt from the GIO,  to the CPU that finally gets the IRQ from the VIM.

    Miguel Amezcua Peregrina said:
    stop all interrupts

    This is done automatically by the CPU when you enter the ISR,  in the sense that entering IRQ mode disables further interrupts at the ISR level.   [it does *not* disable interrupts at the FIQ level which should be limited to ESM errors and it does not disable other exceptions like abort though.. just FYI..]

    Miguel Amezcua Peregrina said:
    clean flag

    This is normally handled after entering the ISR, so your description has this step and the previous one reversed.

    I believe you will find that this step is done in the ISR generated by HalCoGen.

    Miguel Amezcua Peregrina said:
    disable pin 55 interrupt

    and later
    Miguel Amezcua Peregrina said:
    enable pin 55 interrupt

    Well you can do this but normally disabling all the interrupts covers this and you don't disable the pin interrupt specifically.
    Normally you also keep the 'do something' code short so you are in/out of the ISR fast and interrupts are only disabled for a short time.

    Miguel Amezcua Peregrina said:
    do something

    HalCoGen uses the 'notification' callback function for this ..  the ISR will call the notification function if you enable notifications.  Usually it'll pass a parameter or two like which GIO port / pin interrupted.

    You can look at the ISR generated by halcogen in the file "gio.c' to see what it does.
    It will do everything you need except the 'do something' step.

    For that it will call the notification function you provide, and you write the code for 'do something'.


    Note:  the interrupt handlers are not generated unless you check all the boxes to enable the GIO interrupt in the VIM.
    So if you don't see them make sure you've got the interrupt enabled in the VIM and if not enable it and generate again.
    (by 'the interrupt' I mean the specific channels for GIO need to be enabled or else the GIO ISR code won't  be generated).

  • mmmm let me see if I get it correctly

    if(pin55 interrupt==1)

    {

    stop all interrupts

    clean flag

    disable pin 55 interrupt

    do something

    enable all interrupts

    enable pin 55 interrupt

    }

    The red lines: the if is to enter to the function. but that part, is done by using the notification halcogen generates? so it would be... if interrupt X then do the function?

    do I need to clean the flag? or it is done by halcogen?

    the enable all interrupts would be when finishing the interrupt right? and I could get rid og the disable/enable pin 55 interrupt?

    The pin 55 of this MCU is the GIOB2, which I select on the special mux tab. But I did not find any option referent to it on the VIM channels tabs... so I don't know how to use it... 

  • The idea is:
    if(pin55 interrupt=1)
    spiInit()

    and with this, I turn on the SPICLK and the SOMI and receive the data
  • Miguel,

    Halcogen manages the interrupt hardware.
    You just implement your 'do something' in the notification callback.
  • Im glad to know that... I saw one example but i fI need that. the reception starts when the pin 55 is in low... how could I do it? because thats when I need to start receiving the data...

  • Is your SPI configured as Master or Slave?
  • So please read in the TRM about the master feature called 'ENABLE'.

    It allows you to write software that sets up a transfer (you write to the transmit register) but the actual transfer is delayed until the SPIENA pin is driven low. You might be able to make use of this feature although the SPI will also check that it goes high at the end of a transfer and you may get a bogus desync error that I think you can just ignore. Anway look at this feature.

    Also consider whether you could simply use the MibSPI and trigger the transfer group based on a falling edge of said pin...

    These things would potentially be easier and handled by Hardware, compared to what you are trying to do in software.
  • The problem is that the SPIENA is being used as a pin for the driver to select the direction of the motor... so I cannot use it for the SPI... Thats why the GIOB[2] on pin 55...
  • Also too bad it's not a GIOA[x] pin because any of those pins can trigger a MibSPI transfer group.
    Essentially if you had a GIOA[x] pin instead of GIOB[2] a whole string of activity could start whenever that pin goes low...

    Well, in your 'do something' routine (the callback) you'll just need to write to the SPIBUF register to initialize a transfer. Make sure you check though that the SPI is read before writing to the buffer, in case there is a bouncy/noisy input.
  • I selected the GIOB[2] because its only function is to interrupt the CPU when the pin is driven low.
    so... if I get it right....
    the code could be something like...:
    messageGIOB2=1
    spiReceivedata
    turn_off_GIOB2_flag
    ??
  • sure. although I think you won't need to turn off the GIOB[2] interrupt flag .. that should be done before your callback is called and passed to you as a parameter.
  • thats sounds great.

    one last question

    on the MCU tab on halcogen, there is a tab with the channels of the VIM. I was wondering which one should I use because there is a lot of options there... I configured the pin this way: 

  • Hi Anthony
    I have 3 questions about this pin.
    1)I selected the option on special pin mux so it works on pin55. Also... on the datasheet its says that the pin is automatically configured as input with a pull up resistor and that cannot be configured to wok other way. This is true?

    2)Also... If im using it for an interrupt its ok to use gioEnableNotification(gioPORTB,2)??

    3)Is it possible to do a tri-state with this pin? or to configure it as open-drain??

    Thanks!!!
  • Miguel,

    There is a footnote in the datasheet that addresses this:

    If you want to actually drive something onto pin 55 you have to use the other functions like AD2EVT as GIO mode.

    Now remember that the input from the pins goes to all of the functions in the list,  so you can drive IO & tristate the pin if you configure as AD2EVT as GIO but by setting the input pinmux so that GIOB[2] gets its input from pin 55.

  • mmmmm I need that pin to work as an interrupt. The ADS sends a high signal all the time and when the data is ready, it drives the pin to low. BUT I was reading on another post that I needed to make sure the MCU wasnt trying to reach that pin until the setting time, ~70ms in my case. So I thought I could tri state that pin.
    The pin is already configured to work as an input and bring an interrupt when driven low so its perfect for me.

    so... the answer to tri-state the pin as GIOB2 is no i guess. right?
    Let me try something on the board, without the debugger

    Thanks!!
  • Anthony

    I just did a test. If I call the spi function, everything works. But when I try to call it with the interrupt, is not working...

    this is the lines im using:

    _enable_IRQ();

    gioEnableNotification(gioPORTB,2);

    am I missing something? why could the interrupt not be detected?

    Here is the image of the oscillo. The interrupt should be occurring when the pin is driven low...

  • So with the processor halted, please feed it that signal and then look with the debugger at the GIOFLG register.
    Let me know what value is in that register.

    I would expect to see bit 10 set.

    If it is set then please let me know what the other GIO registers related to interrupts read, for example GIOINTDET, GIOPOL, GIOENASET, GIOLVLSET...
  • I already checked the registers

    here is the code: 

    7506.gio.c

    and I put a breakpioint on gioLowLevelInterrupt on the first line and it never reached that point...

    here is the memory browser after I paused the debugger:

    and the interrupt never arrives. But it should be arriving.... the ADS is sending the pulses, on the past image and the MCU was supposed to detect them no? 

  • that pulse lenght is of ~37ns and the MCU is working at 160MHz so... I don't see why wouldnt it detect it...
    Unless we are missing something of GIOB[2] pin 55
  • I found out something. look:

    Here is the configuration used for the ADS

    If you see on GIOB_2IN, we have a test point before the resistor. 

    Here is the test point just before the MCU

    now here is the schematic did by Texas:

    so the resistor is not the problem, since we have the same. 

    Here is the output from TP8 on my schematic:

    which give us the right output. 

    and here is the output on TP6

    For some reason Im getting a drop of voltaje somewhere, but I have no idea where. I know it doesnt come from the board itself. and neither from the resistor. I only know that when the MCU starts working TP6 shows this signal. What can I do?

  • Great job finding this Miguel - I think this explains why the edge is not detected.

    You can make sure that there isn't a problem on your board but at this point i might suspect that the MCU is configured to drive something out the same pin.

    Can you get the ADS setup to generate these pulses, then do a 'System Reset' on the MCU through CCS.
    It needs to be a system reset. That will cause all the IO to pretty much tristate, and then if the level on the ADS signal comes back to full rail to rail that means you have the MCU pinmux or maybe some other IO configuration incorrect.

    If it doesn't fix the level on the pin, then the problem is outside the MCU and you'll need to check the PCB assembly (don't neglect the possibility of a solder bridge or short) and the circuit.

    -Anthony
  • Hi Anthony

    Sorry for answering until now. For some reason the post got lost.

    I already did what u asked for. I paused the debug, reset the system and restart it. the voltage droped the same. This is the image taken before the start of the debug. After starting it, the voltage drops. 

    I dont think the problem is the board because this happends only when I start the MCU so I think it can be a problem with the configuration

    here are my files

    8321.Codigo_Mano_22_agos_2016.rar

  • I even added the muxInit() in case that was doing something... but idk, maybe the pin is being configured as output, which I dont think, or something wuth the pull up

    **update

    I really think is something on the configuration because the other pins dont have that problem... 

  • Hi Anthony

    I have checked the other board I have and happens the same. So... it most be a problem with the configuration...

  • Yes look at pinmux.c,  you've got pin 55 configured as a MibSPI pin.

       pinMuxReg->PINMMR9 = ((~(pinMuxReg->PINMMR9 >> 18U) & 0x00000001U ) << 18U) | PINMUX_PIN_54_HET1_31 | PINMUX_PIN_55_MIBSPI3NCS_0;



    I notice that in the HalCoGen GUI it looks like this:

    When no boxes are checked like they are in 55 row, then the HalCoGen generator will use the default option (first column).

    Now I realize that GIOB_2 is greyed and you cannot select another option without getting a conflict reported for this row.

    I don't know if that's a bug in HalCoGen or something in your DIL file.  I have seen this sort of issue before though when trying to use a DIL file created originally for one variant of a device on another;  because the way that the DIL stores the config information is by 'row' in the pinmux table and that table might have extra rows for say a 1227 versus a 1224.   I don't know if you did that or not.

    Try temporarily changing the line to

        pinMuxReg->PINMMR9 = ((~(pinMuxReg->PINMMR9 >> 18U) & 0x00000001U ) << 18U) | PINMUX_PIN_54_HET1_31 | PINMUX_PIN_55_GIOB_2;

    I looked into this a bit and it seems that the control on that line is disabled by the HalCoGen XML file from selecting GIOB_2 for pin 55 so not sure whether this is a mistake or not but I suspect that configuring as a MibSPI chip select which you have set to output high in HalCoGen (as GIO) is causing a problem.).   Only thing I don't understand is why output high causes the voltage to be low;  unless somewhere else in your code you flipped the state of the MibSPI chip select...

  • It didnt work...
    ammm I dont know why that was like that. The gioB on gray is set when selecting the option on special pin mux. I think there is a problem with the pull up resistor. It seems to be working as an output

    AAAAND a friend of mine told me that that behaviour was the one of an output. And with the info you gave me, I checked the SPI3 and found out it was configured as output. So I changed the configuration and problem solved. Nos I need to check is the interrupt is happening, because it looks like Halcogen was neglecting the pin 55 as giob2
  • Yes i'm going to file a ticket on HalCoGen because it looks like this is an issue in one of the xml files that prevents you from clicking the GIOB_2 option on pin 55.

    But basically - you found another way to configure that pin and now your issue w. drive level is gone, correct?

    EDIT: Ticket is  SDOCM00122780

  • ok ok perfect

    Here is what I know:
    1)You have to select, on special pin muxing the option "Use GIOB_2 for disabling selected HET2 PWM outputs"
    That puts the gray option on pin 55. On the TMR says that the register that contains the pin selection is "GIOB[2] Selection Bit to PINMMR9[18]"
    but its selected. For some reason, the pinmux.c has the MIBSPI3_CS[0], so we changed for this line:
    "pinMuxReg->PINMMR9 = ((~(pinMuxReg->PINMMR9 >> 18U) & 0x00000001U ) << 18U) | PINMUX_PIN_54_HET1_31 | PINMUX_PIN_55_GIOB_2;"
    and didn't work.

    2)Make sure you have SCS[0] of the SPI3 or MIBSPI3 configured as GIO. Change the configuration for it to work as an input with pull up. Then do the same with ADC2, PORT tab.

    3)Generate the codes and modify the line on pinmux.c.

    This way, the pin 55 will work as an interrupt on GIO.

    Thanks a lot Anthony!!
    Now we only have to figure out whats going on with HET code counting backwards haha