Jump to content

Search the Community

Showing results for tags 'spi'.

More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


  • News
    • Announcements
    • Suggestions
    • New users say Hi!
  • Spotlight!
    • Sponsor Spotlight
    • Sponsor Giveaways
  • Energia
    • Energia - MSP
    • Energia - TivaC/CC3XXX
    • Energia - C2000
    • Energia Libraries
  • MSP Technical Forums
    • General
    • Compilers and IDEs
    • Development Kits
    • Programmers and Debuggers
    • Code vault
    • Projects
    • Booster Packs
    • Energia
  • Tiva-C, Hercules, CCXXXX ARM Technical Forums
    • General
    • SensorTag
    • Tiva-C, Hercules, CC3XXX Launchpad Booster Packs
    • Code Vault
    • Projects
    • Compilers and IDEs
    • Development Kits and Custom Boards
  • Beagle ARM Cortex A8 Technical Forums
    • General
    • Code Snippets and Scripts
    • Cases, Capes and Plugin Boards
    • Projects
  • General Electronics Forum
    • General Electronics
    • Other Microcontrollers
  • Connect
    • Embedded Systems/Test Equipment Deals
    • Buy, Trade and Sell
    • The 43oh Store
    • Community Projects
    • Fireside Chat
  • C2000 Technical Forums
    • General
    • Development Kits
    • Code Vault
    • Projects
    • BoosterPacks


There are no results to display.

