TI中文支持网
TI专业的中文技术问题搜集分享网站

無法讀取ADS1299 ID

我利用MSP432P401R(MASTER)初始化ADS1299並嘗試讀取ID,但讀出來都是0x00,並且我再CODE裡面只有輸入5個byte的資料,卻跑出7個byte,我不知道發生什麼事

此圖為整體邏輯分析儀訊號圖,CH0為MOSI,CH1為MISO,CH2為CLOCK,CH3為DRDY,CS我讓他恆保持低態

以下3張圖為第一張圖的放大圖,從第一個byte依序往下

/* DriverLib Includes */
#include <ti/devices/msp432p4xx/driverlib/driverlib.h>

/* Standard Includes */
#include <stdint.h>
#include <stdbool.h>
#define HZ  3000000UL
/* Statics */
static volatile uint8_t RXData = 0;
static uint8_t TXData = 0;
uint8_t A = 0;

int main(void)
{WDT_A->CTL = WDT_A_CTL_PW |// Stop watchdog timerWDT_A_CTL_HOLD;P1->SEL0 |= BIT5 | BIT6 | BIT7;// Set P1.5, P1.6, and P1.7 as// SPI pins functionalityEUSCI_B0->CTLW0 |= EUSCI_B_CTLW0_SWRST; // Put eUSCI state machine in resetEUSCI_B0->CTLW0 = EUSCI_B_CTLW0_SWRST | // Remain eUSCI state machine in resetEUSCI_B_CTLW0_MST |// Set as SPI masterEUSCI_B_CTLW0_SYNC |// Set as synchronous mode//EUSCI_B_CTLW0_CKPL |// Set clock polarity lowEUSCI_B_CTLW0_CKPH |//Phase highEUSCI_B_CTLW0_MSB;// MSB firstEUSCI_B0->CTLW0 |= EUSCI_B_CTLW0_SSEL__ACLK; // ACLKEUSCI_B0->BRW = 0x01;// /2,fBitClock = fBRCLK/(UCBRx+1).EUSCI_B0->CTLW0 &= ~EUSCI_B_CTLW0_SWRST;// Initialize USCI state machine//EUSCI_B0->IE |= EUSCI_B_IE_RXIE;// Enable USCI_B0 RX interrupt
 /////////////////////////////////////////////////SPI INTERRUPT/////////////////////////////////////////////////////////////////////////////////__enable_irq();// Enable eUSCI_B0 interrupt in NVIC moduleNVIC->ISER[0] = 1 << ((EUSCIB0_IRQn) & 31);// Wake up on exit from ISRSCB->SCR &= ~SCB_SCR_SLEEPONEXIT_Msk;// Ensures SLEEPONEXIT takes effect immediately__DSB();P1->OUT &= ~BIT0;P1->DIR |= BIT0;// Set P1.0 LEDP1->SEL0 |= BIT5 | BIT6 | BIT7;// Set P1.5, P1.6, and P1.7 as// SPI pins functionality
 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////*TXData = 0x01;// Initialize TX data to 0x01while(1){TXData++;spiTx(TXData);spiRx ();}*///CS_Low();P3->DIR |= BIT0;P3->OUT ^= BIT0; //CS_Low__delay_cycles(HZ);P3->DIR |= BIT5;P3->OUT =  BIT5;//CLKSEL High__delay_cycles(HZ/1000);P5->DIR |= BIT1;P5->OUT =  BIT1;//PWDN High__delay_cycles(HZ);P2->DIR |= BIT7;P2->OUT = BIT7;//RESET High__delay_cycles(HZ);P2->DIR |= BIT7;P2->OUT ^= BIT7;//RESET LOW__delay_cycles(HZ);P2->DIR |= BIT7;P2->OUT = BIT7;//RESET High__delay_cycles(HZ);TXData = 0x11;//SDATACEUSCI_B0->IFG |= EUSCI_B_IFG_TXIFG;// Clear TXIFG flagEUSCI_B0->IE |= EUSCI_B_IE_TXIE;// Enable TX interruptTXData = 0x12;//RDATAEUSCI_B0->IFG |= EUSCI_B_IFG_TXIFG;// Clear TXIFG flagEUSCI_B0->IE |= EUSCI_B_IE_TXIE;// Enable TX interruptP2->DIR |= BIT6;P2->OUT |= BIT6;//Set Start HighA = spi_bmp183_read8(0x20);}


uint8_t spi_bmp183_read8(uint8_t reg) {// Make sure transmit buffer is clearwhile (!(SPI_getInterruptStatus(EUSCI_B0_BASE,EUSCI_B_SPI_TRANSMIT_INTERRUPT)));SPI_transmitData(EUSCI_B0_BASE, reg);// Transmit register address__delay_cycles(HZ/1000);// Send clock pulses.  This will push slave to send data to master on MISO line.SPI_transmitData(EUSCI_B0_BASE, 0x00);__delay_cycles(HZ/1000);SPI_transmitData(EUSCI_B0_BASE, 0x00);__delay_cycles(HZ/1000);
// Make sure transmit buffer is clearwhile (!(SPI_getInterruptStatus(EUSCI_B0_BASE,EUSCI_B_SPI_RECEIVE_INTERRUPT)));RXData = SPI_receiveData(EUSCI_B0_BASE);// Pick up received byte in SPI receive data registerreturn RXData;
}
void EUSCIB0_IRQHandler(void)
{if (EUSCI_B0->IFG & EUSCI_B_IFG_TXIFG){EUSCI_B0->TXBUF = TXData;// Transmit characters__delay_cycles(HZ/1000);//EUSCI_B0->TXBUF = 0x20;// Transmit characters//__delay_cycles(HZ/100000);//EUSCI_B0->TXBUF = 0x00;// Transmit characters//__delay_cycles(HZ/100000);EUSCI_B0->IE &= ~EUSCI_B__TXIE;}

}

user151383853:

好象是两个问题,看芯片波形没有 READY 的脉冲,mosi 也不见任何波形,是不是先验证芯片有没有正常工作了?可以先查查供电连接的问题,而5byte变成了 7 个byte ,那是你的软件问题了

Kailyn Chen:

DRDY 一直为高,芯片并未正常工作,像是一直处于复位状态。上电时reset和Power down引脚都由低高的变化过程吧?检查下是否都为高电平了。
另外,Start拉高时,DRDY也应由低到高的变化。
ADS1299 demo有提供和C5509 一起使用的Source code,可以参考下:
www.ti.com/…/ADS1299EEGFE-PDK

user5121970:

回复 Kailyn Chen:

這張圖是整體從上電燒入程式碼到結束的SPI圖,而上文內的圖為這張圖的放大

赞(0)
未经允许不得转载:TI中文支持网 » 無法讀取ADS1299 ID
分享到: 更多 (0)