Jump to content

Leaderboard


Popular Content

Showing content with the highest reputation since 01/19/19 in all areas

  1. 3 points
    petertux

    USB to gameport project

    If you appreciate late 90s vintage PCs you might be interested in this one. I decided to build a Pentium II machine on which I can play my favourite games from those times. Magic Carpet (Bullfrog Productions) is one of them, but it needs a joystick. I had good quality USB joysticks, but those games need old analog gameport-based controllers that are serviced by the sound cards of the time. This new project acts as a USB Host and provides the analog output that emulates a 4 axis + 4 button game controller. the prototype works absolutely great, it takes about 0.6ms to read data from the attached USB joystick and to send it to the sound card. data is retrieved every 10ms as per the HID polling interval, absolutely no input command is lost and there is over-current protection built in in order to protect the PC from misuse. what do you guys think? I'm open to ideas regarding this project before I commit revision 2 of the board - which might end up being a 4 layer design. prototype pictures: https://photos.app.goo.gl/fXdDBng4dvEepq8V7 repo: https://cadlab.io/projects/lemidi cheers, peter
  2. 2 points
    I still do not understand why corrections have still not been made for this chip. As I needed these corrections, I had to do them myself although I am not a specialist on this subject. So I modified the necessary files to have access to all the pins of the MSP430FR5994, even those which are not cabled on the Launchpad, in order to be able to use them on my own cards. I enclose the modified files as well as the positions in the folders, to help the users facing the same problems as me. It would be desirable for the Energia team to finally address these issues and include these changes in a forthcoming release. Indeed this chip is perfect to make very good low consumption modules , and the ENERGIA concept makes it easy to develop the complementary software CORRECTED_BUGS.zip
  3. 2 points
    bluehash

    Server

    Certificate fixed. Thanks.
  4. 2 points
    My Lisp interpreter for microcontrollers, uLisp, now supports the MSP430 FR6989 LaunchPad board, with the ability to write text to the LCD display from Lisp programs: For more information see uLisp for the MSP430 FR6989 LaunchPad.
  5. 1 point
    When using the latest version of Energia the wire (I2C) has now the function setClock to set to 400k use setClock(400000UL);
  6. 1 point
    Interesting. My experience with both IAR and CCS is that they refuse to load images to a device when it's different than what the project specifies and they both clearly report it as an error.
  7. 1 point
    Rei Vilo

    RED_LED and GREEN_LED work opposite

    Yes, this is a bug, sorry a feature of the MSP-EXP430G2ET!
  8. 1 point
    The goal of this project is to utilize an MSP430 to allow existing remote-controlled outlets to by controlled over Wi-Fi. As purchased, the outlets can be controlled with a provided remote control which uses 434 MHz radio signals. By programing the MSP430 to replicate the signals from this remote and hosting a web page with controls on the MSP430, the outlets can be able to be controlled from anywhere on the same Wi-Fi network. The completed project provides a web page that can both control each of three outlets individually or all three at once. This is done using an MSP430 as a controller with a 434MHz transmitter sending commands to the outlets, and an ESP 8266 Wi-Fi module connecting to the network. A schematic of the completed project is shown in Fig. 1, and a photo of the completed project is shown in Fig. 2. With this set up the outlets can be reliably controlled from anywhere on the same Wi-Fi network. The components required for this project, along with the equipment necessary are listed below. All the components can be purchased for less than $30. I was able to write an interface to control the outlets, as well as serve a webpage to control the outlets. This was the final project for my Embedded Systems class at John Brown University. more details are avalible in the attached file. Parts list: · TI MSP430G2553 Launchpad · 434 MHz RF transmitter https://www.sparkfun.com/products/10534 · ESP8266 wifi module · Syantek Remote Controlled Outlets https://www.amazon.com/Syantek-Electrical-Household-Appliances-Expandable/dp/B07JF93XB5 · Breadboard · Jumper cables · USB power supply Equipment · 434 MHz RF receiver https://www.sparkfun.com/products/10532 · Digilent Analog Discovery Module · Code Composer Studio · Serial to USB converter Light_Switch_Final_Report.docx
  9. 1 point
    energia

    Interrupts for TM4C123GXL

    I posted a library a while ago which could be of use. It can be found here: https://github.com/energia-libraries/RotaryEncoder
  10. 1 point
    bluehash

    Updates

    A few updates and notes: The forum is finally able to connect to the license server. It failed due to an older version of curl, which caused alot of spam posts. PHP updated to the latest version Forums upped to 4.4.7 Any issues, please note them here. I'll try to sort things out. Thank you!
  11. 1 point
    Hi Geometrikal, Hi TL The portage works perfectly, it is only necessary to put the good chip select for the Launchpad as well as to specify the good bus SPI in the file Jaffl.cpp in the routine SPI_INIT. For the applications which I use I tested at the same time the competition between the SPI bus (0) which manages the SD card and the SPI bus (1) which manages another device. I enclose all the necessary sources to test on a Launchpad MSP430FR5994. For my work I use Visual Studio 2019 with the Visual Micro plugin. I can compile for Arduino (Arduino,ESP8266,ESP32,ST) and Energia families in an efficient way. Jaffs_MSP5994.zip
  12. 1 point
    (I started this [Energia Library] topic and copied my spiE library over to make it easier to find) I wanted to improve the compatibility of the SPI.h lm4f library to include functions of arduino user contributed SPI.h libraries. I found SPI2.h here: http://forum.stellar...two-spi-modules. This library added multi-module features but removed the 123 & 1294 compatibility. I have merged SPI2 and the core SPI libs into spiE.h and added several more function variations. spiE.h best features are: 1. Array transfer up to 255 bytes. This is 5x faster than single byte transfer. 2. SPI2's pinMode() and digitalWrire() functions are replaced with faster macros. 3. Support for __TM4C129XNCZAD__, __TM4C1294NCPDT__, BLIZZARD_RB1 (LM4F) boards 4. Up to 4 instances can be defined: SPI0, SPI1, SPI3, & SPI2 is instantiated by default as SPI for arduino code compatibility. 5. Multiple SlaveSelect pins can be used fir multiple devices on one data line. defaultSS, default +SS2, or SS1 + SS2, etc. I have tested this on the 129. If you have a need for it and can try it on the other boards before I upload it to github, be my guest. spiE.zip
  13. 1 point
    Rei Vilo

    Best way change I2C freq to 400kHz

    Please refer to Wire.cpp#L121-L123 I2C_Params_init(&params); params.transferMode = I2C_MODE_BLOCKING; params.bitRate = I2C_400kHz;
  14. 1 point
    HI ! No MQTT with AT commands on ESP6266 IMHO !! (among the several AT firmwares I know) You can use Arduino IDE (+ ESP8266 core) to flash your ESP-01 with your own application receiving data through UART and publishing data to an MQTT broker (use pubsub library) (WEMOS D1 mini is a good alternative to ESP-01 with it's good 3V3 regulator, some passive components, USB interface for easy developping...)
  15. 1 point
    Rei Vilo

    MSP low power configuration

    Please refer to Ultra-Low Power with MSP430 at https://embeddedcomputing.weebly.com/ultra-low-power-with-msp430.html Ultra-Low Power with Energia MT and Galaxia at https://embeddedcomputing.weebly.com/ultra-low-power-with-energia-mt-and-galaxia.html The MSP432P401R LaunchPad programmer features EnergyTrace to be used with Code Composer Studio. Ultra-Low Power with EnergyTrace at https://embeddedcomputing.weebly.com/ultra-low-power-with-energytrace.html
  16. 1 point
    energia

    CC1312R1 Energia

    Not yet but will be soon.
  17. 1 point
    Rei Vilo

    CC1312R1 Energia

    Not yet, stay tuned!
  18. 1 point
    StefanSch

    MSP430G2 no communication

    To solve the UART issue go to the pins_energia.h file for the selected device MSP-EXP430G2452LP and try to update / modify this lines: static const uint8_t DEBUG_UARTRXD = 4; /* Receive Data (RXD) at P1.2 */ static const uint8_t DEBUG_UARTTXD = 3; /* Transmit Data (TXD) at P1.1 */ This seems to be wrong in the current version but i have no idea why this worked before as i could not find an update where this has been changed. To solve the issue with I2C you need to select the other I2C interface with setModule(0); The default mapping of the I2C interface to the pins 8 and 9 change a while ago but with the setModule you still can select the other I2C interface if available.
  19. 1 point
    NurseBob

    MSP430G2 no communication

    You've described the problem, but supplied no information to allow remote diagnosis. Without a schematic and related code, there's really no way to help, aside from the most general suggestions regarding jumpers, pins and I2C pullup resistors, all of which you've likely read (and hopefully applied). Finally, you mention migrating an existing project; did you have that working, and if so, under what version of Energia? Re: UART - there may be no hardware UART on your chip. "If your Launchpad is version 1.4 or earlier, the chips that it shipped with have no hardware UART and thus, no hardware configuration is necessary, but you must use the SoftwareSerial library included in Energia to communicate over the serial port." You indicate you have an MSP430G2452, according to SLAU318G, there is only USI availble on that chip, the UART is on the G2553's USCI impementation.
  20. 1 point
    StefanSch

    Blink example too slow

    this issue got already fixed a while ago - unfortunately the fix did not get merged into the master branch. Just did the update there so it will go into the next release. Meanwhile you can fix this locally with patching the wiring.c file. In the function InitClock update the first lines to: void initClocks(void) { #ifdef __MSP430_HAS_BC2__ #if (defined(CAL_BC1_16MHZ) || defined(CALDCO_16MHZ_)) && F_CPU >= 16000000L BCSCTL1 = CALBC1_16MHZ; DCOCTL = CALDCO_16MHZ; #elif (defined(CAL_BC1_12MHZ) || defined(CALDCO_12MHZ_)) && (F_CPU >= 12000000L) BCSCTL1 = CALBC1_12MHZ; DCOCTL = CALDCO_12MHZ; #elif (defined(CAL_BC1_8MHZ) || defined(CALDCO_8MHZ_)) && (F_CPU >= 8000000L) BCSCTL1 = CALBC1_8MHZ; DCOCTL = CALDCO_8MHZ; #elif (defined(CAL_BC1_1MHZ) || defined(CALDCO_1MHZ_)) && (F_CPU >= 1000000L) BCSCTL1 = CALBC1_1MHZ; DCOCTL = CALDCO_1MHZ; #else #warning No Suitable Frequency found! #endif #endif
  21. 1 point
    Hi, I wrote an article (in Portuguese) about how to use the SD16 ADC of MSP43F2013, and to show one practical application I transformed the MSP430F2013 in an I2C 16-bit ADC, similar to ADS1115. In the example, I read the data using one Arduino Nano. Comparing the conversion of SD16 and ADS1115: More details about the project can be found in my Github: https://github.com/agaelema/msp430f20x3_as_i2c_16bit_adc The project is open to further improvements/optimizations and functions.
  22. 1 point
    chicken

    [POTM] dAISy - A Simple AIS Receiver

    Hi Varnak, The dAISy software does change the channel every so often. The code for switching between the channels start at line 329 in packet_handler.c https://github.com/astuder/dAISy/blob/master/packet_handler.c#L329 The receiver will switch to the other channel when the state is PH_RESET, which is the case after an error, successful message, or when there is no start of message within PH_SYNC_TIMEOUT (defined in line 27) clock ticks (one tick being 1/9600 second). Statistically, it will miss at least 50% of the message as it can only listen on one channel at a time. Regards, Adrian
  23. 1 point
    Varnak

    [POTM] dAISy - A Simple AIS Receiver

    Hi Adrian! I was in St. Petersburg, recorded the AIS broadcast and was surprised when I played it on the second frequency 162.025 at home ... it works too!))) But WDS is set to 161.975. Do you programmatically switch channels by RSSI level and after what time? If you can tell me where in the program it is. I'm not a programmer at all. Here's a video of how your dAISy looks at me)) 20190428_184322.mp4
  24. 1 point
    p.s. you should use the first Sketch you posted. Also make sure that the master is setup to talk to the right address you specify in the Wire.begin(addr) call.
  25. 1 point
    chicken

    [POTM] dAISy - A Simple AIS Receiver

    FYI: dAISy works in Direct RX mode. Unfortunately, the built-in packet handler of the radio IC does not work with AIS.
  26. 1 point
    chicken

    [POTM] dAISy - A Simple AIS Receiver

    Hi Varnak, I just pushed a configuration file for WDS 3.2.11 that I had laying around. I haven't tested it, so not sure if it works as is. https://github.com/astuder/dAISy/blob/master/WDS3211_si4362_revb1_direct_rx.xml Best Regards, Adrian
  27. 1 point
    RobG

    Graphics Library for MSP432

    As long as it's the SPI verison, it will. If it's parallel, you will need have make updates to the code.
  28. 1 point
    Rei Vilo

    Simple Radio Library for CC1310

    The CC1310 LaunchPad has a sub-1 GHz radio. On Energia, Install the EasyLink library by calling the menu Sketch > Include Library > Manage Libraries..., then select EasyLink and click Install. Select the board CC1310 LaunchPad. Call the menu File > Example > EasyLink > EasyLinkTX for the transmitter example. Call the menu File > Example > EasyLink > EasyLinkRX for the receiver example. Both examples work together. Obviously, you need two CC1310 LaunchPad boards!
  29. 1 point
    chicken

    [POTM] dAISy - A Simple AIS Receiver

    Hi Ross, The best solution depends on what you want to achieve. If you want to build a chartplotter, then OpenPlotter or a standalone setup of OpenCPN would be a viable approach. Both will require a RPI 3 as the GUI of OpenCPN ps For OpenPlotter, I recommend the 1.0 image and not their latest alpha, unless you know what you're doing. For standalone OpenCPN, this tutorial worked for me. If you only want to track ships and may report to a website, then AISHub's rPiAIS is the quickest way to get up and running. More DIY alternatives are Kplex (which OpenPlotter uses under the hood) or some form of home-brew Python script. ais-forwarder to send received AIS messages over the network simpleAIS to decode AIS messages in your Python project You will find more AIS related projects under my Github stars. Best Regards, Adrian
  30. 1 point
    It was important to be sure, as the standard uploader DSLite doesn't work on macOS 10.14 but used to work on macOS 10.13. macOS 10.14 has changed the way USB ports are enumerated and named.
  31. 1 point
    Which release of macOS? See Information to Provide When Asking for Help macOS 10.14 — Upload to MSP430FR5994 Fails #69
  32. 1 point
    INTRODUCTION This guide's intent and purpose is to allow a user with minimal Linux experience to successfully setup an absolutely free development environment to program the STM32F0 microcontroller with full debugging capability. PREREQUISITES A Linux distro, I used Linux Mint 13 (Ubuntu works nicely too) An Internet connection At least 2gb of spare hard drive space Familiarity with terminal A STM32F0 Discovery Board! PART 1 – Install Codesourcy PART 2 – Install OpenOCD PART 3 – Install Eclipse PART 4 – Setup File Directory PART 5 – Setup Eclipse PART 6 – Configure the gdb/OpenOCD Hope you enjoy! Any questions, comments, feedback, feel free to sound off below.Also a STM32F4 guide is on its way. When it gets here depends on how much spare time I have.... Edit: Thanks bluehash! Guide is now hosted on arm-hq. v1-2 Downloads stm32f0_v2.doc
  33. 1 point
    This is OK, but my MSP430G2533 7-segment working (multiplexing) digit-by-digit without resistors. Current (and brightness) is handled by PWM (WD). Device (PDIP) is mounted under the display.
  34. 1 point
    I couldn't solve the problem with Mspdebug Solved with CCS Cloud on Windows : On Debug menu I could launch 'Recovery' then 'Update ' 🙂 Launchpad is now OK... next step : test again on Unbuntu 18.10 (without modemmanager holding TTY/ACM0....) OK with last Energia running on Ubuntu 18.10 (32 bit libmsp430.so coming Energie replaced by 64 bit one,)
  35. 1 point
    slipton

    MSP430 Nixie Clock

    Hi All, I just finished assembling and modifying this kit for my SO for Christmas. I put it in a vintage toaster from 1910. Works great and so cool! However, watch out for shorting anything while the clock is powered - I fried some transistors while playing around with it. In any case, I made quite a few modifications and will post them here. I added the following components to the kit: Arduino UNO I had lying around. Random photodiode I had lying around. Adafruit RTC module: https://www.adafruit.com/product/3013 Adafruit motion sensor: https://www.adafruit.com/product/189 I modified the code to use the photodiode and motion sensor to control the brightness of the display using PWM. I have attached that. It is not written with extreme discipline, but it works Let me know what you guys think, Saul main_v6.ino nixie.h
  36. 1 point
    This board is indeed obsoleted. It was replaced by the RED board many years ago. The TI-RTOS version it was based on no longer receives updates. Hence, it was time to retire this. If you still like access to this board then do the following: Open Energia's preferences (File->Preferences or on macOS Energia->Preferences) Located "Additional Boards Manager URLs" and paste the following link into that field: https://energia.nu/packages/package_msp432_black_index.json Go to the board manager and you should see the black board appear again. Good luck with your Robot project. Robert
  37. 1 point
    bluehash

    How do you like this forum platform?

    Looks like a fair bit of activity with members posting comments and blogs. How do you guys like it? Is it easier to navigate? Responsive? Let me know. Thanks!
  38. 1 point
    Rei Vilo

    [Energia Library] I

    Please find a library for the I INA219_Distribution206.zip
  39. 1 point
    I find Energia suitable for many most of my projects. Much of the time direct register access is not needed. But if you keep at it long enough and stretch the boundaries of what others have done and posted, then expect to encounter the limitations of Energia / Arduino or at least the need to understand what is happening at the register level. It may be in terms of the software, the libraries, slow execution, lack of access to features, or that your desired microcontroller does not have an Energia port. If you learn to directly access registers then all peripherals and capabilities are available. If you want to understand and port other libraries that use direct register access then clearly a deeper understanding is needed as well. As long as you don't introduce a conflict then direct register programming and Energia work together fine and it is not one or the other. I would start with CCS and the workshop that L.R.A suggests if using the G2553. There are also tutorials on using CCS. I find the debugger in CCS invaluable even when using Energia. Gaining familiarity with the datasheets, the family user guides, and header files was the most difficult part for me as I have no microcontroller or C/C++ background - but they are key. My approach was to become proficient in Energia and then add the more traditional approach as I went along. I even find that myself writing everything in CCS without Energia from time to time now
  40. 1 point
    Hi @@cwpotter It sounds like an interesting project. That boosterpack looks pretty neat. I don't have any experience with the 430BOOST-ADS1118 but took a quick look at this and here are some things that you should look into... The library you link to seems to have been written for the C2000 - so you would need to port it to the CC3200. You definitely don't want to download the entire thing if it is written for the C2000 - probably just the .ino, .cpp and .h files. Error messages will tell you where to proceed from there. Do they say something is missing? Then look for it in the repository. Libraries are installed in Energia the same way they are installed for Arduino with the exception of location - see for example this: https://learn.adafruit.com/adafruit-all-about-arduino-libraries-install-use/arduino-libraries?view=all Note that you can find the correct location for user libraries by opening File ==> Preferences in Energia which shows sketch locations. At this location will be a folder called libraries. Install libraries there. To be honest, I would probably use an earlier version of Energia Sometimes it is easier to start over and use existing code as a go-by. You have 3 sources apparently the C2000 sketch, the firmware for the G2553 that comes with the backpack (probably not Energia), and the code at element14 - none of it for the CC3200 although the C2000 appears to have been written for Energia. How much sense does the code in these sources make to you? If not much, then you are going to do some homework to get this going with anything other than the RPi. Provided of course the RPi code already does what you want pretty much.
  41. 1 point
    Hello everyone, There is a couple of similar projects available on the internet. Some of them base on Arduino and PIC performs very basic mount control without math intensive computation implemented in embedded controller. I decided to build my own with the following goals: ease of use by an inexperienced amateur astronomer (full automatic operation) precision and resolution of position last but not least: the price Final, or better say at the moment, design comprises of the following components: Stellaris LM4F launchpad central control unit, two ULN2003 unipolar stepper motor driver chips, two 28byj-48 stepper motors one moving in azimuth, and in elevation via gear train, communication module: Bluetooth serial module. It allows sending a coordinate set-point and provides position feedback to Stellarium, GPS module providing position and precise time reference - PPS gives 1us accuracy, Nokia 5110 display unit and joystick for standalone operation, now obsolete mouse (PS/2) modified to provide independent (incremental) position information Resolution that was reached is a single step of approx. 5". Given the size of Jupiter to range from 30" to 50", this positioning resolution makes the view comfortably stable in standard 60° FOV eyepiece at reasonably high magnification, without the need to adjust AZ/ALT continuously. During the development I made use of several opensource and projects available online, namely: AccelStepper for stepper control, TinyGPS++ for NMEA decoding, Arduino telescope controller was my inspiration and reference for Taki's matrix method for coordinates transformation, of course Energia as my IDE Upon power-up the mount is performing: homing acquisition of current location (longitude/latitude) and time via NMEA stream moves to 3 brightest (most convenient) stars in succession to perform 3 star alignment procedure - they are selected from the list of over 500 stars in built-in catalog (the brightest are used for the alignment, tough), once aligned the mount is in tracking mode: it tracks the view to counter the apparent movement of objects in the sky, waiting, either for the user to move to particular object - selected from the library of stars and Messier objects, or awaits connection via Bluetooth from a PC running Stellarium with a plugin and slews to selected object. search for the object that should be visible in the eyepiece and display important information on LCD - I compiled in 500 brightest stars from HYGXYZ and full Messier catalog. I have very little experience as amateur astronomer so far, so some of the objectives might have been not very obvious for me in the beginning. This project was also a good way to make use of my free time and gain experience in embedded system design. With kind regards, Szymon
  42. 1 point
    I'm receiving many mails about the libraries I've developed and I'm sharing. The libraries are plug-and-play as I'm using them in my projects. However, they are designed for a specific configuration. For example, a SD-card library requires a minimum of 512 bytes of RAM as this is the size of a sector. So it won't work on the MSP430G2553. With so many LaunchPads, BoosterPacks and components possible combinations, the one-fits-all approach is just impossible. It would end with lengthy and hard to read code with many pre-processing statements. For example, changing the pins names for the pins numbers improves the portability of the library across the LaunchPad range of boards. Even if the library works out of the box, they are provided as examples and require some work from the user. This is the best way for learning. The user should read and understand them, and then customise them so they can match his/her exact needs. With new hardware and software releases coming out, a library may suffer from obsolescence. It used to work with a prior version but no longer works with the new one. For example, each new release of Energia or CCS adds new features and some times modifies others in order to ensure compatibility across the whole range. Finally, feel free to improve and share back the libraries with the community This is a cross-post with Stellarisiti.
  43. 1 point
    chicken

    [POTM] dAISy - A Simple AIS Receiver

    The radio on its own does not much. It needs an MCU to control it and talk to the computer, which is the MSP430 Launchpad in this case. See the first post of this thread and just replace the custom breakout board with the Ebay radio (minus the changes in wiring as documented). There are several options to program the LaunchPad. For this project I used TI's full IDE Code Composer Studio (CCS). http://www.ti.com/ww/en/launchpad/software.html The repository I published on Github includes the CCS project file. https://github.com/astuder/dAISy Simply copy the whole tree into your CCS workspace and open it in CCS. From there you can compile the code and program the LaunchPad. The radio configuration data generated by WDS is in the radio_config.h source file. dAISy USB is the standalone version of all this, where I designed and built my own PCB that includes radio and MCU on one board.
  44. 1 point
    bobnova

    analogWrite() precision question

    @@altineller not really, no. It's something of a hidden function. You have to include wiring_analog.c (#include <wiring_analog.c>) to kick things off. That includes the PWMWrite function. Then you can call it thusly: PWMWrite(PIN,numberOfSteps,dutyCycle,frequency); For example: PWMWrite(PD_1,500,250,6000); Would start PWM on pin PD_1, 500 steps from 0 to 100%, 50% duty cycle (500 / 2 = 250), 6000Hz frequency. It's worth noting that the function call does glitch when you call it on a pin already putting PWM out. It's not enough to hear driving a speaker, but it could cause you issues if you're calling it a lot. There's a thread around here somewhere on that subject. The frequency cap is very high, if I recall correctly I'd tested it to work >1MHz. I could be thinking about a different MCU, I've tested sort of a lot of them.
  45. 1 point
    Hi All, I found another one (after the first, prepared by Rei Vilo) interesting library for TI INA219 IC by Jarzebski This library working on stellaris without any modyfication. links: TI page about INA219 Rei Vilo library at 43oh and Embedded Computing Jarzebski github - other interesting stuff for GY80 (L3G4200D, HMC5883L, BMP085, ADXL345) Jarzebski blog (PL)
  46. 1 point
    I've spent some time recently experimenting with the Tiva timer PWM mode (not the PWM module). I have modified the wiring_analog.c such that duty cycle changes using PWMWrite() are now glitch free. Hence it is suitable for driving servos and other timing critical sources with frequent duty cycle updates. No interrupts are required. The changes are: - bypassing the timer disable/reset if it is already initialized to the PWM mode; - setting both MRSU and ILD bits in the Mode register such that both frequency and match register update are postponed to the next timer period; - the intermediate result of the duty cycle computation is increased so that large analog_res values do not cause overflow (useful for setting the duty cycle in microseconds for the servo) I tried to do a "minimally invasive" code modification to avoid compatibility issues. If the module interface change is acceptable then things can be done a bit cleaner/faster. Since I've already spend time learning the Tiva timer internals I can do further tweaks to the code if there is a community consensus on the optimal PWM interface (as a superset of Arduino). Try the code and see if you find any issues with it. If it does not cause any compatibility problems perhaps someone can help me integrate it into the next energia release. wiring_analog.c
  47. 1 point
    Ok, I found a partial workaround within a baseline Energia framework. The idea is to re-sync analogWrite() to the pwm signal iself . This works OK up to around 580Hz PWM frequency (good enough for my brushed motor PID controller project). For highly dynamic PWM (like audio) I have to dig deeper... int pwm; int dir; void setup() { //attach the PWM update interrupt handler to the PWM pin itself //*must* use the *rising* edge (falling edge messes up PWM) //on my Tiva-C Launchpad this works up to ~580Hz PWM frequency attachInterrupt(RED_LED, handler, RISING); //prime the pwm pin interrupts pwm = 1, dir = 1; analogWrite (RED_LED, pwm); } void loop() { pwm += dir; //pwm value should be constrained between 1 and 245, otherwise interrupts stop if (pwm == 254 || pwm == 1) dir = -dir; delayMicroseconds(2733); //some random value } //handler without the pwm value change detection logic void handler() { analogWrite (RED_LED, pwm); } /* //handler with the pwm value change detection logic void handler() { static int p_pwm = -1; if (p_pwm != pwm) { analogWrite (RED_LED, pwm); p_pwm = pwm; } } */
  48. 1 point
    Ok: #include <wiring_private.h> void setup() { // put your setup code here, to run once: pinMode(PF_0, OUTPUT); } void loop() { // put your main code here, to run repeatedly: PWMWrite(PF_0, 256, 200, 15000); while(1) delay(100); } Saleae Logic16 shows a waveform with width=52.1uS, period=66.68uS, frequency = 14.997KHz. Pretty close. 52.1/66.68 = 0.781343, 256*0.781343 = 200.02 so that looks right. Running this: #include <wiring_private.h> void setup() { // put your setup code here, to run once: pinMode(PF_0, OUTPUT); } void loop() { // put your main code here, to run repeatedly: PWMWrite(PF_0, 256, 200, 15000); delay(100); } ...produces ALMOST the same thing, but every 100ms there's a single pulse whose width is 101.65uS instead of the typical 52.1uS. Running this: #include <wiring_private.h> void setup() { // put your setup code here, to run once: pinMode(PF_0, OUTPUT); } void loop() { // put your main code here, to run repeatedly: PWMWrite(PF_0, 256, 200, 15000); } Produces no waveform at all; the signal goes HIGH after Energia starts and then stays there with no transitions.
  49. 1 point
    MichelV

    OneWire Energia Library

    Unfortunately I haven't heard from Paul Stoffregen yet, so I decided to release the modified source here. I still hope he'll respond, and include the changes in his own library, but at least you guys have a chance to play with it now So, attached is the UNOFFICIAL OneWire library, that is compatible with Energia. Regards, Michel. OneWire Energia Compatible.zip
  50. 1 point
    Rei Vilo

    I2C channels in Stellaris

    Use `setModule()` as described in https://github.com/energia/Energia/blob/master/hardware/lm4f/libraries/Wire/Wire.cpp#L599 void setup() { Wire.setModule(3); Wire.begin(); ... } Similar logic applies for UART and SPI. As an alternative, declare the variable as in https://github.com/energia/Energia/blob/master/hardware/lm4f/libraries/Wire/Wire.cpp#L161 TwoWire Wire2(2);
×
×
  • Create New...