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.

TM4C123GH6PGE: SSI/SPI於工作期間CLK及IO輸出波形問題

Part Number: TM4C123GH6PGE

請問各位,

目前採用此M4進行SPI的使用,在使用下採用示波器進行頻率及TX的量測,發現波形無法為"正方波"

導致數據解析會異常,設置如下:

主頻:80Mhz

spi : 20Mhz

在自己設計得板子上與TivaTm TM4C123G 开发板測試下波形都相同 (電路spi腳位部分皆無負載下量測)

波形數據基本上與程式發送匹配,頻率量測也為20Mhz

只是頻率無法正方波

當此20Mhz逐漸下降,波形才會逐漸越正方

故.想請問大家,此ic是否有輸出頻率上限?? 或是是否需要搭配外部電路進行??

以上 謝謝

  • 您好我们已收到您的问题并升级到英文论坛,如有答复将尽快回复您。谢谢!

  • SPI 时钟的最大规格为 25MHz。 20Mhz 没啥问题,您的波形也正常。

    同时请您确保主器件和从器件配置为完全相同的 SPICLK 相位和极性,为从机提供半周期的设置时间以进行数据采样。 SSI 引脚的默认驱动强度为 2mA, 请参阅以下内容。 建议您设置更高的驱动强度,修改到比如4mA,然后看下有没有什么改善。以及请您手动配置端口,不要使用 TivaWare Library。

    //*****************************************************************************
    //
    //! Configures pin(s) for use by the SSI peripheral.
    //!
    //! \param ui32Port is the base address of the GPIO port.
    //! \param ui8Pins is the bit-packed representation of the pin(s).
    //!
    //! The SSI pins must be properly configured for the SSI peripheral to function
    //! correctly. This function provides a typical configuration for those
    //! pin(s); other configurations may work as well depending upon the board
    //! setup (for example, using the on-chip pull-ups).
    //!
    //! The pin(s) are specified using a bit-packed byte, where each bit that is
    //! set identifies the pin to be accessed, and where bit 0 of the byte
    //! represents GPIO port pin 0, bit 1 represents GPIO port pin 1, and so on.
    //!
    //! \note This function cannot be used to turn any pin into a SSI pin; it only
    //! configures a SSI pin for proper operation. Note that a GPIOPinConfigure()
    //! function call is also required to properly configure a pin for the SSI
    //! function.
    //!
    //! \note A subset of GPIO pins on Tiva devices, notably those used by the
    //! JTAG/SWD interface and any pin capable of acting as an NMI input, are
    //! locked against inadvertent reconfiguration. These pins must be unlocked
    //! using direct register writes to the relevant GPIO_O_LOCK and GPIO_O_CR
    //! registers before this function can be called. Please see the ``gpio_jtag''
    //! example application for the mechanism required and consult your part
    //! datasheet for information on affected pins.
    //!
    //! \return None.
    //
    //*****************************************************************************

    void
    GPIOPinTypeSSI(uint32_t ui32Port, uint8_t ui8Pins)
    {
    //
    // Check the arguments.
    //
    ASSERT(_GPIOBaseValid(ui32Port));

    //
    // Make the pin(s) be peripheral controlled.
    //
    GPIODirModeSet(ui32Port, ui8Pins, GPIO_DIR_MODE_HW);

    //
    // Set the pad(s) for standard push-pull operation.
    //
    GPIOPadConfigSet(ui32Port, ui8Pins, GPIO_STRENGTH_2MA, GPIO_PIN_TYPE_STD);

  • 您好,非常謝謝您的建議

    依據您的建議,我已經將驅動強度配置為4mA,並觀察波形,雖不到正方波,但確實有改善

    另一個問題是

    我在程式中進行4個8bit的輪巡發送,發現在20Mhz的情況下,會如發文中的波形,中間會斷開

    但,只要降低頻率,如:10Mhz,在相同程式下,4個8bit的波形會是連續的,故想在請教,是否有方式能改善再20Mhz的情況下的連續性 (此部分因擔心器件可能會因中斷而異常截取或無視)

    程式如下,在一個100ms的定時器內,進行spi的4個8bit數據發送->-delay半週期>檢測是否忙碌->進行數據獲取,以此loop

    以下為10Mhz下的連續波形,可以看出 每一個byte中間並不會中斷

  • 您好,详细信息请您参阅数据表。 如您所说当连续传输时,两次传输之间将有一些空闲。 请参阅数据表中的下图:

    同时请参考以下信息:(英文描述对您来说ok吗?这是数据表中的信息,如果您理解有难度的话请告知我)

    In the case of a single word transmission, after all bits of the data word have been transferred, the
    SSInFss line is returned to its idle High state one SSInClk period after the last bit has been
    captured.
    However, in the case of continuous back-to-back transmissions, the SSInFss signal must be pulsed
    High between each data word transfer because the slave select pin freezes the data in its serial
    peripheral register and does not allow it to be altered if the SPH bit is clear. Therefore, the master
    device must raise the SSInFss pin of the slave device between each data transfer to enable the
    serial peripheral data write. On completion of the continuous transfer, the SSInFss pin is returned
    to its idle state one SSInClk period after the last bit has been captured.

  • 您好,非常謝謝您,我能理解

    再請教,因SSIDataGet 使用時不產生CLK 故建議使用時機是?

    我發現有幾種方式可以進行傳送與讀取

    1. 一次傳送完,一次讀取完

     上為FSS,下為LCK

    2.邊傳邊收

     上為FSS,下為LCK

    3.不使用SSIDataGet , 使用SSIDataGetNonBlocking,讓他依照FIFO進行接收

     上為FSS,下為LCK

    以上3種都能正確工作,僅是差在順序不同,也會造成波形不同,經過計算,只是將SSIDataGet 執行時間點的不同

    因此想請教,正確的方式較建議使用何種?

  • 您好,三种方法都可以,SPI有FIFO。如果您用第一种方法,可以在传输的同时存储多个数据,这样更高效。