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.
I am trying to configure the USCI B to use SPI so that I can talk with an RFID reader. Here is the code that I have so far; it is a modified version of the example code provided by TI. When I try to use a logic analyzer to see the data being sent out I can't see anyting. Clock is P4.0, MOSI is P4.4, and MISO is P4.5.
unsigned char MST_Data,SLV_Data; volatile unsigned int i;
WDTCTL = WDTPW+WDTHOLD; // Stop watchdog timer
P4SEL |= BIT0+BIT4+BIT5; // P4.0,4,&5 for CLK, MOSI, MISO, respectively PMAPPWD = 0x02D52; P4MAP0 = PM_UCA1CLK; P4MAP4 = PM_UCA1SIMO; P4MAP5 = PM_UCA1SOMI; PMAPPWD = 0; UCA0CTL1 |= UCSWRST; // Software Reset (USCI_A) UCA0CTL0 |= UCMST+UCSYNC+UCCKPL+UCMSB; // 3-pin, 8-bit SPI master // Clock polarity high, MSB UCA0CTL1 |= UCSSEL_2; // SMCLK UCA0BR0 = 0x02; // /2 UCA0BR1 = 0; // UCA0MCTL = 0; // No modulation UCA0CTL1 &= ~UCSWRST; // **Initialize USCI state machine** UCA0IE |= UCRXIE; // Enable USCI_A0 RX interrupt
for(i=50;i>0;i--); // Wait for slave to initialize
MST_Data = 0x01; // Initialize data values SLV_Data = 0x00; //
while (!(UCA0IFG&UCTXIFG)); // USCI_A0 TX buffer ready? UCA0TXBUF = MST_Data; // Transmit first character
Any help would be appreciated
Looks like you are port-mapping for UCA1, but you are configuring UCA0.
Other than that, it looks good to me!
We are glad that we were able to resolve this issue, and will now proceed to close this thread.
If you have further questions related to this thread, you may click "Ask a related question" below. The newly created question will be automatically linked to this question.
In reply to Jeff Tenney:
Wow. dumb mistake. Thanks for catching that. Works fine now!
All content and materials on this site are provided "as is". TI and its respective suppliers and providers of content make no representations about the suitability of these materials for any purpose and disclaim all warranties and conditions with regard to these materials, including but not limited to all implied warranties and conditions of merchantability, fitness for a particular purpose, title and non-infringement of any third party intellectual property right. No license, either express or implied, by estoppel or otherwise, is granted by TI. Use of the information on this site may require a license from a third party, or a license from TI.
TI is a global semiconductor design and manufacturing company. Innovate with 100,000+ analog ICs andembedded processors, along with software, tools and the industry’s largest sales/support staff.