Tool/software: Code Composer Studio
Goodmorning everybody!
Today I'm writing on the forum because I have some troubles with the settings of SPI communication, but I don't understand why it isn't working.
CONFIGURAZIONE_SPI is my .asm function to configure the SPI registers.
CONFIGURAZIONE_SPI: mov.b #0x19, P3OUT mov.b #0x1F, P3DIR mov.b #0x31, P3SEL bis.b #UCSWRST, &UCA0CTL1 mov.b #(UCCKPL+UCMSB+UCMST+UCSYNC+UCMODE_0), &UCA0CTL0 mov.b #UCSSEL_2, &UCA0CTL1 mov.b #32, &UCA0BR0 mov.b #0, &UCA0BR1 mov.b #0, &UCA0MCTL bic.b #UCSWRST, &UCA0CTL1
(P3.0 is SCLK, P3.1 and P3.2 are unused, P3.3 is CS, P3.4 is SIMO, P3.5 is SOMI, P3.6 is DRDY, necessary for the RTD-to-Digital Converter MAX31865 and P3.7 is LEVEL_INPUT specific for my application).
As my configurations are ready, I start the communication writing 0x80 on the trasmit data buffer UCA0TXBUF, but when I debugged this code section I found that the UCA0TXIFG was already set (instead of being 0)
and also the UCA0RXIFG was set (but in the UCA0RXBUF there isn't any character received).
I also tried to view the SCLK, SIMO, SOMI and ChipSelect (on P3.3) on the oscilloscope, but nothing at all...
So I think that the communication doesn't start.
This is my function:
;/*Settaggi SPI pronti per essere inviati*/ AVVIA_CONV: push.w R9 clr.w R9 bic.b #BIT3, P3OUT nop mov.b #0x80, &UCA0TXBUF nop bit.w #FLAG_FILTRO5060, &FLAG_ATTIVAZIONI jeq FILTRO_50Hz mov.b CONREG_MAX60, R9 br #TRASMETTI FILTRO_50Hz: mov.b CONREG_MAX50, R9 TRASMETTI: bit.b #UCA0TXIFG, &IFG2 jeq TRASMETTI mov.w R9, &UCA0TXBUF TRASMETTI_412: bit.b #UCA0TXIFG, &IFG2 jeq TRASMETTI_412 mov.b #0, R9 mov.w R9, &UCA0TXBUF TRASMETTI_41: bit.b #UCA0TXIFG, &IFG2 jeq TRASMETTI_41 mov.b #0, R9 mov.w R9, &UCA0TXBUF TRASMETTI_51: bit.b #UCA0TXIFG, &IFG2 jeq TRASMETTI_51 mov.b #0xFF, R9 mov.w R9, &UCA0TXBUF TRASMETTI_2: bit.b #UCA0TXIFG, &IFG2 jeq TRASMETTI_2 mov.b #0xFF, R9 mov.w R9, &UCA0TXBUF TRASMETTI_3: bit.b #UCA0TXIFG, &IFG2 jeq TRASMETTI_3 mov.b #0, R9 mov.w R9, &UCA0TXBUF TRASMETTI_4: bit.b #UCA0TXIFG, &IFG2 jeq TRASMETTI_4 mov.b #0, R9 mov.w R9, &UCA0TXBUF TRASMETTI_5: bit.b #UCA0TXIFG, &IFG2 jeq TRASMETTI_5 mov.b #0, R9 mov.w R9, &UCA0TXBUF TRASMETTI_54: bit.b #UCA0TXIFG, &IFG2 jeq TRASMETTI_54 pop.w R9 bis.b #BIT3, P3OUT ret
Is there something wrong in my code?
How can I solve this problem?
I hope someone colud help me and give some advice to resolve the issue and do a good job!
Thank you very much,
Kind Regards,
Maria Angela