简体   繁体   English

FT232H写命令之间的延迟

[英]FT232H Latency between write commands

I want to use an FT232H IC in SPI mode to drive a display. 我想在SPI模式下使用FT232H IC来驱动显示器。 I have set the clock frequency to 5 MHz. 我已将时钟频率设置为5 MHz。 In testing my code, I noticed that even in a tight loop, commands are executed about 120 microseconds apart. 在测试我的代码时,我注意到即使在紧密循环中,命令也会执行大约120微秒。 In the code below, I issue a command to write 4 bytes. 在下面的代码中,我发出一个写4个字节的命令。 I time the action with a stopwatch in VB and also watch the signals on a scope. 我用VB中的秒表计时并观察示波器上的信号。 The code takes about 200 microseconds to execute once and about 320 microseconds to execute twice in a row, 450 microseconds for 3 times, and so forth. 代码执行一次需要大约200微秒,连续执行两次大约需要320微秒,3次需要450微秒,依此类推。 The actual sending of the bytes takes only about 7 microseconds each time. 每次实际发送的字节只需要大约7微秒。 Nothing happens for the rest of the time, ie 120 microseconds appears to be wasted with each transmission. 在其余时间没有任何事情发生,即每次传输似乎浪费了120微秒。 Questions: Is this inactive time just recovery of the routines in the FT232H? 问题:这个非活动时间只是恢复FT232H中的例程吗? Am I missing something here? 我在这里错过了什么吗? Is there a better command to use? 有更好的命令可以使用吗? I want to use SPI to clock data into an ILI9341 display driver chip as fast as possible. 我想使用SPI尽快将数据输入ILI9341显示驱动芯片。 I know others have done it. 我知道其他人已经做到了。 Suggestions would be welcome! 欢迎提出建议!

 'Start
    'Data transmit, no receive
    SendBuffer(0) = &H10    'Output on rising clock, no input, MSB first, clock a number of bytes out
    SendBuffer(1) = &H3     'Length L
    SendBuffer(2) = &H0     'Length H
    SendBuffer(3) = &HA
    SendBuffer(4) = &HAA
    SendBuffer(5) = &HA
    SendBuffer(6) = &HAA

    'About 1-3 microseconds to this point

    FT_Status = FT_Write_Bytes(FT_Handle, SendBuffer(0), 7, BytesWritten)   ' Write buffer to the device

    '201 microseconds to this point

    'Data transmit, no receive
    SendBuffer(0) = &H10    'Output on rising clock, no input, MSB first, clock a number of bytes out
    SendBuffer(1) = &H3     'Length L
    SendBuffer(2) = &H0     'Length H
    SendBuffer(3) = &HA
    SendBuffer(4) = &HAA
    SendBuffer(5) = &HA
    SendBuffer(6) = &HAA
    FT_Status = FT_Write_Bytes(FT_Handle, SendBuffer(0), 7, BytesWritten)   ' Write buffer to the device

    '321 microseconds to here

    'Data transmit, no receive
    SendBuffer(0) = &H10    'Output on rising clock, no input, MSB first, clock a number of bytes out
    SendBuffer(1) = &H3     'Length L
    SendBuffer(2) = &H0     'Length H
    SendBuffer(3) = &HA
    SendBuffer(4) = &HAA
    SendBuffer(5) = &HA
    SendBuffer(6) = &HAA
    FT_Status = FT_Write_Bytes(FT_Handle, SendBuffer(0), 7, BytesWritten)   ' Write buffer to the device

    '450 microseconds to here

do not have experience with your chip ( FT232H ) but here some possibilities in general: 没有你的芯片( FT232H )的经验,但这里有一些可能性:

  1. some ICs have separate clock for internal communication 一些IC具有用于内部通信的独立时钟

    if set too low then you are waiting until the command is send to the SPI module and not on the SPI transfer itself. 如果设置得太低,那么你要等到命令发送到SPI模块而不是SPI传输本身。

  2. Interrupts timing 中断时间

    If you are using interrupts then either your ISR is called with delay (also interrupt module has it s own clock sometimes) or you are blocked by other process like timer/counters in background or USB/DMA transfer or configuration or by another ISR . 如果你正在使用中断,那么你的ISR会被延迟调用(有时候中断模块也有自己的时钟),或者你被后台或USB / DMA传输或配置中的定时器/计数器或其他ISR等其他进程阻止。

  3. Debug interface 调试界面

    If you are using debugging interface (like JTAG ) you could be stopped by it. 如果您正在使用调试接口(如JTAG ),您可能会被它停止。 In such case try raw application without such interface and measure by oscilloscope just to rule out this. 在这种情况下尝试没有这样的接口的原始应用程序,并通过示波器测量只是为了排除这一点。

  4. Power management 能源管理

    To save power some chips have powered down unused modules and before using they have to be started which takes some time. 为了节省电力,一些芯片已经关闭了未使用的模块,在使用之前必须启动它们需要一些时间。 This can be the case even if you are changing configuration of the module. 即使您正在更改模块的配置,也可能出现这种情况。

  5. Bug in the chip 芯片中的错误

    Well with nowadays forced/rushed new chips to market by management there are higher possibilities to leave bugs in the chips (much higher then in the past). 现在,管理层迫使/推出新芯片,有更高的可能性来消除芯片中的漏洞(比过去高得多)。 So do not rule this out .. I stumbled on this few times already. 所以不要排除这种情况。我已经偶然发现了这几次。 Usually try to contact chip producer and or check its datasheet for updates/errata and known bug lists. 通常尝试联系芯片生产商,或检查其数据表以获取更新/勘误表和已知错误列表。

I learned from the chip factory that the delay is related to USB bulk transfer considerations. 我从芯片工厂了解到,延迟与USB批量传输考虑因素有关。 I'll work with the timing by buffering as much data as possible with each transfer. 我会通过每次传输缓冲尽可能多的数据来处理时间。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM