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.
工具与软件:
您好、TI 团队、
我希望以最大速度传输 SPI 数据。 在数据表中、它给出了如下所示的60MHz 最大值、
在我的代码中,我只能给出30MHz 最大值。 提供的电流大于该电流。 不管用。 我已提及以下代码、
空配置 SPI (uint32_t 时钟)
{
//
//必须启用 SSI0外设。
//
SysCtlPeripheralEnable (SYSCTL_Periph_SSI0);
SysCtlPeripheralEnable (SYSCTL_Periph_GPIOA);
//
//在 PA 上配置用于 SSI0功能的引脚复用。
//
GPIOPinConfigure (GPIO_PA2_SSI0CLK);// PA2 - SSI0CLK
GPIOPinConfigure (GPIO_PA3_SSI0FSS);// PA3 - SSI0Fss
GPIOPinConfigure (GPIO_PA4_SSI0XDAT0);// PA4 - SSI0TX
GPIOPinConfigure (GPIO_PA5_SSI0XDAT1);// PA5 - SSI0RX
GPIOPinTypeSSI (GPIO_Porta_base、GPIO_PIN_5 | GPIO_PIN_4 | GPIO_PIN_2);
SSIConfigSetExpClk (SSI0_BASE、Clock、SSI_FRF_MOTO_MODE_0、SSI_MODE_MASTER、30000000、16);
// SSIConfigSetExpClk (SSI0_BASE、时钟、SSI_FRF_MOTO_MODE_0、SSI_MODE_MASTER、27000000、8);
// SSIIntEnable (uint32_t ui32Base、uint32_t ui32IntFlags)
//
//启用 SSI0模块。
//
SSIEnable (SSI0_BASE);
}
谢谢。此致、
A. Ajith Kumar
您好!
在我的代码中,我只能给出30MHz 的最大值。 提供的电流大于该电流。 它不起作用
您能否说明在将其设置为60MHz 时哪些不起作用? 您在示波器上测量的实际频率是多少? 在这个频率下、我假设您到从器件的距离更短。
在下面调用以配置 SSI 时钟时、"时钟"是什么? 它需要为120MHz 才能实现最高60MHz SSI 时钟。
SSIConfigSetExpClk (SSI0_BASE、Clock、SSI_FRF_MOTO_MODE_0、SSI_MODE_MASTER、30000000、16);
我想您必须将时钟设置为如下内容。 是这样吗? 时钟返回什么? 是不是12万?
CLOCK = MAP_SysCtlClockFreqSet ((SYSCTL_XTAL_25MHz |
SYSCTL_OSC_MAIN |
SYSCTL_USE_PLL |
SYSCTL_CFG_VCO_240)、120000000);
尊敬的 Charles Tsai:
感谢您的答复、
我已经将时钟设置为仅120MHz、并尝试将 SPI 时钟设置为60MHz。 SPI 时钟引脚的输出端未绘制时钟。
G_ui32SysClock = MAP_SysCtlClockFreqSet ((SYSCTL_XTAL_25MHz | SYSCTL_OSC_MAIN | SYSCTL_USE_PLL | SYSCTL_CFG_VCO_240)、120000000);
我们只能在 SPI 时钟下实现30MHz。 更重要的是设置意味着没有从 SPI 时钟引脚接收到时钟。
谢谢。此致、
R·巴拉甘尼什
您好!
SSIConfigSetExpClk (SSI0_BASE、Clock、SSI_FRF_MOTO_MODE_0、SSI_MODE_MASTER、30000000、16);
在您最初的发布中,您将时钟变量作为源时钟传递给 SSIConfigSetExpClk()。
我已经将时钟设置为仅120MHz、并尝试将 SPI 时钟设置为60MHz。 SPI 时钟引脚的输出端未绘制时钟。
G_ui32SysClock = MAP_SysCtlClockFreqSet ((SYSCTL_XTAL_25MHz | SYSCTL_OSC_MAIN | SYSCTL_USE_PLL | SYSCTL_CFG_VCO_240)、120000000);
[/报价]在上一次回复中、我们设置了上述系统时钟、将系统时钟频率返回 g_ui32SysClock 变量。 我只是想确保把'Clock '或'g_ui32SysClock '传递给 SSIConfigSetExpClk ()。
当您读取时钟变量中存储的值是多少?
读取时存储在 g_ui32SysClock 中的值是什么?
我们只能在 SPI 时钟下实现30MHz。 如果设置的值超过此值、则表示没有从 SPI 时钟引脚接收到时钟。当同时为30Mhz 和60MHz 进行配置时、您能展示 SPICLK 的示波器捕获吗?
另请告诉我、您是在您自己的定制电路板上运行还是在 LaunchPad 上运行? 如果您正在使用自己的电路板、是否有25MHz 晶体?
可以在 LaunchPad 上运行同样的代码吗、看到了什么?
[/quote]
尊敬的 Charles Tsai:
g_ui32SysClock 变量 和 clock 都是相同的、它们都是120MHz。 g_ui32SysClock 是变量、而 clock 是函数的属性。
ConfigureSPI(g_ui32SysClock );
我已经将时钟设置为仅120MHz、并尝试将 SPI 时钟设置为60MHz。 SPI 时钟引脚的输出端未绘制时钟。
G_ui32SysClock = MAP_SysCtlClockFreqSet ((SYSCTL_XTAL_25MHz | SYSCTL_OSC_MAIN | SYSCTL_USE_PLL | SYSCTL_CFG_VCO_240)、120000000);
我们只能在 SPI 时钟下实现30MHz。 更重要的是设置意味着没有从 SPI 时钟引脚接收到时钟。
谢谢。此致、
A. Ajith Kumar
我无法在 LaunchPad 上重现您的问题。 请参见下面我针对 SPICLK 上60MHz 的截屏。
下面是我使用的简单代码。
#include <stdbool.h> #include <stdint.h> #include "inc/hw_memmap.h" #include "driverlib/gpio.h" #include "driverlib/pin_map.h" #include "driverlib/ssi.h" #include "driverlib/sysctl.h" #include "driverlib/uart.h" #include "driverlib/rom_map.h" #include "driverlib/rom.h" #include "utils/uartstdio.h" //***************************************************************************** // //! \addtogroup ssi_examples_list //! <h1>SPI Master (spi_master)</h1> //! //! This example shows how to configure the SSI0 as SPI Master. The code will //! send three characters on the master Tx then polls the receive FIFO until //! 3 characters are received on the master Rx. //! //! This example uses the following peripherals and I/O signals. You must //! review these and change as needed for your own board: //! - SSI0 peripheral //! - GPIO Port A peripheral (for SSI0 pins) //! - SSI0Clk - PA2 //! - SSI0Fss - PA3 //! - SSI0Rx - PA4 //! - SSI0Tx - PA5 //! //! The following UART signals are configured only for displaying console //! messages for this example. These are not required for operation of SSI0. //! - UART0 peripheral //! - GPIO Port A peripheral (for UART0 pins) //! - UART0RX - PA0 //! - UART0TX - PA1 //! //! This example uses the following interrupt handlers. To use this example //! in your own application you must add these interrupt handlers to your //! vector table. //! - None. // //***************************************************************************** //***************************************************************************** // // Number of bytes to send and receive. // //***************************************************************************** #define NUM_SSI_DATA 3 uint32_t ui32SysClock; //***************************************************************************** // // Configure SSI0 in master Freescale (SPI) mode. This example will send out // 3 bytes of data, then wait for 3 bytes of data to come in. This will all be // done using the polling method. // //***************************************************************************** int main(void) { #if defined(TARGET_IS_TM4C129_RA0) || \ defined(TARGET_IS_TM4C129_RA1) || \ defined(TARGET_IS_TM4C129_RA2) #endif uint32_t pui32DataTx[NUM_SSI_DATA]; uint32_t pui32DataRx[NUM_SSI_DATA]; uint32_t ui32Index; // // Set the clocking to run directly from the external crystal/oscillator. // TODO: The SYSCTL_XTAL_ value must be changed to match the value of the // crystal on your board. // ui32SysClock = MAP_SysCtlClockFreqSet((SYSCTL_XTAL_25MHZ | SYSCTL_OSC_MAIN | SYSCTL_USE_PLL | SYSCTL_CFG_VCO_240), 120000000); // // The SSI0 peripheral must be enabled for use. // ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_SSI0); // // For this example SSI0 is used with PortA[5:2]. The actual port and pins // used may be different on your part, consult the data sheet for more // information. GPIO port A needs to be enabled so these pins can be used. // TODO: change this to whichever GPIO port you are using. // SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA); // // Configure the pin muxing for SSI0 functions on port A2, A3, A4, and A5. // This step is not necessary if your part does not support pin muxing. // TODO: change this to select the port/pin you are using. // GPIOPinConfigure(GPIO_PA2_SSI0CLK); GPIOPinConfigure(GPIO_PA3_SSI0FSS); GPIOPinConfigure(GPIO_PA4_SSI0XDAT0); GPIOPinConfigure(GPIO_PA5_SSI0XDAT1); // // Configure the GPIO settings for the SSI pins. This function also gives // control of these pins to the SSI hardware. Consult the data sheet to // see which functions are allocated per pin. // The pins are assigned as follows: // PA5 - SSI0Tx // PA4 - SSI0Rx // PA3 - SSI0Fss // PA2 - SSI0CLK // TODO: change this to select the port/pin you are using. // GPIOPinTypeSSI(GPIO_PORTA_BASE, GPIO_PIN_5 | GPIO_PIN_4 | GPIO_PIN_3 | GPIO_PIN_2); // // Configure and enable the SSI port for SPI master mode. Use SSI0, // system clock supply, idle clock level low and active low clock in // freescale SPI mode, master mode, 1MHz SSI frequency, and 8-bit data. // For SPI mode, you can set the polarity of the SSI clock when the SSI // unit is idle. You can also configure what clock edge you want to // capture data on. Please reference the datasheet for more information on // the different SPI modes. // SSIConfigSetExpClk(SSI0_BASE, ui32SysClock, SSI_FRF_MOTO_MODE_0, SSI_MODE_MASTER, 60000000, 16); // // Enable the SSI0 module. // SSIEnable(SSI0_BASE); // // Read any residual data from the SSI port. This makes sure the receive // FIFOs are empty, so we don't read any unwanted junk. This is done here // because the SPI SSI mode is full-duplex, which allows you to send and // receive at the same time. The SSIDataGetNonBlocking function returns // "true" when data was returned, and "false" when no data was returned. // The "non-blocking" function checks if there is any data in the receive // FIFO and does not "hang" if there isn't. // while(SSIDataGetNonBlocking(SSI0_BASE, &pui32DataRx[0])) { } // // Initialize the data to send. // pui32DataTx[0] = 's'; pui32DataTx[1] = 'p'; pui32DataTx[2] = 'i'; // // Display indication that the SSI is transmitting data. // // // Send 3 bytes of data. // //for(ui32Index = 0; ui32Index < NUM_SSI_DATA; ui32Index++) ui32Index=0; while (1) { // // Display the data that SSI is transferring. // // // Send the data using the "blocking" put function. This function // will wait until there is room in the send FIFO before returning. // This allows you to assure that all the data you send makes it into // the send FIFO. // SSIDataPut(SSI0_BASE, pui32DataTx[ui32Index]); } // // Return no errors // return(0); }
您从未回答过以下三个问题。
当同时为30Mhz 和60MHz 进行配置时、您能展示 SPICLK 的示波器捕获吗?
另请告诉我、您是在您自己的定制电路板上运行还是在 LaunchPad 上运行? 如果您正在使用自己的电路板、是否有25MHz 晶体?
可以在 LaunchPad 上运行同样的代码吗、看到了什么?