MSP430

MSP430, CCS, SPI, at45dbxx data flash

CoyoteUgly 2018. 9. 5. 19:11

MSP430, CCS, SPI, at45dbxx data flash



msp430.h 를 사용하는 소스입니다.



SPI 3개 핀 (MISO, MOSI, SCK)을 사용하여 동작하도록 하였습니다.

CS 핀은 별도로 제어합니다.


1. use spi interface
- UCA0
- P1.4 : Chip Select
- P1.5 : Serial Clock Out (UCA0CLK)
- P1.6 : Reset
- P2.0 : Data Out (UCA0SIMO)
- P2.1 : Data In (UCA0SOMI)

2. msp430fr6989 development kit backchannel (uart)
- use USCI_A1
- P3.5 : UCA1RXD
- P3.4 : UCA1TXD
- BaudRate : 115200


Did you have a look at the example codes for the MCU that is provided by TI for almost every processor?


www.ti.com/lit/zip/slac536


The following examples show how to set up the clocks:

msp430fr59xx_cs_01.c       Configure MCLK for 8MHz operation
msp430fr59xx_cs_02.c       Configure MCLK for 16MHz operation
msp430fr59xx_cs_03.c       Output 32768Hz crystal on XT1 and observe failsafe
msp430fr59xx_cs_04.c       ACLK = XT1 = 32768Hz, SMCLK= XT2 = 8MHz, MCLK = DCO
msp430fr59xx_cs_05.c       Using LFXT in bypass mode, failsafe operation shown


0. 참고 사항



출처: http://coyoteugly.tistory.com/188 [마이콤 개발자를 위한 여행]

0. 참고 사항


1. 보드 연결


2. 소스 설명

full 소스는 아래 github를 통해 확인하세요.

CS 핀은 별도로 제어하기 때문에 SPI 구성에서 제외하였습니다.


    // Configure SPI
    //P1SEL0 &= ~(BIT5 | BIT4);                 // Configure slave select and clk
    //P1SEL1 |= BIT5 | BIT4;
    P1SEL0 &= ~(BIT5);                 // Configure slave select and clk
    P1SEL1 |= BIT5;




example 소스가 1 byte TX 후에 RX가 동작합니다.

따라서 n byte TX 후에 RX를 하도록 수정하였습니다.


                case TX_REG_ADDRESS_MODE:
                    if (RXByteCtr)
                    {
                        if (--TXByteCtr > 0) // add by sglee
                        {
                            MasterMode = TX_REG_ADDRESS_MODE;
                            SendUCA0Data(TransmitBuffer[TransmitIndex++]);
                            break;
                        }

                        MasterMode = RX_DATA_MODE;   // Need to start receiving now
                        //Send Dummy To Start
                        //__delay_cycles(2000000);
                        //__delay_cycles(16000); // 100us, 160=1us, not needed by sglee
                        SendUCA0Data(DUMMY);
                    }
                    else
                    {
                        MasterMode = TX_DATA_MODE;        // Continue to transmision with the data in Transmit Buffer
                        //Send First
                        SendUCA0Data(TransmitBuffer[TransmitIndex++]);
                        TXByteCtr--;
                    }
                    break; 

3. 소스


4. 결과


'MSP430' 카테고리의 다른 글

MSP430, CCS, LCDMEM  (0) 2018.09.06
MSP430, CCS, ADC, rotation_sensor  (0) 2018.09.05
MSP430, CCS, USCI_A0, UartEcho  (0) 2018.09.03
MSP430, MSP430FR6x8x_Code_Examples  (0) 2018.09.03
MSP430, CCS, 16MHz Clock  (0) 2018.09.03