Jump to content
43oh

brelliott18

Members
  • Content Count

    18
  • Joined

  • Last visited

  • Days Won

    2

Posts posted by brelliott18

  1. I've noticed the same problem.  It's intermittent which makes it even more annoying.

    WINDOWS 10 is a disaster in other areas as well eg old Kindle software. I only got WINDOWS 10 because my Windows 7 machine decided to load itself with Windows 10 whilst the machine was unattended. Luckily I still have another system with Windows 7. I also have an XP system - Why this Operating system needed changing I do not know - Oh , yes I do - MONEY .

  2. SUCCESS !

    using Mods as above plus twi.c and twi.sw.c  from this link :-

    http://e2e.ti.com/support/development_tools/code_composer_studio/f/81/p/529036/1924562#1924562

    plus adding :-

     

    Wire.setModule (0)  before Wire.begin() in Void Setup() in both Master and Slave :-

    I have managed to send two characters from the Master to turn off the Red Led in a loop on the Slave.

     BIG Thanks again to B@TTO.

    Wouldn't it be perhaps a good idea if these files were updated and placed in the Energia GitHub Repository ?  How is this process carried out ?

     

     

     

     

     

     

  3. It appears the latest twi.c file from GITHUB  does NOT appear to  incorporate B@TTO modifications:- 

     

    This is my understanding of the mods required noted by  //********************

     

    Is this correct ? 

     

    [ If so , it would seem a good idea for ENERGIA to update this file, surely ?? - How does one get this to happen ? ]

     

    [ The other code needed is  to insert Wire.setModule(0)  before Wire.begin ,   so I'm told ]

     

     

    ****************LATEST  TWI.C   [  FROM LINE 839 ] ****************************

     

    /* Slave transmit mode (twi_state = TWI_STX) */

     }

    else {                  // ***** REPLACE WITH  else if  ( twi_state == TWI_STX ) {

     // copy data to output register

     UCBxTXBUF = twi_txBuffer[twi_txBufferIndex++];

     // if there is more to send, ack, otherwise nack

    if(twi_txBufferIndex < twi_txBufferLength){

     } else {

    UCBxCTL1 |= UCTXNACK; // Generate NACK condition }

     

    }

    // ************************PLUS ****************

    } else {

     

    if (twi_sendStop) {

     

    /* All done. Generate STOP condition and IDLE */

     

    UCBxCTL1 |= UCTXSTP;

    // *********************  ADD UCxIFG &=  ~ UCB0TXIFG ;

  4. Replaced files  - Makes no difference.

    Ran your program to return addresses of serial devices - after removing ' Wire.setModule(0) ' line which crashes it.

    The program returned a continuous stream of addresses from 0 to 127 -  Is this a sign that the MSP430 itself cannot act as slave because it doesn't recognise any addresses ( not even ' 0 ' ) , perhaps   ?

     

    Regards

  5. Thanks for the reply

    Yes, I have. The point is that identical code on the Arduinos works but not on MSP430s

     

    So either the delays need changing ?  - I'm using 3 seconds on the MASTER between begin and end transmissions and about 0.5 second on the SLAVE - I have changed these but it doesn't seem to a make any difference.

     OR  :  Perhaps  the Registers are  not being set up correctly but that's a pure guess.

     

    PS I can't the C language - I'd like to do everything in Forth in possible.

  6. Latest : Have used exactly the same code with ARDUINOs  UNO and NANO instead of 2 X  MSP430 2553  [ used Version 17 of Energia for MSP devices  ].......

    ..............The code WORKS on these ARDUINO  devices !!!

      [  I simply send 'H' and ' L' chars to turn LED on / off using Wire.begin then Wire.beginTransmission then Wire.endTransmission plus delays for MASTER .

    For SLAVE ( another MSP430 2553 ) I use  Wire.onReceive( receiveEvent) then VOID receiveEvent ( int howMany) then ' while Wire.available  and Wire.Read '  etc. ]

    Use 4K7 pull ups on p1.7 , P1.6 plus   Common Ground.

    I assume, perhaps, that  the Registers are not being Set up properly ? - Have also noticed that there are NO examples on YouTube as opposed to the ARDUINO.

    Has anyone ever managed to connect 2 MSP430 via I2C , I wonder ?

     

     

     

     

     

     

     

     

     

     

  7. Hi @@brelliott18,

     

    There are some known problems with i2c on 2553 Launchpads, mentioned in various posts over this forum.

    One of them is mentioned in http://forum.43oh.com/topic/2641-i2c-lcd/page-2#entry75927; in this post is also a link to a solution http://e2e.ti.com/support/development_tools/code_composer_studio/f/81/p/529036/1924562#1924562

     

    Have you already seen this posts? Have you tried the solutions presented in them?

     

    Regards,

    Liviu

     

    Thanks for the advice. Have inserted ' Wire.setModule(0) as suggested - This just seems to prevent begin and end transmission loops working altogether. One problem seems to be waveforms coming from SDA / SCL - either not present or very noisy.

  8. Trying to use I2C to connect 2 X MSP430.

     

    Using Wire.write ('H') and 'L ' char to send to Slave via 4K7 pull-ups to turn on / off slave led.

     

     Using Wire.onReceive(receiveEvent) , void receiveEvent ( int howMany )   etc.

     

    Have added delays at various places.

     

    Have programmed then removed PC connections, use separate PSU

     

    ReceiveEvent appears not to work.

     

    Have old analogue scope - clock /data signals appear to be ' very dirty ' and ' noisy '

     

    Change to 10K pull ups ?  Any suggestions ?  Thanks

  9. This is part of the Arduino code I found for keypads [ keyboard.h ].  How should ths be altered [ if necessary ] to run on the MSP430G2553 ?

     

    Assuming I use p1.0 to p1.7  ??? for the 8 wires coming from the keypad [ 4 X 4 ]

     

    #define INPUT_PULLUP  0x2   - does this need changing ?

     

     

     

     

    #ifndef INPUT_PULLUP

    #warning "Using  pinMode() INPUT_PULLUP AVR emulation"

    #define INPUT_PULLUP 0x2

    #define pinMode(_pin, _mode) _mypinMode(_pin, _mode)

    #define _mypinMode(_pin, _mode)  \

    do {                                      \

          if(_mode == INPUT_PULLUP)     \

                pinMode(_pin, INPUT);   \

                digitalWrite(_pin, 1);  \

          if(_mode != INPUT_PULLUP)     \

                pinMode(_pin, _mode);   \

    }while(0)

    #endif

     

     

    #define OPEN LOW

    #define CLOSED HIGH

     

    typedef char KeypadEvent;

    typedef unsigned int uint;

    typedef unsigned long ulong;

     

    typedef struct {

        byte rows;

        byte columns;

    } KeypadSize;

     

    #define LIST_MAX 10           // Max number of keys on the active list.

    #define MAPSIZE 10            // MAPSIZE is the number of rows (times 16 columns)

    #define makeKeymap(x) ((char*)x)

     

     

    //class Keypad : public Key, public HAL_obj {

    class Keypad : public Key {

    public:

     

          Keypad(char *userKeymap, byte *row, byte *col, byte numRows, byte numCols);

     

          virtual void pin_mode(byte pinNum, byte mode) { pinMode(pinNum, mode); }

          virtual void pin_write(byte pinNum, boolean level) { digitalWrite(pinNum, level); }

          virtual int  pin_read(byte pinNum) { return digitalRead(pinNum); }

     

          uint bitMap[MAPSIZE];   // 10 row x 16 column array of bits. Except Due which has 32 columns.

          Key key[list_MAX];

          unsigned long holdTimer;

     

          char getKey();

          bool getKeys();

          KeyState getState();

          void begin(char *userKeymap);

          bool isPressed(char keyChar);

          void setDebounceTime(uint);

          void setHoldTime(uint);

          void addEventListener(void (*listener)(char));

          int findInList(char keyChar);

          int findInList(int keyCode);

          char waitForKey();

          bool keyStateChanged();

          byte numKeys();

     

    private:

          unsigned long startTime;

          char *keymap;

        byte *rowPins;

        byte *columnPins;

          KeypadSize sizeKpd;

          uint debounceTime;

          uint holdTime;

          bool single_key;

     

          void scanKeys();

          bool updateList();

          void nextKeyState(byte n, boolean button);

          void transitionTo(byte n, KeyState nextState);

          void (*keypadEventListener)(char);

    };

     

    #endif

  10. I have recently bought a LaunchPad 2553. I am a comparitive novice.

     

    I am trying to add a  4 X 4 matrix keypad.  I copied some code from an Arduino source and changed #Arduino references to #Energia. I commented out a  #WProgram statement - what is this ?

     

    The code compiled and verified OK .  I connected the 8 wires from keypad  to p1.0 -p1.7 [ and tried other ports as well ].

     

    The output was sent to the Serial monitor via Serial.println( key ).  I could only get any output by pressing many keys at the same time.

     

    I looked at the keyboard.h  file but it went nothing to me.  How do the DigitalReads get initiated ?

     

     [ Serial.println ("hello world " ) worked so the program does get to the right place  ]

     

    Any suggestions please  - pointers to existing code snippets - I can't fine any . Thanks

×
×
  • Create New...