Quantcast
Channel: MSP low-power microcontrollers
Viewing all articles
Browse latest Browse all 62309

Forum Post: RE: msp430G2231 enabling spi from timer interrupt.

$
0
0
Hi Bruce I use it at the beginning USICTL0 = USIPE7 + USIPE6 + USIPE5 + USIOE; // Port, SPI slave For some reason the ISR is invoked although USISWRST is HIGH (USICTL0 |= USISWRST;) It shouldn't have worked at all, right? ==> ISR happen after this line : USICTL1 |= USIIE+USICKPH; // Counter interrupt, flag remains set USICTL0 &= ~USISWRST; USICNT = MAX_SPI_CLOCKS_LEN; // init-load counter I didn't find any pending interrupts, before (USICTL1 |= USIIE+USICKPH;) After entering the ISR, it continue in a loop. // USI interrupt service routine #pragma vector=USI_VECTOR __interrupt void universal_serial_interface(void) { //volatile unsigned int probe =0; static byte cheksum_8 =0; spi_frame_data_in[spi_frame_pos] = USISRL; cheksum_8+=spi_frame_data_in[spi_frame_pos] ; spi_frame_pos++; if(spi_frame_pos==MAX_SPI_IN_MESSAGE_LEN) { if(cheksum_8==spi_frame_data_in[MAX_SPI_IN_MESSAGE_LEN-1]) { _no_operation(); //handle_spi_command(); } spi_frame_pos=0; cheksum_8=0; } USICNT = MAX_SPI_CLOCKS_LEN; // re-load counter } Appreciate any assistance David.

Viewing all articles
Browse latest Browse all 62309

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>