Found 65 results

  1. Hello there, I'm trying to program the digipot using spi communication to set the ISL23428 digipots to thier maximum values. I used the multimeter to inspect the output voltage for each digipots and the result is zero for both. I'm not sure if the issue is in my code or with the digipots. Thanks in advance for your help. #include <msp430fr5989.h> #include <stdint.h> #define delay(x) __delay_cycles(x * 8000UL) void digitalPotWrite(); uint8_t SPI_transfer(uint8_t _data); uint8_t spi_send(const uint8_t _data); void main(void) { WDTCTL = WDTPW + WDTHOLD; // Stop watchdog timer PM5CTL0 &= ~LOCKLPM5; // setup UCB1 UCB1CTLW0 = UCSWRST | UCSSEL_2; // UCSWRST= Put USCI in reset mode, UCSSEL_2 = source USCI clock from SMCLK UCB1CTLW0 |= UCCKPH | UCMSB | UCMST | UCSYNC; //UCCKPH = SPI MODE 0(CPOL=0 CPHA=0) , UCMSB= MSB, UCMST= master mode P3SEL0 |= BIT1; // P3.1-> UCB1SIMO P3SEL1 &= ~ BIT1; P3SEL0 |= BIT2 ; //P3.2-> UCB1SOMI P3SEL1 &= ~ BIT2 ; P3SEL0 |= BIT0 ; //P3.0-> USCB1CLK P3SEL1 &= ~ BIT0 ; P1OUT |= BIT0; P1DIR |= BIT0; // set cs P1.0 as output // UCB1 set initial speed UCB1BR0 |= 0x02; UCB1BR1 = 0; UCB1CTLW0 &= ~UCSWRST; // release UCB1 for operation delay(10); digitalPotWrite(); UCB1CTLW0 = UCSWRST; //spi disable for(;;) { } } void digitalPotWrite() { // take the CS pin low to select the chip: P1OUT &= ~BIT0; delay(10); // send writing instruction to WR0 SPI_transfer(0b11000000); // 110 is writing instruction followed by WR0 address(00000) delay(10); SPI_transfer(0b11111111); // set WR0 to max value delay(10); // send writing instruction to WR1 SPI_transfer(0b11000001); // 110 is writing instruction followed by WR1 address(00001) delay(10); SPI_transfer(0b11111111); // set WR1 to max value delay(10); // take the CS pin high to de-select the chip: P1OUT |= BIT0; } uint8_t SPI_transfer(uint8_t _data) { return spi_send(_data); } uint8_t spi_send(const uint8_t _data) { /* Wait for previous tx to complete. */ while (!(UCB1IFG & UCTXIFG)) // UCB1 flage ; /* Setting TXBUF clears the TXIFG flag. */ UCB1TXBUF = _data; // transfer buffer for UCB1 /* Wait for a rx character? */ while (!(UCB1IFG & UCRXIFG)) // UCB1 flage ; /* Reading clears RXIFG flag. */ return UCB1RXBUF; //reciveing buffer for UCB1 }
  2. Hi All First, I would like to thank @Rei Vilo for providing the Library for the Kentec (BOOSTXL-k350qvg) library with Energia. I copied the code out of https://www.youtube.com/watch?v=XyeUpk6P4kA (as I didn't find the powerpoint or pdf) and got it to work with an MSP430F5529 launchpad. (Energia 18, Windows as the Mac version doesn't work atm). Then I compiled the same code on a MSP432P401R launchpad and it runs a lot slower than on the F5529 (I assume this is a known issue, due to slow SPI speed ( https://github.com/energia/msp432-core/issues/27 ) but also doesn't look the same, the fonts are "skinnier on the MSP432. This discrepancy, I cannot explain. Another question: If I want to write a changing variable, in this case simply the x-coordinate of the touch to the screen, how do I locally clear the screen without redrawing everything (or if I want to make a bar graph that represents eg a changing value of a sensor? Do I always draw a black rectangle, then the bar/text etc? or is there a simpler way that is not immediately obvious to me now? Next step: I have to learn more about state machines to switch screens (settings), do stuff there, come back to main without the program getting into badly readable territory. Thank you very much for your help. //First steps with the Kentec Display #include "SPI.h" #include "Screen_K35_SPI.h" Screen_K35_SPI myScreen; uint16_t colours[6]; uint16_t x; uint16_t y; uint16_t z; uint8_t initFlag; void setup() { Serial.begin(9600); Serial.println(); Serial.println("hello"); Serial.println(); pinMode(RED_LED, OUTPUT); myScreen.begin(); myScreen.clear(); colours[0] = myScreen.calculateColour(255, 0, 0); colours[1] = myScreen.calculateColour(0, 255, 0); colours[2] = myScreen.calculateColour(0, 0, 255); colours[3] = myScreen.calculateColour(255, 255, 255); colours[4] = myScreen.calculateColour(255, 255, 0); colours[5] = myScreen.calculateColour(0, 0, 0); x = 0; y = 0; z = 0; myScreen.setPenSolid(true); myScreen.setFontSolid(false); myScreen.setFontSize(2); initFlag = 1; } void loop() { if (initFlag) { drawHomeScreen(); initFlag = 0; } if (myScreen.isTouch() > 0) { myScreen.getTouch(x, y, z); myScreen.gText(10, 10, btoa(x, 8), colours[3]); Serial.print(x); Serial.print(" "); Serial.print(y); Serial.print(" "); Serial.println(z); } if (z > 100) { if ((x < 160 && x > 0) && (y < 240 && y > 100)) { digitalWrite(RED_LED, HIGH); } else if ((x < 320 && x > 160) && (y > 100 && y < 240)) { digitalWrite(RED_LED, LOW); } else if ((x < 320 && x > 160) && (y > 0 && y < 100)) { drawSettingsScreen(); } } } void drawHomeScreen() { myScreen.clear(); myScreen.gText(30, 50, "TOUCH LCD DEMO", colours[4]); myScreen.rectangle(0, 100, 160, 239, colours[1]); myScreen.gText(50, 180, "ON", colours[0]); myScreen.rectangle(160, 100, 319, 239, colours[0]); myScreen.gText(235, 180, "OFF", colours[1]); myScreen.rectangle(160, 0, 319, 100, colours[2]); myScreen.gText(180, 50, "SETTINGS", colours[3]); } void drawSettingsScreen() { myScreen.clear(); myScreen.gText(10, 10, "TOUCH LCD DEMO", colours[0]); myScreen.gText(10, 30, "TOUCH LCD DEMO", colours[1]); myScreen.gText(10, 50, "TOUCH LCD DEMO", colours[2]); myScreen.gText(10, 70, "TOUCH LCD DEMO", colours[3]); myScreen.gText(10, 90, "TOUCH LCD DEMO", colours[4]); }
  3. Hi, I have a project in which I submit data through a custom message protocol. So like message <321;1;5;10.2> is a thing. To do that I use things like String s = "<310;" + String(DeviceID) + String(";") + String(ToestelID)+ String(";") + String(currentUsrID)+ String(";1;") + String(CurrentPowerUsg) + String(";") + String(Temp1) + String(";") + String(Temp2) + String(";") + String(lichtSterkte) + String(">"); But the conversion of double to string fails. this code double ding = 10.15; Serial.print("double print"); Serial.println(ding); Serial.print("Als string"); Serial.println(String(ding)); String s = "<320;" + String(ding) + String(";"); Serial.println(s); gives me this result: Which is fine. However if I include SPI.h and use the same code I get this result I found this out after starting a new project using all the includes from my original project, and eliminating them 1 by 1. So the SPI include does something to my String conversion... I'm using Energie 1.6.10E18 How can I fix this?
  4. MSP430 to Arduino SPI Communication

    Dear Engineers, Please help me send data to Arduino from my MSP430F5529 using SPI interface. I want to use SPI iterface because in future I want to use the modified code for Attiny13A instead of the Arduino Leonardo. Details are given below. Thank you for your support. Information to Provide When Asking for Help: Model of LaunchPad used and revision number : MSP430F5529 Launchpad Rev 1.6 & Arduino Leonardo Model of the MCU used : MSP430F5529 & ATMEGA32U4~AU at 15Mhz Name and version of the IDE used : Energia 1.6.10E18 & Ardduino IDE 1.8.2 OS the IDE is running on : Linux Mint 18 Whenever possible, minimal code to replicate the issue : Required from good developer
  5. Hi, I'm implementing an application for CC3200MOD in Energia 1.6.10E18 environment in which host MCU (Atmel AT76C114) sends jpeg image data (size varies from 1MB to 3MB) over SPI to CC3200MOD which then sends it over WiFi to PC. So Atmel acts as SPI master and CC3200MOD SPI slave. The bottleneck is SPI receive rate in CC3200MOD end. I need to configure host MCU SPI clock to 10.5MHz in order to receive correct data on CC3200MOD. With higher clock rate the data gets corrupted. When receiving valid data the transfer rate is 0.17 MBps. This is way too low for our purposes. I have understood that by using SPI DMA one could receive higher transfer rate. Are there any SPI DMA examples available for SPI slave receive in Energia environment? Does SPI DMA work on SPI slave when SPI master sends data continuously or does it require changes also for the sending procedure from SPI master? Thanks, Yuzzie
  6. SPI on cc1310

    I'm trying to use a cc1310 with a pressure sensor (BMP280) using the hardware port. I check at address 0xD0 for the chip ID (0x58) and this works but beyond this point there is no further SPI activity although I need to set up the filters and over-sampling etc. It's looking like I'll have to switch to CCS, but before I do, has anyone had this same problem and found a solution? BTW, this same sketch works fine with cc3200 (not emt) and the 430FR5969 which suggests a multi-tasking connection. Steve
  7. Hi, I am trying to read ADC channel values from MCP3911 using MSP launchpad using SPI protocol. When i used Arduino Mega the protocol is working fine. But when i use any TI devices i am having a problem, it always gives me all 0'S or 1's. I am using energia for MSP devices. Any i have chosen the appropriate pins as defined in the enegia pin layout. msp430----- static const uint8_t SS = 8; /* P2.7 */ static const uint8_t SCK = 7; /* P3.2 */ static const uint8_t MOSI = 15; /* P3.0 */ static const uint8_t MISO = 14; /* P3.1 */ Can someone help me troubleshoot where i am going wrong. Thanks in advance. // SPI Stuff here #include "SPI.h" const uint8_t MCP3911_CS = SS; // Teensy SPI CS1 = MCP3911 void setup() { //SPI Bus setup digitalWrite(MCP3911_CS,HIGH); // pinMode (MCP3911_CS, OUTPUT); // MCP3911 SPI.setBitOrder(MSBFIRST); SPI.setDataMode(SPI_MODE0); SPI.setClockDivider(SPI_CLOCK_DIV8); //i.e. 6MHz on a Teensy running at 48MHz. SPI.begin(); //Setup Serial Comms Serial.begin(115200); Write_MCP3911_Register (0x0D, B11000010); } int32_t adc; void loop() { //adc = Read_MCP3911_24bit(0x00); Read_MCP3911_Register(0x0D); // Serial.print("Ch0 : "); // Serial.println(adc); delay(200); } uint8_t Write_MCP3911_Register (uint8_t MCP3911_Register_Address, uint8_t Command) { Serial.print("Command Register Received: "); Serial.print(MCP3911_Register_Address,HEX); Serial.print(" - Command Received: "); Serial.println(Command,BIN); MCP3911_Register_Address <<= 1; //left shift address one digit MCP3911_Register_Address &= B00111110; // and ensure last digit is a zero for write command digitalWrite(MCP3911_CS, LOW); // now take CS low to enable SPI device SPI.transfer(MCP3911_Register_Address); // send address with write command to MCP3911 SPI.transfer(Command); //now send payload digitalWrite(MCP3911_CS, HIGH); // deselect the CS pin. Serial.print(" Write Command Byte Sent: "); Serial.println(MCP3911_Register_Address,BIN); // verify what command was sent (i.e. address and write bit = 0) //Now Verify all went well. If so, have the function return value of one, //otherwise, alert the user that something is amiss. uint8_t Response = Read_MCP3911_Register (MCP3911_Register_Address>>1); if (Response == Command) return 1; else { Serial.println(""); Serial.print("Error for register: "); Serial.print(MCP3911_Register_Address>>1,BIN); Serial.print(" - Command Sent: "); Serial.print(Command,BIN); Serial.print(" - Response Received: "); Serial.println(Response,BIN); Serial.println(""); return 0; } } uint8_t Read_MCP3911_Register (uint8_t MCP3911_Register_Address) { MCP3911_Register_Address <<=1; //left shift address one bit for command byte MCP3911_Register_Address |=1; // Ensure read bit is set Serial.print(" Read Byte Command Sent: "); Serial.print(MCP3911_Register_Address,BIN); digitalWrite(MCP3911_CS, LOW); SPI.transfer(MCP3911_Register_Address); // send address with read command to MCP3911 uint8_t Response = SPI.transfer(0x00); digitalWrite(MCP3911_CS, HIGH); Serial.print(" - Response Received: "); Serial.println(Response,BIN); return Response; } void Reset_ADC() { // Puts ADC into Reset Mode, i.e. stops ADC conversions until setup is complete. Write_MCP3911_Register (0x0D, B11000010); } int32_t Read_MCP3911_24bit( uint8_t MCP3911_Register_Address) { uint8_t HB,MB,LB=0, MCP3911_CTRL=0;; int32_t adc0code=0; MCP3911_CTRL = 0; MCP3911_CTRL =(MCP3911_Register_Address<<1); //left shift address one digit for write command MCP3911_CTRL |= 1; //Turn on Read Operation by toggling last bit on digitalWrite(MCP3911_CS, LOW); SPI.transfer(MCP3911_CTRL); // send command byte to MCP3911 HB = SPI.transfer(0x0);//receive High Byte MB = SPI.transfer(0x0);//receive Middle Byte LB = SPI.transfer(0x0);//receive Low Byte digitalWrite(MCP3911_CS, HIGH); adc0code = HB; adc0code = adc0code<<8; adc0code |= MB; adc0code = adc0code<<8; adc0code |= LB; //connecting the 3 bytes to one number return adc0code;// returning result }
  8. Nick Gammon published an interesting post on using SPI on 16 MHz Arduinos to run WS2812 LEDs (aka neopixels) at: http://gammon.com.au/forum/?id=13357. He also provides a link with a lot of information about the NRZ protocol used by the WS2812 and tolerances: https://wp.josh.com/2014/05/13/ws2812-neopixels-are-not-so-finicky-once-you-get-to-know-them/. The tolerances are actually quite a bit looser than what I previously believed. So, I set out to do something similar with Energia and LaunchPads running at different speeds. Spoiler alert: It works. The previously linked articles provide all the background so minimal information is repeated here. NRZ is a one wire protocol that transfers information to the LEDs by varying the length of the signal when high. A longer pulse is used for a 1, and a shorter one for a 0. The timing, with tolerances, is shown in the figure below. The length between pulses cannot exceed about 5 us and most everything else is pretty loose. The protocol is implemented using SPI which I find pretty clever. A byte is sent out with the SPI module with the proper length to represent the desired bit for the protocol. The following must be determined and set to do this: Set proper SPI clock speed using SPI.setClockDivider() in Energia Determine the proper byte to send by SPI.transfer() in Energia to represent a 0 or 1 bit For example, using the MSP430F5529: Clock speed is 25.6 MHz Setting the SPI clock divider to 4 gives a SPI clock of 6.4 MHz and since the SPI block executes in one cycle (Arduino executes in 2), each bit in the byte is equivalent to 156.25 ns. Therefore, to send a pulse indicating a "1", a byte equal to 0b1111000 could be used which gives 4x156.25 = 625 ns. This is in the acceptable range of 550 to 850 ns. Similarly, for a 0 an acceptable byte would be 0b11000000 or 312.5 ns. A similar process can be used to determine acceptable values for the MSP430G2553. The sketch below is a simplification of the library presented by Nick which and includes the modifications described above to run on both the G2553 and F5529. The preprocessor is used to set appropriate values for the clock divider and long and short bytes. The functions are very nearly the same as posted by Nick. Note that interrupts must be disabled before sending data and then reenabled manually after. /* * WS2812 display using SPI on various TI LaunchPads with Energia * * Connections: * LaunchPad LED Strip * --------- --------- * 3V3 5VDC * Pin 15 (MOSI) DIN * GND GND * * How to use: * ledsetup (); - Get ready to send. * Call once at the beginning of the program. * sendPixel (r, g, ; - Send a single pixel to the string. * Call this once for each pixel in a frame. * Each colour is in the range 0 to 255. Turn off * interrupts before use and turn on after all pixels * have been programmed. * show (); - Latch the recently sent pixels onto the LEDs . * Call once per frame. * showColor (count, r, g, ; - Set the entire string of count Neopixels * to this one colour. Turn off interrupts before use * and remember to turn on afterwards. * * Derived from NeoPixel display library by Nick Gammon * https://github.com/nickgammon/NeoPixels_SPI * With ideas from: * http://wp.josh.com/2014/05/13/ws2812-neopixels-are-not-so-finicky-once-you-get-to-know-them/ * Released for public use under the Creative Commons Attribution 3.0 Australia License * http://creativecommons.org/licenses/by/3.0/au/ * * F Milburn November 2016 * Tested with Energia V17 and WS2812 8 pixel strip on launchpads shown below. */ #include <SPI.h> #if defined(__MSP430G2553) #define SPIDIV SPI_CLOCK_DIV2 // 16 MHz/2 gives 125 ns for each on bit in byte #define SPILONG 0b11111100 // 750 ns (acceptable "on" range 550 to 850 ns) #define SPISHORT 0b11100000 // 375 ns (acceptable "on" range 200 to 500 ns) #elif defined(__MSP430F5529) #define SPIDIV SPI_CLOCK_DIV4 // 25.6 MHz/4 gives 156.25 ns for each on bit in byte #define SPILONG 0b11110000 // 625 ns (acceptable "on" range 550 to 850 ns) #define SPISHORT 0b11000000 // 312.5 ns (acceptable "on" range 200 to 500 ns) #else #error This microcontroller is not supported #endif const unsigned int PIXELS = 8; // Pixels in the strip void setup (){ ledsetup(); } void loop (){ // Show a solid color across the strip noInterrupts(); // no interrupts while sending data showColor (PIXELS, 0xBB, 0x22, 0x22); // single color on entire strip interrupts(); // interrupts are OK now delay(1000); // hold it for a second // Show a different color on every pixel noInterrupts(); // no interrupts while sending data sendPixel(0xBB, 0x00, 0x00); // red sendPixel(0x00, 0xBB, 0x00); // green sendPixel(0x00, 0x00, 0xBB); // blue sendPixel(0xBB, 0xBB, 0xBB); // white sendPixel(0xBB, 0x22, 0x22); // pinkish sendPixel(0x22, 0xBB, 0x22); // light green sendPixel(0x22, 0x22, 0xBB); // purplish blue sendPixel(0x00, 0x00, 0x00); // pixel off interrupts(); // interrupts are OK now delay(1000); // hold it for a second } // Sends one byte to the LED strip by SPI. void sendByte (unsigned char { for (unsigned char bit = 0; bit < 8; bit++){ if (b & 0x80) // is high-order bit set? SPI.transfer (SPILONG); // long on bit (~700 ns) defined for each clock speed else SPI.transfer (SPISHORT); // short on bit (~350 ns) defined for each clock speed b <<= 1; // shift next bit into high-order position } // end of for each bit } // end of sendByte // Set up SPI void ledsetup(){ SPI.begin (); SPI.setClockDivider (SPIDIV); // defined for each clock speed SPI.setBitOrder (MSBFIRST); SPI.setDataMode (SPI_MODE1); // MOSI normally low. show (); // in case MOSI went high, latch in whatever-we-sent sendPixel (0, 0, 0); // now change back to black show (); // and latch that } // end of ledsetup // Send a single pixel worth of information. Turn interrupts off while using. void sendPixel (unsigned char r, unsigned char g, unsigned char { sendByte (g); // NeoPixel wants colors in green-then-red-then-blue order sendByte (r); sendByte (; } // end of sendPixel // Wait long enough without sending any bits to allow the pixels to latch and // display the last sent frame void show(){ delayMicroseconds (9); } // end of show // Display a single color on the whole string. Turn interrupts off while using. void showColor (unsigned int count, unsigned char r , unsigned char g , unsigned char { noInterrupts (); for (unsigned int pixel = 0; pixel < count; pixel++) sendPixel (r, g, ; interrupts (); show (); // latch the colours } // end of showColor The timing, when checked on a logic analyzer, checks out with the calculations above (hooray for math). The "gaps" between pulses are within tolerance and largely set by code overhead as well as the byte being sent. And here it is showing the strip lit up in one color. I tried this on several other LaunchPads I had handy and here is a summary: FR6989 - I had never noticed, but Energia defaults to 8 MHz. Doing the math, there isn't a good match to the WS2812 requirements without changing processor speed (which I did not try). MSP432 - there was behavior I couldn't explain, probably due to RTOS and I didn't pursue this for long. In summary, the method works although I did limited experimentation. It would be even easier to implement outside of Energia with full access to clocks. It was an interesting exercise but alternative methods have been posted here on 43oh with tuned assembler and having used those successfully in the past, I will probably continue to preferentially use them in the future.
  9. Hello! Can anybody provide information about declaring multiple SPI objects for separate HW SPI modules or about the correct routine of switching the SPI channel of a SPI object? Im trying to an ILI9341 TFT and a XPT2043 touch controller, but sadly I can not join them to use a single bus, because the MISO of the TFT is killing the communication. Now i connected them to the same bus, MISO only going to the touch controller and it works fine, but the problem made me curious about the proper usage of the SPI modules.
  10. I try to use the Nokia 5110 with the card module tm4c1294 using a library I found this forum developed for tm4c123 but I can not display characters. I need help because they took several days on trying without success. I added the library you use, make some adjustments to the pins but not achievement communicate LCD screen. I added the library you use, make some adjustments to the pins but not achievement communicate LCD screen Examples.ino Graphics.c LCD_5110_SPI.cpp LCD_5110_SPI.h LCD_5110_SPI.zip Terminal3.h Terminal6.h Terminal12.h
  11. Hello, I am having trouble using a SPI DS3234 RTC with Energia and TivaC series launchpad. I am using the ds3234 library at https://github.com/rodan/ds3234 which is originally written for arduino. I modified few settings in the initialization, tried few things, but have not had any luck. The module will not talk spi at all, and I get 1900.00.00 00:00:00 for date all the time. Here is the relevant code from the init section: void DS3234_init(const uint8_t pin, const uint8_t ctrl_reg) { pinMode(pin, OUTPUT); SPI.setModule(2); SPI.begin(); SPI.setClockDivider(SPI_CLOCK_DIV32); SPI.setBitOrder(MSBFIRST); SPI.setDataMode(SPI_MODE3); DS3234_set_creg(pin, ctrl_reg); delay(10); } First off I am setting spi port 2, before spi.begin. I tried all clock_dividers. The ds3234 supports upto 4mhz spi speed, so considering 80mhz clock speed for tivac board, I am using a div32 divider. I also scanned all of the dividers. I tried spi_mode 1 and 3 also. I also checked with an oscilloscope, that I am indeed talking with SPI2 port. (I can see the clock and cs lines with little spikes, when the tiva-c sends commands). For some reason the SPI port in the TivaC is unable to talk with this RTC chip. I could not figure out why. I tested the same code on a MSP430F5529 with the RTC connected to SPI0 port, and it worked as expected. Here is the relevant part for that one: (I only commented out the setModule statement, and used the div8 divider) void DS3234_init(const uint8_t pin, const uint8_t ctrl_reg) { pinMode(pin, OUTPUT); //SPI.setModule(2); SPI.begin(); SPI.setClockDivider(SPI_CLOCK_DIV8); SPI.setBitOrder(MSBFIRST); SPI.setDataMode(SPI_MODE3); DS3234_set_creg(pin, ctrl_reg); delay(10); } I also found a forum post at http://forum.43oh.com/topic/9016-ds3234-rtc-peek-poke/ which complains about not being able to peek / poke the internal SRAM of the ds3234 - but unfortunately was not answer. I am speculating this too arises from similar SPI trouble. Any ideas/recomendations/help greatly appreciated, Best Regards, C.
  12. Hi, I'm trying to use an old stellaris launchpad board as a datalogger to an SD card for logging data from an accelerometer. I've already built such a project on the arduino hardware but best I can do is one reading per 2ms and I want to get it logging faster... at least 1 reading every 500us. So I thought I would port it onto the the launchpad boards I had kicking around. Straight up the SD card didn't work trying to use SPI(3) as the underlying SPI bus and I have downloaded and tried about 6 different sd card libraries but got nowhere. What I then did was go back to first principles. Confirm SPI is working on the default SPI bus SPI(2) before switching to SPI3 and before putting the SD libraries on top of it. So I grabbed the simplest SPI product I had, a microchip MCP4251 digital pot and wired it up on a breadboard and confirmed it fully working at 5v with the arduino. The MCP4251 is specced for 3.3v @10Mhz so presumably there should be no issue using it with the launchpad. When I wired it to the launchpad it didn't work. It sort of worked for one of the digital pot's channels but not for the other. It's sort of stuck on power up settings but the behaviour is not logical so I cannot diagnose a problem. I tried the clock divider to slow it down a bit to check if that was the case but to no effect. I tried setting the SPI modes to 0 and 1 as per the pots datasheet and I tried manually pulling down the CS earlier but it seems that the SPI library does something that disables access to the CS pin. Checking and comparing the signals at the chip with a scope they all "appear" correct but I only have a 2 channel scope and no logic analyser so I cannot check it with enough detail to confirm. I can bit bang it but want to do it in hardware. I swapped the pot for 2 others I have and they all perform (or don't perform) exactly the same. There's some sonsistency there at least. At this stage i'm left with wondering if there's an issue with the energia SPI library. Not something I would have expected to be the case as SPI is pretty basic functionality but you never know. Alternatively it's possibly an issue with using the library. Unfortunately there are no examples of SPI usage which are relevant as they all use the msp430. If anyone has an example that they can confirm working against a Microchip product It would be much appreciated. I'm using energia given i'm trying to port arduino code but happy to use CCS which i've used for other projects. I'm at work and don't have the code with me which is why I havent posted code. Regards, David
  13. MSP430G2553 SPI Slave mode behaviour

    As a part of my teaching work, I wanted to demonstrate connecting Raspberry Pi-2 (as SPI Master) to MSP430 LP with MSP430G2553 (as SPI Slave), as an alternative to Arduino-Uno as a SPI Slave. It was aimed at utilizing the ADC's of either of these micro-controller boards, as Raspberry Pi-2 does not have ADC modules. The working of Arduino Uno as the SPI Slave device was smooth and painless, but I spent many hours getting the MSP430G2553 working as a SPI SLave. Ultimately, I hit upon a hack (if there was one) and MSP430G2553 started working as SPI Slave! However, I do not understand why this hack works, or, why such a hack is needed at all. I shall appreciate any hints, help, explanations regarding this. I hope to be excused for this long posting. --------------- SPI Master code: helloArdu.c --------------------- /********************************************************** SPI_Hello_Arduino Configures an Raspberry Pi as an SPI master and demonstrates bidirectional communication with an Arduino Slave by repeatedly sending the text "Hello Arduino" and receiving a response ***********************************************************/ #include <sys/ioctl.h> #include <linux/spi/spidev.h> #include <fcntl.h> #include <cstring> #include <iostream> using namespace std; int fd; unsigned char hello[] = {'H','e','l','l','o',' ', 'A','r','d','u','i','n','o'}; unsigned char result; int spiTxRx(unsigned char txDat); int main (void){ fd = open("/dev/spidev0.0", O_RDWR); unsigned int speed = 1000000; ioctl (fd, SPI_IOC_WR_MAX_SPEED_HZ, &speed); while (1){ for (int i = 0; i < sizeof(hello); i++) { result = spiTxRx(hello); cout << result; usleep (10); } } } int spiTxRx(unsigned char txDat){ unsigned char rxDat; struct spi_ioc_transfer spi; memset (&spi, 0, sizeof (spi)); spi.tx_buf = (unsigned long)&txDat; spi.rx_buf = (unsigned long)&rxDat; spi.len = 1; ioctl (fd, SPI_IOC_MESSAGE(1), &spi); return rxDat; } -------------------------------------------------------------------------- The Arduino Uno Slave code is: ---------------------- helloRaspi.ino -------------------------------- /************************************************************* SPI_Hello_Raspi Configures an ATMEGA as an SPI slave and demonstrates bidirectional communication with an Raspberry Pi SPI master by repeatedly sending the text "Hello Raspi" ****************************************************************/ unsigned char hello[] = {'H','e','l','l','o',' ', 'R','a','s','p','i','\n'}; byte marker = 0; void setup (void) { pinMode(MISO, OUTPUT); SPCR |= _BV(SPE); } void loop (void){ if((SPSR & (1 << SPIF)) != 0) { SPDR = hello[marker]; marker++; if(marker > sizeof(hello)){ marker = 0; } } } ------------------------------------------------------------------------- My Slave code for MSP430G2553 is: ------------------------- helloRaspi.c ------------------------------- #include "msp430g2553.h" #include <string.h> unsigned char cmdbuf[20]; char cmd_index=0; unsigned char hello[] = "Hello Raspi \n"; void main(void) { WDTCTL = WDTPW + WDTHOLD; // Stop watchdog timer P1DIR |= BIT0 + BIT6; while (!(P1IN & BIT5)); P1SEL = BIT5 + BIT6+ BIT7; P1SEL2 = BIT5 + BIT6 + BIT7; P2SEL = BIT0; P2SEL2 = BIT0; UCB0CTL1 = UCSWRST; // **Put state machine in reset** UCB0CTL0 |= UCCKPL + UCMSB + UCMODE_2 + UCSYNC; // 3-pin, 8-bit SPI master UCB0CTL1 &= ~UCSWRST; // **Initialize USCI state machine* IE2 |= UCB0RXIE; // Enable USCI0 RX interrupt IE2 |= UCB0TXIE; __bis_SR_register(LPM4_bits + GIE); // Enter LPM4, enable interrupts } // end main() int index = 0; __attribute__((interrupt(USCIAB0TX_VECTOR))) void USCI0TX_ISR (void){ UCB0TXBUF = hello[index]<<1; // <---- Note this hack index++; if(index == 13) index = 0; } __attribute__((interrupt(USCIAB0RX_VECTOR))) void USCI0RX_ISR (void){ char value = UCB0RXBUF; if (cmd_index == 13) { if (strncmp(cmdbuf, "Hello Arduino", 13) == 0) { P1OUT |= BIT0; } else { P1OUT &= ~BIT0; } cmd_index = 0; } else { cmdbuf[cmd_index] = value; cmd_index++; } } ------------------------------------------------------------------------- Note the hack indicated by <---, where the character to be transmitted to back to RaspberryPi is shifted to left by one bit. Without this hack, which would be normal way, I found that, e,g, Character 'A' (0x41) sent was received as 0xA0, indicating that the character bits are being rotated to the right one place. With this hack, transmission was fine! Why this is so? Am I missing something or doing something wrong? Digging various discussion lists and forums, unfortunately, have not given any clue. There are plenty of example code for MSP430G2553 working in SPI Master mode, but few for Slave mode.
  14. Hello! I am having trouble getting the correct values from my MSP432 to my DAC. So basically my project setup is as follows: Transmitting: -Microphone connected to the A15 channel of my MSP432 -Xbee connected to the UART pins 3.2, 3.3 CODE Tx: const int MICAN = A15; // MIC in void setup() { Serial1.begin(9600); // baud rate setting } void loop() { Serial1.print(analogRead(MICAN));// send mic value over serial delay(100); // for testing } /////////////////////////////////////////////////////////////////////// Receiving: -MSP432 connected to my other Xbee device UART pins 3.2, 3.3 -MSP432 connected to LTC1658 14-bit DAC. -DAC is connected to pins 1.6 (MOSI, or input), 4.3 (CS), and 1.5 (SCLK) CODE Rx: const int slaveSelectPin = 6; // CS for the DAC #include <SPI.h> int DacVal = 0; // value to be sent to the dac void setup() { Serial1.begin(9600);//baud rate setting //spi crap pinMode (slaveSelectPin, OUTPUT); SPI.setClockDivider(SPI_CLOCK_DIV4); SPI.begin(); } void loop() { if (Serial1.available()>0) {// If there is SHIT in the buffer DacVal = Serial1.read(); } //YOUR POST PROCESING HERE!!!!!!! DACWrite(DacVal); } void DACWrite(int Val) { char LSBs; char MSBs; // take the SS pin low to select the chip: //Split the int to 2 chars, the bit shift may be off, but i dont have any hardware to test on LSBs=char(Val); MSBs=char(Val>>8); digitalWrite(slaveSelectPin,LOW); // send in the address and value via SPI 1 byte at a time: SPI.transfer(LSBs); SPI.transfer(MSBs); // take the SS pin high to de-select the chip: digitalWrite(slaveSelectPin,HIGH); } ////////////////////////////////////// And basically I am not getting values that are correct when I put a oscilloscope on the output of the DAC. I am thinking my problem is somewhere in the Rx code because when my Tx board is setup I am reading the values from my other zigbee through the computer successfully. Any help would be great, thank you!!
  15. Hello everyone, I am a newbie here, just received my MSP432 launchpad few days ago and I'm willing to develop a wireless bluetooth communication between my MSP432+Bluefruit LE SPI and my computer. I downloaded the librairies from Adafruit that are designed for Arduino and I think I succeeded to convert a honest part of the code for Energia. Though, I still have an important problem that stops me to go forward. Indeed the Bluefruit LE SPI dongle communicate through some commands called ATCommand, and I don't succeed to transmit those commands through the dongle. As an example this is the original Arduino code for a factory reset of the bluetooth device : /* Perform a factory reset to make sure everything is in a known state */ Serial.println(F("Performing a factory reset: ")); println("AT+FACTORYRESET"); bool isOK = ble.waitForOK(); // Bluefruit need 1 second to reboot delay(1000); // flush all left over ble.flush(); if ( ! isOK ){ error(F("Couldn't factory reset")); } In Arduino they use the println to transmit the command but in Energia I just get the "AT+FACTORYRESET" back in my Serial monitor but don't believe the device receives it. I tried to use SPI.transfer to send the message the following way but still get a failure result for the factory reset process : bool Adafruit_BLE::factoryReset(void) { char c; SPI.begin(); // println("AT+FACTORYRESET"); for (const char * p = "AT+FACTORYRESET" ; c = *p; p=p+2) { digitalWrite(18,LOW); SPI.transfer(0x10); // First Byte indicating that a COMMAND is sent according to Adafruit SDEP protocol SPI.transfer(c); // First byte of data const char * d = p+1; char e = *d; // Second byte of data SPI.transfer(e); digitalWrite(18,HIGH); } println("AT+FACTORYRESET"); bool isOK = waitForOK(); // Bluefruit need 1 second to reboot delay(1000); // flush all left over flush(); return isOK; } If anyone succeeded to connect this bluetooth dongle through SPI with MSP or has an idea of how to do it, pleeaase help me PS : It seems that this operation (like any other) is not achievable because the IRQ pin (This is the nRF51 -> Arduino 'interrupt' pin that lets the Arduino or MCU know when data is available on the nRF51, indicating that a new SPI transaction should be initiated by the Arduino/MCU) is never on HIGH. It is weird because normally after received any command message, it is supposed to turn on...
  16. SPI Not Working

    I have a Dig Pot the TPL0501 by Texas Instruments that I am trying to control with a micro controller. Link Here: http://www.ti.com/lit/ds/slis136a/slis136a.pdf I have been able to successfully control this with my CC3200 and the output signals look like Photo 1 attatched. I have since decided I want to do this with my MSP432 but I am not able to get it to work. The same code should work for each I assume. The output signals I am getting for the MSP432 are shown in photo 2. I have tried changing the mode but nothing seems to help. Any ideas? My code is listed below: #include <SPI.h> const int SS = 18; uint8_t value = 150; void setup() { pinMode(SS, OUTPUT); SPI.begin(); digitalWrite(SS, HIGH); SPI.setBitOrder(MSBFIRST); SPI.setDataMode(SPI_MODE3); SPI.setClockDivider(SPI_CLOCK_DIV32); } void loop() { digitalPotWrite(value); delay(100); } int digitalPotWrite(int x) { digitalWrite(SS, LOW); SPI.transfer(x); digitalWrite(SS, HIGH); }
  17. Hello all, I'm having trouble getting my digital pot to respond to the CC3200. Could someone please take a look at my code and let me know where I'm going wrong? Thanks. DataSheet for the digital pot; http://www.ti.com/product/tpl0501-100 #include <SPI.h> const int SS = 8; uint8_t value; int volts = 0; void setup() { Serial.begin(9600); pinMode(SS, OUTPUT); SPI.begin(); delay(100); } void loop() { for(value = 0; value < 256; value += 20) { digitalWrite(SS, LOW); delay(10); SPI.transfer(value); delay(10); digitalWrite(SS, HIGH); delay(100); } }
  18. Here is some code to drive ws281x strips using DMA driven SPI for the msp430f5529. I hadn't seen any example code showing how to use DMA and SPI. The example also provides some code that shows how to use inline asm that will work with both msp430-gcc and msp430-elf-gcc. The code below was tested with a ws2811 strip and msp430-elf-gcc. https://gist.github.com/RickKimball/9761b8f5a89d46a53939 -rick
  19. SPI with DMA for MSP432

    Hi, I'm a bit new to this... I'm wanting to improve the performance of the SPI, I understand that using DMA is the best solution. Are their any example of SPI with DMA? Currently without DMA, I have the SPI setup to send 1 byte at a time with: SPI_transmitData(LCD_EUSCI_MODULE, data); What I want to do is change this so I can fill a buffer with bytes, then say Send. Once thats finished sending I want to fill the buffer again and send the next set of bytes. I tried to use this code although it appears to hang at the last line! DMA_enableModule(); DMA_setControlBase(m_controlTable); DMA_assignChannel(DMA_CH0_EUSCIB0TX0); DMA_disableChannelAttribute(DMA_CH0_EUSCIB0TX0, UDMA_ATTR_ALTSELECT | UDMA_ATTR_USEBURST | UDMA_ATTR_HIGH_PRIORITY | UDMA_ATTR_REQMASK); DMA_setChannelControl(UDMA_PRI_SELECT | DMA_CH0_EUSCIB0TX0, UDMA_SIZE_8 | UDMA_SRC_INC_8 | UDMA_DST_INC_8 | UDMA_ARB_8); DMA_setChannelTransfer(UDMA_PRI_SELECT | DMA_CH0_EUSCIB0TX0, UDMA_MODE_BASIC, m_data_array, (void*)SPI_getTransmitBufferAddressForDMA(EUSCI_B0_MODULE), 1024); DMA_assignInterrupt(DMA_INT1, 0); Interrupt_enableInterrupt(INT_DMA_INT1); ? I was planning to use the code above by filling the buffer "m_data_array" then calling DMA_enableChannel(0); although this didn't work. How do i know when the buffer has been transmitted?
  20. Hi, I'm struggling to get the the ILI9341 display to work on a MSP432. I've used it on an arduino with this display driver, so I figured that would be a good start for the porting. This display is setup to use SPI (SCK,MISO,MOSI, CS,DC). I understand this is called 4 wire SPI? The following is the code used to init the SPI is this correct? GPIO_setAsOutputPin(LCD_RESET_PORT, LCD_RESET_PIN); GPIO_setOutputLowOnPin(LCD_RESET_PORT, LCD_RESET_PIN); GPIO_setAsOutputPin(LCD_DC_PORT, LCD_DC_PIN); GPIO_setOutputLowOnPin(LCD_DC_PORT, LCD_DC_PIN); GPIO_setAsOutputPin(LCD_SPI_CS_PORT, LCD_SPI_CS_PIN); GPIO_setOutputLowOnPin(LCD_SPI_CS_PORT, LCD_SPI_CS_PIN); // // Configure SPI peripheral. // GPIO_setAsPeripheralModuleFunctionOutputPin(LCD_SPI_MOSI_PORT, LCD_SPI_MOSI_PIN, LCD_SPI_MOSI_PIN_FUNCTION); GPIO_setAsPeripheralModuleFunctionOutputPin(LCD_SPI_MISO_PORT, LCD_SPI_MISO_PIN, LCD_SPI_MISO_PIN_FUNCTION); GPIO_setAsPeripheralModuleFunctionOutputPin(LCD_SPI_CLK_PORT, LCD_SPI_CLK_PIN, LCD_SPI_CLK_PIN_FUNCTION); eUSCI_SPI_MasterConfig spiMasterConfig = { EUSCI_B_SPI_CLOCKSOURCE_SMCLK, // SMCLK Clock Source CS_getSMCLK(), // Get SMCLK frequency 15000000, // SPICLK = 15 MHz EUSCI_B_SPI_MSB_FIRST, // MSB First EUSCI_B_SPI_PHASE_DATA_CHANGED_ONFIRST_CAPTURED_ON_NEXT, // Phase EUSCI_B_SPI_CLOCKPOLARITY_INACTIVITY_LOW, // Low polarity EUSCI_B_SPI_4PIN_UCxSTE_ACTIVE_HIGH // SPI Mode }; //EUSCI_B_SPI_4PIN_UCxSTE_ACTIVE_HIGH //EUSCI_B_SPI_4PIN_UCxSTE_ACTIVE_LOW SPI_initMaster(LCD_EUSCI_MODULE, &spiMasterConfig); SPI_enableModule(LCD_EUSCI_MODULE); SPI_clearInterruptFlag(LCD_EUSCI_MODULE, EUSCI_B_SPI_RECEIVE_INTERRUPT); The code i'm unsure about is: - GPIO_setAsPeripheralModuleFunctionOutputPin Should SCK, MOSI, MISO all be set as output or input? - EUSCI_B_SPI_CLOCKPOLARITY_INACTIVITY_LOW Not really sure what this means is it correct? - EUSCI_B_SPI_PHASE_DATA_CHANGED_ONFIRST_CAPTURED_ON_NEXT Not really sure what this means is it correct? -EUSCI_B_SPI_4PIN_UCxSTE_ACTIVE_HIGH Not really sure what this means is it correct? - SPI_clearInterruptFlag(LCD_EUSCI_MODULE, EUSCI_B_SPI_RECEIVE_INTERRUPT); I'm not using interrupts should I remove this line? Board: MSP432 Launchpad Datasheet: http://www.adafruit.com/datasheets/ILI9341.pdf
  21. Here's a heads-up for anyone that wants to use the external SPI flash memory on the SensorTag: it's not accessible while a debugger session is active. Unfortunately the pin on the SensorTag's CC2650 which outputs the SPI clock to the flash memory is also used as the JTAG TDI pin: While you're debugging using the Debug DevPack the CC2650 is unable to clock data out to the flash chip. That means the flash will just sit there doing nothing and the CC2650 will end up reading zeroes from the SPI bus. To use the flash you need to be certain that no JTAG communication is occurring during execution of your firmware. The easiest way to do this is just to disconnect the Debug DevPack and power the SensorTag from a coin cell or external power supply. Alternatively you can use the Debug DevPack to power the SensorTag, but then you have to follow this procedure: Load your updated firmware onto the SensorTag using the Debug DevPack (I just run it in the CCS debugger) Terminate the debug session once you reach the start of main() Disconnect the Debug DevPack from USB Detach the SensorTag from the DevPack Connect the Debug DevPack to USB Reattach the SensorTag to the Debug DevPack Be careful not to miss step 2, or the DevPack will resume JTAG communication when everything is connected up again. I found that out the hard way... Also, the order of the last two steps is to avoid an issue with powering up the Debug DevPack while it's connected to a SensorTag with no coin cell. The advantage of that is that you don't need a coin cell (I've drained two already...) This makes testing code that uses the flash really difficult, as there's no way to use the debugger. I've been using a combination of UART logging, LED flashes and beep codes from the onboard buzzer to keep track of where the code is up to. The other thing I'm doing is detecting whether the flash is available during startup and skipping the flash accesses if it's not there. That lets the rest of the code run in the debugger without problems. The command sequence I'm using to detect the flash is: Repeatedly send a Read Status Register command (0x05, 0x00) until the received BUSY flag is clear Send a Read Mode Reset command (0xFF, 0xFF) Send a Release From Power Down command sequence (0xAB, 0x00, 0x00, 0x00, 0x00) Flash is available if the device ID value 0x12 is received in the last byte of the Release From Power Down sequence This sequence is arranged to work irrespective of the state of the flash chip. If JTAG is active the code will immediately fall through step 1 (BUSY flag is zero), but the received device ID at step 4 will be zero too. Step 2 covers against any remote chance that the device has ended up in dual-SPI mode. Step 3 wakes the chip if it has been put in suspend, and returns the device ID regardless.
  22. Hi, I have connected two ADS1220 AD converters to LaunchPad MSP430F5529LP. First of all I needed to Chip select pins to manage the SPI communication so I updated some pin mapping. I also debugged that CS pins are working following my code. However I haven
  23. I'm back with another issue with my Stellaris LaunchPad. I have a short Energia sketch which uses the SPI library to write to the serial LCD on the ADS1118 Booster Pack. The sketch works as expected. The problem is that it somehow leaves the Stellaris in a state in which it cannot be flashed successfully by lm4flash. I have to connect the Stellaris LaunchPad, flash it (works fine the first time), disconnect the USB cable, reconnect, flash again, and so on. The symptoms seem to match what a TI employee posted on the E2E Community back in 2011, where changing the function of PORTC pins 0 to 3 would interfere with JTAG. However, I couldn't see where my Energia sketch or the SPI library would be doing anything to those PORTC pins. I'm using SPI.setModule(2) to select the Stellaris SPI module which is connected to the proper pins for this Booster Pack. If I flash another Energia sketch which does not use the SPI library, then I can flash over and over again with lm4flash without disconnecting and reconnecting the USB cable. Can someone point me to the problem? Here's what I see if I do the flashing from a MinGW command line: $ # TI Stellaris ICDI/JTAG/SWD Interface driver 2.0.7922.0 $ # Windows 7, 64-bit $ # Just plugged in the Stellaris LaunchPad $ /c/energia-0101E0015/hardware/tools/lm4f/bin/lm4flash.exe -V LM4Flash version 0.1.3 - Flasher for Stellaris Launchpad ICDI boards Copyright (C) 2012 Fabio Utzig <fabio@[member="utzig"].net> Copyright (C) 2012 Peter Stuge <peter@stuge.se> This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. $ /c/energia-0101E0015/hardware/tools/lm4f/bin/lm4flash.exe -v Stellaris_ADS1118_2.cpp.bin Found ICDI device with serial: 0E1011C2 ICDI version: 9270 $ # completed quickly, no problem, sketch is running OK $ /c/energia-0101E0015/hardware/tools/lm4f/bin/lm4flash.exe -v Stellaris_ADS1118_2.cpp.bin Found ICDI device with serial: 0E1011C2 ICDI version: 9270 [output stops here for several seconds, unplug USB cable] Error receiving data -9 Error transmitting data -9 Error transmitting data -9 Error transmitting data -9 Error transmitting data -9 Error transmitting data -9 Error transmitting data -9 Error transmitting data -9 Error transmitting data -9 Error transmitting data -9 Error transmitting data -9 Error transmitting data -9 Error transmitting data -9 Error transmitting data -9 Error transmitting data -9 Error transmitting data -9 Error transmitting data -9 Error transmitting data -9 Error transmitting data -9 Error transmitting data -9 Error transmitting data -9 Error verifying flash Error transmitting data -9
  24. I'm trying to combine some Energia libraries for the ADS1118 ADC and the SPI serial LCD included on the ADS1118 Booster Pack. Using simple digitalWrite() calls, I'm able to write to the LCD, but I'm trying to switch to using the Energia SPI library. The documentation for SPI.begin() says I can set a slave select pin; however, the compiler rejects a call to SPI.begin(LCD_CS) because there is no SPI.begin(int slaveSelectPin) defined. With the following code, the default pin 2 slave select appears to be used, because it happens to be connected to the buzzer on the ADS1118 Booster Pack, and I can hear it. Judging from the description, Energia commit 5c4dab5 seems to be aimed at fixing this, but it still doesn't work as expected. // Stellaris LaunchPad with ADS1118 Booster Pack #include <SPI.h> int LCD_RS = 12; // Register Select int LCD_CS = 13; // LCD chip select int ADC_CS = 8; // ADS1118 chip select int SI = 15; // Slave Serial data Input int SO = 14; // Slave Serial data Output int SCL = 7; // Serial data CLock int BUZZER = 2; // ADS1118 buzzer pin void setup() { Serial.begin(9600); Serial.println("# -+-+- RESET -+-+-"); // initialize the LCD pinMode(LCD_RS, OUTPUT); pinMode(SI, OUTPUT); pinMode(SO, INPUT); pinMode(SCL, OUTPUT); pinMode(LCD_CS, OUTPUT); delay(10); writecom(0x30); // wake up writecom(0x30); // wake up writecom(0x30); // wake up writecom(0x39); // function set writecom(0x14); // internal osc frequency writecom(0x70); // contrast writecom(0x56); // power control writecom(0x6D); // follower control delay(10); writecom(0x0C); // display on writecom(0x01); // clear delay(5); writecom(0x06); // entry mode delay(10); } void loop() { Serial.print("# loop "); lcdClear(); lcdPrint("Hello world!"); sleep(1000); } void lcdClear() { writecom(0x01); delay(5); } void lcdMoveTo(unsigned int x) { writecom(0x80 + (x & 0x7f)); delay(5); } void lcdPrint(char *s) { while(*s != 0) { lcdPrintChar(*s++); } } void lcdPrintChar(char c) { writedata(c); delay(1); } void writecom(int d) { SPI.begin(); // SPI.begin(LCD_CS) does not work SPI.setClockDivider(SPI_CLOCK_DIV128); digitalWrite(LCD_CS, LOW); digitalWrite(LCD_RS, LOW); // LOW = command SPI.transfer(d); digitalWrite(LCD_CS, HIGH); SPI.end(); // SPI.end(LCD_CS) does not work } void writedata(int d) { SPI.begin(); // SPI.begin(LCD_CS) does not work SPI.setClockDivider(SPI_CLOCK_DIV128); digitalWrite(LCD_CS, LOW); digitalWrite(LCD_RS, HIGH); // HIGH = data SPI.transfer(d); digitalWrite(LCD_CS, HIGH); SPI.end(); // SPI.end(LCD_CS) does not work }
  25. Dear All, I would appreciate some help from you here. I am using Energia v0101E0014 (v15) The uploaded picture shown my 3200LP jumper setting. The 3200LP is using SPI to talk to Cypress CY5FRAMKIT (http://www.cypress.com/?docID=52945) The Cypress kit is using its default 5V setting on jumper J5. So I connect P3.1 (5V) to feed the Cypress power. My Wiring for cc3200 is as below CC3200 Signal Name ---- ------- P1.7 SCLK P2.3 CS P2.6 MOSI P2.7 MISO P2.1 GND P3.1 5V However I can't read/write data to it. I was able to use the same kit in Arduino platform, so the kit is good. Q1: DO I need to anything special to the CC3200 default jumper setting in order to use the above SPI pin iterface? Q2: What is the CS pin number in Energia code if I use P2.3 as the CS ping? Is it number "8", "18" or ... ? Thanks in advance.