BRT Community

Please login or register.

Login with username, password and session length
Advanced search  

News:

Welcome to the Bridgetek Community!

Please read our Welcome Note

Technical Support enquires
please contact the team
@ Bridgetek Support

Please refer to our website for detailed information on all our products - Bridgetek - Bridging Technology

Author Topic: FT813 reporting invalid interrupt flags  (Read 2130 times)

tkobet

  • Newbie
  • *
  • Posts: 3
    • View Profile
FT813 reporting invalid interrupt flags
« on: April 28, 2025, 02:45:07 PM »

[Originally posted to FTDI Community; was directed to move post to here]

We have a system using the FT813 display controller with a Newhaven display and capacitive touch screen.  At startup, the firmware configures the FT813 to enable touch tag changed interrupt and the swap complete interrupt, so the flags enabled are 0x05.  The main screen of the application updates every 100 ms.  Logic analyzer traces show the interrupt input from the FT813 to the host microcontroller going active, followed by the host firmware reading the interrupt flags.  Ordinarily this works fine, and the FT813 reports SWAP complete after the screen contents have been delivered to the command coprocessor and the swap command is executed and completed.  (Incidentally, Command FIFO Flag / CMDFLAG is also set.)

Intermittently, though, the interrupt flags returned are 0x4A, which indicate sound effect ended and touch detected, but the application does not use sound, the screen is not being touched, and none of these interrupts were enabled by the host firmware.  The timing of the interrupt is the same as if the screen swap has actually completed, but the swap interrupt flag is not set, so the application is not sure it's safe to write a screen update, and does nothing in response to that interrupt.  At this point in the evolution of this application, it just times out and resumes writing updates to the command coprocessor, and everything proceeds normally for a while, but this condition does pop up from time to time.

In earlier application firmware versions, it was (needlessly) rewriting the screen contents to the command coprocessor as soon as the swap was complete.  With this firmware, these errant interrupt flags were reported intermittently, but much more frequently.

My question is whether this indicates some sort of fault condition not listed in the documentation.  There are scenarios where screen content could actually change every 100 ms, so we would like to keep the capability of using this update frequency.  If the application sees this condition, should it go through the fault recovery procedure?

This does not cause a problem if the main screen is just sitting there updating with no user interaction, but when navigating from the main screen and between any of the other screens, the device can eventually stop responding to touch.  I have found that at least one cause of this is that the FT813 thinks one screen is displayed, while the screen manager in the application thinks it has moved to a different screen.  Touch interrupts are occurring, but the touch tag belongs to the wrong screen from the screen manager's perspective.  I'm wondering if this interrupt flag issue could be a cause for the application to get out of sync with the display controller, and so the application needs to treat the invalid interrupt flags as a fault condition.
Logged

BRT Community

  • Administrator
  • Hero Member
  • *****
  • Posts: 826
    • View Profile
Re: FT813 reporting invalid interrupt flags
« Reply #1 on: April 28, 2025, 03:38:29 PM »

Hello,

Thank you for your question.

Can I ask how you have configured the interrupts?

Would it also be possible to provide a logic analyser capture of a read of the flags register when the issue occurs?

The interrupt flags not returning as expected is curious, but it would not be considered a fault scenario on its own.

Just to clarify you would only need to perform a fault recovery if the REG_CMD_READ register reports a value of 0xFFF (indicating a fault in the co-processor). In terms of EVE and the touch engine, the current valid display list contained within RAM_DL, will be read by the touch engine for tagged items, which will then updated the REG_TOUCH_TAG register if an item has been touched accordingly. In this sense as you have noted your screen manager is out of sync with what it believes to be on the screen, what is the mechanism, that you are using to keep track of screens in your application?

Best Regards,
BRT Community
Logged

Rudolph

  • Sr. Member
  • ****
  • Posts: 485
    • View Profile
Re: FT813 reporting invalid interrupt flags
« Reply #2 on: April 28, 2025, 05:42:50 PM »

Just a thought, what is your SPI clock and have you tried to reduce it while reading?

In my experience, writing to EVE works a whole lot faster reliably than reading does.
And then there is driving the lines thru at least two connections of a FFC, depending on the layout,
the host mcu and the settings for the pins, SPI_CLK might not be looking so good and there might be reflections.

tkobet

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: FT813 reporting invalid interrupt flags
« Reply #3 on: April 29, 2025, 06:27:05 PM »

Interrupts are configured by writing 0x05 to REG_INT_MASK, then writing a 1 to REG_INT_EN.

Logic analyzer traces are attached.  I don't have the greatest logic analyzer, so the clock appears a little inconsistent (clock speed is 12 MHz).  The clock line is the top line with MISO below.  This is the pattern on each occurrence of invalid flags.  There is also a trace of a series of 100 ms updates showing the 300 ms gap when the flags are incorrect.

The screen manager is very basic; there is no screen stack involved.  It includes an active screen variable that gets updated based on user input on each screen.  The touch tag handler within each screen can update the active screen variable as necessary.  The active screen value directs touch tags received to the user input handler for the screen currently displayed.  It may be that I need a more reliable way to determine that a screen update is actually complete.  Accessing the SPI bus to read interrupt flags or touch tags is blocked when the application starts writing out screen commands to the command coprocessor, and is then allowed after the swap interrupt occurs.  The 300 ms timeout is a hack I had included early on, and needs to be removed and replaced with a better-thought out recovery mechanism if something goes wrong.

I can get with the hardware guy to discuss layout and pin configuration to see if there could be any issues with reflection or other hardware-related issue.
Logged

