Jump to content


  • Content Count

  • Joined

  • Last visited

  • Days Won


moderboy last won the day on January 3 2012

moderboy had the most liked content!

About moderboy

  • Rank
  • Birthday 11/30/1987

Profile Information

  • Location
    Hungary, Central Europe
  1. That will be Wire.setModule() what you are searcing. Anyhow i have downloaded your files, fired up the test code attached, selected my chosen Wire.module and it works nice. Havent looked in the code yet, but thanks for it!
  2. 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.
  3. Okay, just found that i have to include SPI.h in my sketch also. http://forum.arduino.cc/index.php?topic=45232.0
  4. Hey! Im trying to slap together a library for the microchip mcp23s17 io expander. Ive wrote the functions and wanted try out my creation, but when i verify my code i get error like I did not included SPI.h, but i did. mcp_lib\MCP23S17.cpp.o: In function `mcp23s17::gpioRegisterWriteByte(unsigned char, unsigned char, bool)': MCP23S17.cpp:(.text._ZN8mcp23s1721gpioRegisterWriteByteEhhb+0x8): undefined reference to `SPIClass::transfer(unsigned char)' MCP23S17.cpp:(.text._ZN8mcp23s1721gpioRegisterWriteByteEhhb+0x10): undefined reference to `SPIClass::transfer(unsigned char)' MCP23S17.cpp:(.text._ZN8mcp23s1721gpioRegisterWriteByteEhhb+0x20): undefined reference to `SPI' MCP23S17.cpp:(.text._ZN8mcp23s1721gpioRegisterWriteByteEhhb+0x1c): undefined reference to `SPIClass::transfer(unsigned char)' mcp_lib\MCP23S17.cpp.o: In function `mcp23s17::begin(unsigned char, unsigned char, unsigned char)': MCP23S17.cpp:(.text._ZN8mcp23s175beginEhhh+0x46): undefined reference to `SPIClass::setModule(unsigned char)' MCP23S17.cpp:(.text._ZN8mcp23s175beginEhhh+0x4c): undefined reference to `SPIClass::begin()' MCP23S17.cpp:(.text._ZN8mcp23s175beginEhhh+0x54): undefined reference to `SPIClass::setBitOrder(unsigned char)' MCP23S17.cpp:(.text._ZN8mcp23s175beginEhhh+0x5c): undefined reference to `SPIClass::setDataMode(unsigned char)' MCP23S17.cpp:(.text._ZN8mcp23s175beginEhhh+0x8c): undefined reference to `SPI' Also im not a guru of writing libs, but i wanted to create one that can be used for more than one IC, like the Serials. heres my code: #include "Energia.h" #include <stdio.h> #include <inttypes.h> #include <C:\Users\hp\Desktop\energia-0101E0017\hardware\lm4f\libraries\SPI\SPI.h> #include "MCP23S17.h" mcp23s17::mcp23s17(){ } void mcp23s17::begin(const uint8_t csPin, const uint8_t haenAdrs, byte spi_module){ _cs = csPin; _adrs = haenAdrs; _readCmd = (haenAdrs << 1) | 1; _writeCmd = haenAdrs << 1; _module = spi_module; IOCON = 0x0A; IODIR = 0x00; GPPU = 0x0C; GPIO = 0x12; GPINTEN = 0x04; IPOL = 0x02; DEFVAL = 0x06; INTF = 0x0E; INTCAP = 0x10; OLAT = 0x14; INTCON = 0x08; SPI.setModule(_module); SPI.begin(); SPI.setBitOrder(MSBFIRST); SPI.setDataMode(SPI_MODE0); pinMode(_cs, OUTPUT); digitalWrite(_cs, HIGH); delay(100); gpioRegisterWriteByte(IOCON, 0b00101000); _gpioDirection = 0xFFFF; _gpioState = 0xFFFF; } void mcp23s17::gpioPinMode(uint16_t mode){ if (mode == INPUT){ _gpioDirection = 0xFFFF; } else if (mode == OUTPUT){ _gpioDirection = 0x0000; _gpioState = 0x0000; } else { _gpioDirection = mode; } gpioRegisterWriteWord(IODIR, _gpioDirection); } void mcp23s17::gpioPinMode(uint8_t pin, bool mode){ if (pin < 16){ mode == INPUT ? _gpioDirection |= (1 << pin) : _gpioDirection &= ~(1 << pin); gpioRegisterWriteWord(IODIR, _gpioDirection); } } void mcp23s17::gpioWritePort(uint16_t value){ if (value == HIGH){ _gpioState = 0xFFFF; } else if (value == LOW){ _gpioState = 0x0000; } else { _gpioState = value; } gpioRegisterWriteWord(GPIO, _gpioState); } void mcp23s17::gpioWritePort(byte lowByte, byte highByte){ _gpioState = highByte | (lowByte << 8); gpioRegisterWriteWord(GPIO, _gpioState); } uint16_t mcp23s17::gpioReadPort(){ return gpioRegisterReadWord(GPIO); } void mcp23s17::gpioDigitalWrite(uint8_t pin, bool value){ if (pin < 16){ value == HIGH ? _gpioState |= (1 << pin) : _gpioState &= ~(1 << pin); gpioRegisterWriteWord(GPIO, _gpioState); } } int mcp23s17::gpioDigitalRead(uint8_t pin){ if (pin < 16) return (int)(gpioRegisterReadWord(GPIO) & 1 << pin); return 0; } uint8_t mcp23s17::gpioRegisterReadByte(byte reg){ uint8_t data = 0; SPI.transfer(reg); data = SPI.transfer(0); return data; } uint16_t mcp23s17::gpioRegisterReadWord(byte reg){ uint16_t data = 0; SPI.transfer(reg); data = SPI.transfer(0); data = SPI.transfer(0) << 8; return data; } void mcp23s17::gpioRegisterWriteByte(byte reg, byte data, bool both){ if (!both){ SPI.transfer(reg); SPI.transfer(data); } else { SPI.transfer(reg); SPI.transfer(data); SPI.transfer(data); } } void mcp23s17::gpioRegisterWriteWord(byte reg, word data){ SPI.transfer(reg); SPI.transfer(data >> 8); SPI.transfer(data & 0xFF); } void mcp23s17::gpioPortPullup(uint16_t data){ if (data == HIGH){ _gpioState = 0xFFFF; } else if (data == LOW){ _gpioState = 0x0000; } else { _gpioState = data; } gpioRegisterWriteWord(GPPU, _gpioState); } void mcp23s17::startSend(bool mode){ digitalWrite(_cs, LOW); mode == 1 ? SPI.transfer(_readCmd) : SPI.transfer(_writeCmd); } void mcp23s17::endSend(){ digitalWrite(_cs, HIGH); } please dont hustle checking the functions, i know they have some bugs, I just want to know how to move forward with this SPI problem and what do i need to write further to be able to call this for multiple expanders. Also i tried SPI.h, "SPI.h" <SPI.h>, but only the concrete location worked when including, why? Is there a detailed how to on making libraries this depth anywhere? I couldnt find any. Thanks!
  5. Wanna participate Also anybody knows about an MSP430 based parts tester? (transistros, FET, etc...)
  6. Is there any solution to use this code with DS18S20 sensors?
  7. Anybody used yet the built in DAC in 430F5638? I tried to make it alive with the driver from TI driver package but I've failed. The driver itself was built succesfull and ran, but setting the register of the output level did nothing. And how about the built in USB connection? Is it easy to use or painfull to get it working?
  8. Problem solved! The radio caused the overheating... Theres a pin called R_BIAS, which determines the output power of the RF module (as far as I understood the datasheet), but I cant managed to find a formula in the documents how is it calculated... But it seems like if its not "floating" everythings fine So another chip on the list of which can be programmed with the LP 8-)
  9. Every device can be programmed with it which contains a spy-bi-wire block, it can be seen in the block diagramm. Long story short currently supported: Value line, Series 2, Series 5, but check your chosen, not all cjips have SBW, but many
  10. Only tried it with one chip, nothing happened just heating like without it... But Avcc and Avss is needed to programming be possible? :roll:
  11. Hy! So I'm trying to program different higher series chips with my launchpad and I was succesfull with F2274, F5508 but no luck with CC430F5137... Here's the problem: I connected Dvcc (there is 3 of it) and Dvss to the launchpad, RST and TEST. At first i started the debugging in CCS it recognized the chip then gave an error that it's cannot be written... when I unplugged it, it was damn hot :crazy: I thought I did something wrong, short circuit or anything, replaced the chip and double checked my break-out-board. Now with the new chip same problem, when I plugged it into the supply on LP it started to get hot, not tried to program this one, unplugged instantly. Questions: Do I have to apply voltage separately to VCORE? (datasheet says nothing about it, though 2274 said it's voltage output wich can't be loaded) What did I did wrong?
  12. Succesfully programmed MSP430F5508 and MSP430F2274 today with the launchpad! :clap:
  13. This and the capsense module combined would be an awesome media controller :mrgreen:
  14. Thanks for the answers! I think than the RESET and other legs are for debugging.
  • Create New...