發新話題
打印

關於C8051F330的SPI0界面

關於C8051F330的SPI0界面

我使用SiLab的IDE內附的SPI0 example檔做測試

F33x_SPI0_Master.c

在SPI_Byte_Write ();的部分

   while (!NSSMD0);                  
   NSSMD0 = 0;
   Command = SPI_WRITE;
   SPI0DAT = Command;

運行完這個部分
但是DEBUG視窗中的SPI0DAT不會變成Command的值
接下來的動作
實際使用邏輯分析儀做測試

NSS在資料傳輸過程會為LOW 正常
SCK會提供CLOCK 正常
MOSI不會有DATA的資料輸出一直都是HIGH準位

請問這個部分是哪裡有問題??

TOP

// This example is intended to be used with the SPI0_Slave example.
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
//
// Pinout:
//
// P0.0 - SPI SCK    (digital output, push-pull)
// P0.1 - SPI MISO   (digital input, open-drain)
// P0.2 - SPI MOSI   (digital output, push-pull)
// P0.3 - SPI NSS    (digital output, push-pull)
//
// P1.3 - LED        (digital output, push-pull)

你的這份master的example code在程式開始的地方已經說明了, 需要搭配 slave 的example code
一起測試才利行.
如果只有master的code 那應該在 P0.2 - SPI MOSI 可以量到master送出的值,
P0.1 - SPI MISO  沒有接slave device, 那沒有量測到值的變化應該也是正常的.

TOP

發新話題