Rei Vilo 695 Posted April 11, 2014 Share Posted April 11, 2014 I've tested Wire and Wire1 with a HMC6352 and everything runs fine. Only remains the #include "Energia.h" statement that should remain automatic. Quote Link to post Share on other sites
OzGrant 22 Posted June 22, 2014 Share Posted June 22, 2014 G'day Alf, Before I start talking about my error just want to make sure my steps are correct. 1. Replaced WIRE.H/CPP in ..cores\msp430 with your one 2. Deleted TWI,C/H in ..cores\msp430 3. Replaced PINS_ENERGIA.H in ..variants\Launchpad_f5529 with your one After using your test sketch I get the following error core.a(usci_isr_handler.c.o): In function `USCIB0_ISR':C:\TI\energia-0101E0012\hardware\msp430\cores\msp430/usci_isr_handler.c:55: multiple definition of `__isr_55'core.a(Wire.cpp.o):Wire.cpp:(.text._Z10USCIB0_ISRv+0x0): first defined herecollect2: ld returned 1 exit status I then reinstated twi.c/h but got the same error. Any ideas. Grant Quote Link to post Share on other sites
OzGrant 22 Posted June 23, 2014 Share Posted June 23, 2014 oops, I didn't replace ..cores/msp430/usci_isr_handler.c/h So now compiles without errors. Grant Quote Link to post Share on other sites
OzGrant 22 Posted June 23, 2014 Share Posted June 23, 2014 Not out of the bushes yet, As soon as I add #include <RTClib.h> I get following errors: In file included from C:\Users\Grant\Documents\Energia\libraries\rtclib_master\RTClib.cpp:8:0:C:\TI\energia-0101E0012\hardware\msp430\cores\msp430/Wire.h:36:2: error: #error "********** USI not available"C:\TI\energia-0101E0012\hardware\msp430\cores\msp430/Wire.h:40:2: error: #error "********** USCI not available" Any ideas. Quote Link to post Share on other sites
energia 485 Posted June 23, 2014 Share Posted June 23, 2014 You are probably missing !defined (__MSP430_HAS_USCI_B1__) in twi.h on line 34 and 39. Quote Link to post Share on other sites
w2sqr 0 Posted June 27, 2014 Share Posted June 27, 2014 Thanks Hogemark! I've just hit this same problem with my project and after replacing the standard libraries with your code my I2C ports are working correctly :-) Quote Link to post Share on other sites
hogemark 5 Posted June 29, 2014 Author Share Posted June 29, 2014 Not out of the bushes yet, As soon as I add #include <RTClib.h> I get following errors: In file included from C:\Users\Grant\Documents\Energia\libraries\rtclib_master\RTClib.cpp:8:0: C:\TI\energia-0101E0012\hardware\msp430\cores\msp430/Wire.h:36:2: error: #error "********** USI not available" C:\TI\energia-0101E0012\hardware\msp430\cores\msp430/Wire.h:40:2: error: #error "********** USCI not available" Any ideas. Hi I think you need to add the #include "Energia.h" at the top of your sketch, as mentioned in my previos post 10. April 2014, and confirmed 11. April 2014. Regards Alf Quote Link to post Share on other sites
hogemark 5 Posted June 29, 2014 Author Share Posted June 29, 2014 Thanks Hogemark!I've just hit this same problem with my project and after replacing the standard libraries with your code my I2C ports are working correctly :-) Thanks, I've made a git pull request for this now, to get the process started to get the code incorporated into the official build, https://github.com/energia/Energia/pull/398 Regards Alf Quote Link to post Share on other sites
JoeT123 0 Posted December 5, 2014 Share Posted December 5, 2014 Hi there Firstly, thanks for all the hard work opening up the second i2c bus! I am having running into the following error as I try to compile the example code that alf posted previously. Copy\hardware\msp430\libraries\Wire\utility\twi.c:25:20: fatal error: avr/io.h: No such file or directorycompilation terminated. This is Using energia 0101E0013 and following replacement of all of the .c and .h files that OzGrant mentions in his posts on page 1 - I would really, really appreciate any help with this. Quote Link to post Share on other sites
hogemark 5 Posted March 30, 2015 Author Share Posted March 30, 2015 Hi again. I've now made a new pull request, I think it is simpler, so it should be more likely to be merged into Energia. https://github.com/energia/Energia/pull/590 With this pull request, you cannot use both modules at the same time, you have to choose which one to use. So if you want to use I2C(1), i.e. USCI_B1, then do : Wire.setModule(1); Wire.begin(); If you want to use I2C(0), just do as you always have : Wire.begin(); Regards Alf Hogemark chicken 1 Quote Link to post Share on other sites
RobLewis 7 Posted April 18, 2015 Share Posted April 18, 2015 I confess I'm not deep into the issues involved in this, but is there a prospect of eventually being able to use both I2C interfaces at the same time? And just to confirm, if I don't call setModule then I'll get the "legacy" pin assignments of P3.0 and P3.1? Quote Link to post Share on other sites
hogemark 5 Posted April 20, 2015 Author Share Posted April 20, 2015 Yes, the default is to use "module 0", so if you do not call "setModule", you will use USCI_B0, and the pins you have been using until now. Being able to use both modules at the same time requires more code changes, so I want to try the approach to get support for choosing either module first, and then proceed to add support for both modules at the same time. Regards Alf Fmilburn 1 Quote Link to post Share on other sites
gato 0 Posted June 29, 2015 Share Posted June 29, 2015 I didn't find a particular post on the branch https://github.com/alfh/Energia/tree/feature_spi_choose_module by alf, but the issue is similar so I will make a few comments here. On first test it didn't work . I checked a simple spi transfer example with SPI.setModule(1), and MOSI and STE lines had sensible traces on the oscilloscope. CLK trace didn't (it was flat). after debugging the sketch with ccs6, I suspected port 4 was not being properly initialized, and decided to change usci_spi.cpp, line 101-105: if(module == 1) { /*pinMode_int(SCK1, SPISCK_SET_MODE1); pinMode_int(MOSI1, SPIMOSI_SET_MODE1); pinMode_int(MISO1, SPIMISO_SET_MODE1);*/ P4SEL |= BIT1+BIT2; // P4.1,4.2 option select P4SEL |= BIT3; // P4.3 option select } and that did the work. I didn't check the pinMode_int code to see what was wrong.I haven't worked with github, so I didn't know how to suggest the modification there. By the way, the target motivation was to use Rei Vilo's SDTM4C sd library with USCI B1 (MSP430F5529), which I accomplished after adding SPI_for_SD.setModule(1); before SPI_for_SD.begin(); at Sd2Card.cpp, line 286 The library now works correctly,except for commands like ls(), which make extensive use of Serial (I'm currently using USBSerial). Hope this helps someone! Quote Link to post Share on other sites
hatman07 0 Posted August 4, 2015 Share Posted August 4, 2015 Nice job by hogemark on work so far; this capability really needs to be native to Energia. My goal is to use MSP430F5529 USCI_B1 as an I2c slave and USCI_B0 as a SPI master. I have code based on pull request 590 working fine as I2C master, but doesn't succeed as I2C slave. Guessing this is something in the guts of the function as the onRequest() function isn't dependent on which module is being used. Probably an issue with interrupts not enabled for the module. I'm going to dig in twi.c and post results back here. Any suggestions are appreciated. Quote Link to post Share on other sites
OzGrant 22 Posted August 21, 2015 Share Posted August 21, 2015 G'day, Is there a simple way of finding out what bugs have been fixed in the next version on Energia? Github tells you a few. E,g, for the case of Wire.setModule(1), that's not supported in E16. and will start the modification used to get E14 to perform OK. But there maybe other fixes in the E16 H/C files that will be lost by replacing Wire.H/CPP, that was suitable(and tested) for E14, Grant Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.