Hi all,
I am trying to migrate the Code from the SLAA281B Application Report in my current project with the MSP430f5528.
But he config of the SPI connection doesn`t work. I connectet an oszi but there are no edges....
Thank you for your help!
//----------------------------hal_MMC_hardware_board.h------------------------------------------------------- #include "msp430f5528.h" // Adjust this according to the // MSP430 device being used. // SPI port definitions // Adjust the values for the chosen #define SPI_PxSEL P4SEL // interfaces, according to the pin #define SPI_PxDIR P4DIR // assignments indicated in the #define SPI_PxIN P4IN // chosen MSP430 device datasheet. #define SPI_PxOUT P4OUT #define SPI_SIMO 0x04 #define SPI_SOMI 0x05 #define SPI_UCLK 0x00 //---------------------------------------------------------------------------- // SPI/UART port selections. Select which port will be used for the interface //---------------------------------------------------------------------------- // SPI port definitions // Adjust the values for the chosen #define MMC_PxSEL SPI_PxSEL // interfaces, according to the pin #define MMC_PxDIR SPI_PxDIR // assignments indicated in the #define MMC_PxIN SPI_PxIN // chosen MSP430 device datasheet. #define MMC_PxOUT SPI_PxOUT #define MMC_SIMO SPI_SIMO #define MMC_SOMI SPI_SOMI #define MMC_UCLK SPI_UCLK // Chip Select CS 4.3 #define MMC_CS_PxOUT P4OUT #define MMC_CS_PxDIR P4DIR #define MMC_CS 0x03 // Card Detect CD 2.7 #define MMC_CD_PxIN P2IN #define MMC_CD_PxDIR P2DIR #define MMC_CD 0x07 #define CS_HIGH() while(halSPITXDONE); MMC_CS_PxOUT |= MMC_CS // Card Deselect #define CS_LOW() (P4OUT &= ~BIT3) //modified #define DUMMY_CHAR 0xFF //---------------------------------hal_SPI.h-------------------------------------------------- #define halSPIRXBUF UCA1RXBUF #define halSPI_SEND(x) UCA1TXBUF = x #define halSPITXREADY (UCA1IFG & UCTXIFG) /* Wait for TX to be ready */ #define halSPITXDONE (UCA1STAT & UCBUSY) /* Wait for TX to finish */ #define halSPIRXREADY (UCA1IFG & UCRXIFG) /* Wait for TX to be ready */ #define halSPIRXFG_CLR UCAxIFG &= ~UCRXIFG #define halSPI_PxIN SPI_USART0_PxIN #define halSPI_SOMI SPI_USART0_SOMI //---------------------------------hal_SPI.c-------------------------------------------------- // SPI port functions void halSPISetup(void) { UCA1CTL0 = UCMST+UCCKPL+UCMSB+UCSYNC+UCMST; // 3-pin, 8-bit SPI master UCA1CTL1 = UCSSEL_2 + UCSWRST; // SMCLK UCA1BR0 |= 0x02; // UCLK/2 UCA1BR1 = 0; UCA1MCTL = 0; UCA1CTL1 &= ~UCSWRST; // **Initialize USCI state machine** }