Answer the question
In order to leave comments, you need to log in
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];
}
}
}
Answer the question
In order to leave comments, you need to log in
Attention, the question is - why do you allow module interrupts if you work through polling? Where does the corresponding interrupt vector take you?
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++;
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question