F
F
ftp272012-08-10 22:09:49
Do it yourself
ftp27, 2012-08-10 22:09:49

Why "falls" transmission over SPI?

I have msp430f425 MK and SPB-106 WiFi module. I have not touched WiFi yet, but only soldered the sync pulse and MISO wires to MISO; MOSI to MOSI. I also soldered to the CS from WiFi to the I / O port of the MK and sent a zero there.
And prepared this simple code:

#include "msp430.h"

void main( void )
{
  WDTCTL = WDTPW + WDTHOLD; //Выключаю Watch Dog Timer
      //ACLK = 32768 Гц
    while(FLL_CTL0 & 3 ); 
 // ======= Инициализация SPI =======    
     P1SEL = BIT6 + BIT7;   
    P2SEL = BIT1;         
    P2DIR |= BIT2;         
    
    P1DIR |= BIT4;        // CS от Вай фая
    P1OUT &= ~BIT4;       // 
    
  U0CTL = CHAR+SYNC+MM+SWRST; // 8-bit SPI Master **SWRST**
  U0TCTL = CKPH+SSEL1+STC; // SMCLK, 3-pin mode +SSEL0
  U0BR0 = 0x002; // SPICLK = SMCLK/2
  U0BR1 = 0x000;
  U0MCTL = 0x000;
  ME1 = USPIE0;                             // Module enable
  U0CTL &= ~SWRST;                          // SPI enable
  IE1 |= URXIE0;                            // Receive interrupt enable
  _EINT();                                  // Enable interrupts
    
// =================================  
 unsigned char trn_word[6] = "Hello!";
 
  while (1) {
    for (int i=0; i<6; i++) {
       while (!(IFG1 & UTXIFG0));
        TXBUF0 = trn_word[i];
    }
  }
 }

I look at the oscilloscope and see this
EOgmY806GZo.jpg
. And this characteristic is constantly repeated. If you look closely, the letter "H" is transmitted and then the next transmission begins and something falls. As if the MK is rebooting, although WDT is turned off.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
P
pfalcon, 2012-08-12
@ftp27

Attention, the question is - why do you allow module interrupts if you work through polling? Where does the corresponding interrupt vector take you?

T
TyzhSysAdmin, 2012-08-12
@POS_troi

I did not work with this MK, but here you are from the Atmelovsky stash

char* trn_word;
void Send (void)
{
        trn_word  = "Hello!"+0x00;
        while   (*trn_word != 0) 
        {
                TXBUF0  = *trn_word;
                while (!(IFG1 & UTXIFG0));
                trn_word++; 
        }
}

It seems I was not mistaken, I wrote from memory.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question