Jump to content
43oh

AlanW

Members
  • Content Count

    2
  • Joined

  • Last visited

Posts posted by AlanW

  1. @@wnorcott @@spirilis

     

    I'm using the example code Enrf24_RXdemo, I need some pins for I2C as well. So I have to move to UCA0.

     

    I have some problems. I copied the SPI library to a new folder and let program includes it, it works fine.

     

    I changed all "UCB0" in usci_spi.cpp to "UCA0", and change

    pinMode_int(SCK, SPISCK_SET_MODE);
    pinMode_int(MOSI, SPIMOSI_SET_MODE);
    pinMode_int(MISO, SPIMISO_SET_MODE);

    to

    pinMode_int(6, SPISCK_SET_MODE);
    pinMode_int(4, SPIMOSI_SET_MODE);
    pinMode_int(3, SPIMISO_SET_MODE);
    it works fine for the first time but when I re-upload it to the board, it's not working anymore. I don't know why.
     
    I also tried have a new class, and name everything to SPIA, but It only word once like I mentioned above. (I only tested it once, I spend too much time on this, so I didn't try it again)
     
    I tired to change
    pinMode_int(SCK, SPISCK_SET_MODE);
    pinMode_int(MOSI, SPIMOSI_SET_MODE);
    pinMode_int(MISO, SPIMISO_SET_MODE);

    to

    pinMode_int(P1_4, SPISCK_SET_MODE);
    pinMode_int(P1_2, SPIMOSI_SET_MODE);
    pinMode_int(P1_1, SPIMISO_SET_MODE);
    It doesn't work.
     
    I tried to change SCK, MOSI, MISO in pins_energia.h and keep that in usci_spi.cpp. It doesn't work either.
     
    If I don't change the class name, in my code
      SPI.begin();
      SPI.setDataMode(SPI_MODE0);
      SPI.setBitOrder(MSBFIRST);
    are those gonna run the code in the SPI library or run the code in the customize "SPIA" library? they have the same class name called SPI. Maybe it causing the problem but when I named a new class, it still not working.
     
    I'll appreciate it if you could give it a try, and maybe you know what's going on and have a solution for it.
     

    Thank you.

     

    Never mind. I figured it out. 

×
×
  • Create New...