BRT Community

  • Administrator
  • Hero Member
  • *****
  • Posts: 826
    • View Profile
Re: FT813 reporting invalid interrupt flags
« Reply #4 on: April 30, 2025, 10:57:44 AM »

Hello,

Thank you for the update and the details.

I had a quick discussion with the R&D team concerning the operation of the of REG_INT_FLAGS, REG_INT_MASK, and the INT_N pin in general. After viewing the associated microcode I can note that the  REG_INT_FLAGS register is always set by hardware, however, the INT_N pin is only asserted to low when the corresponding bit of REG_INT_MASK is enabled. In this case it may be possible to some values from the REG_INT_FLAGS register that hadn't previously been set in the masking stage.

However, in believe in this case that the 0x4A you are reading from the register should likely be 0x25 (SWAP, TAG, FIFO empty). It is possible that there may be a hardware related issue causing this, one approach would be to test the register reads using a slower SPI clock rate as Rudolph has suggested. But, I would be interested to know in the first instance if the ISR has any bearing on the behaviour you are seeing. Would it be possible to test the ISR where you only perform a read of the REG_INT_FLAGS register on the INT_N pin toggling? and do not service the routine or send any new commands to EVE otherwise. I'm curious to see if the 0x4A register read still occurs in this instance.

Best Regards,
BRT Community
Logged

Rudolph

  • Sr. Member
  • ****
  • Posts: 485
    • View Profile
Re: FT813 reporting invalid interrupt flags
« Reply #5 on: April 30, 2025, 06:25:50 PM »

Please attach logfile from your logic-analyzer, there really is not much to see in these images.
Not that I am expecting to see anything at 12MHz, but there is not really much to analyze with these images.

tkobet

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: FT813 reporting invalid interrupt flags
« Reply #6 on: May 02, 2025, 07:10:06 PM »

The SPI clock is actually 10 MHz, not 12 as previously stated.  That seemed reasonable, and I was considering increasing it since the FT813 can support up to 30 MHz.  However, due to the mechanicals of the system, the ribbon cable connecting the main board to the display looks like it's 16 to 18 inches.  I don't know what this translates to as far as a max SPI clock speed, but maybe 10 MHz is pushing the envelope.

I was going to run a test with a lower clock speed, but identified a separate problem/bug in the application firmware.  The code that initiates the SPI transaction to get touch tag was not checking the return code from the SPI library call that executes the transaction; it just set the flag indicating that a tag had been read and thus no longer available to read.  The application was locking up on a particular screen, and when it stopped responding to touch, the interrupt was firing, the flags indicated a new touch tag was available, but there was no SPI transaction to read the tag, even though that code is executed unconditionally.  This indicated a failure in the SPI library call (this is on an NXP RT1064, by the way).  I moved the line of code that cleared the touch tag available flag to the point where the call had to have succeeded, which will force a retry on failure.  I could not reproduce the lockup scenario after making this change.

What's peculiar about this is that I was also no longer able to reproduce the 300 ms gap when refreshing the main screen, but that has nothing to do with touch tags.  I'm wondering if moving around the cable to check length affected performance somehow.  These issues do appear to be related to the SPI port at the micro.

With regard to the interrupt handler, it does not include any SPI transactions.  The concern was that an interrupt could occur in the middle of sending commands to the coprocessor in preparation for updating the display.  The interrupt handler just sets a flag indicating that an interrupt has occurred, and the application idle loop picks up on that and reads the interrupt flags when the command coprocessor is idle.

I am going to continue to test, and will post logic analyzer logs along with images if I see issues.



« Last Edit: May 02, 2025, 08:41:11 PM by tkobet »
Logged

BRT Community

  • Administrator
  • Hero Member
  • *****
  • Posts: 826
    • View Profile
Re: FT813 reporting invalid interrupt flags
« Reply #7 on: May 05, 2025, 10:37:58 AM »

Hello,

Thank you for the update.

In cases where the SPI connection is long and there is no possibility to shorten it significantly, we would normally suggest adjusting the slew rate and drive strength characteristics of the MCU SPI port to help improve transmission quality. But please do keep us updated with how your testing goes.

Best Regards,
BRT Community
Logged

Rudolph

  • Sr. Member
  • ****
  • Posts: 485
    • View Profile
Re: FT813 reporting invalid interrupt flags
« Reply #8 on: May 05, 2025, 04:37:58 PM »

What worked best for me across several different MCUs and ready-to-use FT81x/BT81x modules are 74LVC2G17 / 74VHC1G12 buffers and 56R series resistors.

The slew rate / drive strength settings are a bit counter intuitive.
ST for example has "Maximum output speed" settings for the STM32 with levels "Low" / "Medium" / "High" and "Very High".
But using "Very High" is not necessarily the correct idea.
Ideally you match the output to your transmission line impedance.

Analog voodoo in digital transmissions. :-)

For very long I had the luxury of getting away with ignoring the issue.
First my controllers were on the slower side and did not have any settings while driving the lines rather strong,
then I had an issue with a controller having too weak outputs at 3.3V, so I added external buffers as drivers.

Next I learned that my library was not playing well with the Teensy 4 which uses a RT1062, the usuable SPI clock was surprisingly low.
As the Teensy 4 is typically used with Arduino, the settings are made by the classes.
And when I figured out how to change the settings in order to configure for a higher speed, I learned that by default the pins
already were configured for the highest setting.
Using a lower setting worked better - or raising the series resistance.