Jump to content

spirilis

Members
  • Content Count

    3,383
  • Joined

  • Last visited

  • Days Won

    145

Reputation Activity

  1. Like
    spirilis got a reaction from MichelKohler in PWM changes depending on the code it's running   
    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.
  2. Like
    spirilis reacted to Rei Vilo in J-Link EDU Mini at USD18   
    Although all the LaunchPads feature a programmer-debugger, sometimes an external one might be useful.
    Segger has just launched the J-Link EDU Mini, with all the software and expertise of Segger, priced at just USD18!

    I'm very happy with the larger Segger J-Link Edu priced at USD60.
    I've ordered one J-Link EDU Mini and plan to review it.
     
  3. Like
    spirilis reacted to agaelema in Compiling CMSIS DSPLIB to MSP432 (and other cortex M4 from TI)   
    Hi @spirilis
    I'm not a specialist, but traditionally designers use tools like Matlab to select coefficients and test. If I'm not wrong, the CMSIS coefficients were calculated using matlab (providing the code).
    Octave is a free tool with same syntax and similar functions. 
    This link show an example using matlab/octave
    https://www.allaboutcircuits.com/technical-articles/design-of-fir-filters-design-octave-matlab/ https://www.allaboutcircuits.com/technical-articles/practical-fir-filter-design-part-2-implement-filter/
    Bellow there are some links to tools (but I have not tested)
    http://t-filter.engineerjs.com/ http://engineerjs.com/?sidebar=docs/iir.html http://iowahills.com/Index.html  
  4. Like
    spirilis reacted to agaelema in Compiling CMSIS DSPLIB to MSP432 (and other cortex M4 from TI)   
    Hi.
    In the beginning of this year I wrote two articles showing how to compile the CMSIS DSPLIB to use in MSP432 and one example of use.
    The sequence is very similar to used in Stellaris and Tiva line.
    The articles are in portuguese, but there is a embedded translator.
    Compiling the CMSIS DSPLIB to MSP432
    Example of use - FIR filter
    I hope it's useful. 
     

  5. Like
    spirilis reacted to admirlk in Is it just me ?   
    I know this is an older post, but it struck a "pet peeve" nerve.
    I recently went back to school, I had to learn how to use a calculator because they were not allowed in math class when I was in high school, and was surprised at how often people did not bother to even copy things by hand. When we had peer reviews, or otherwise were able to see each other's code, there was always at least one that was a direct c&p of code that did not even work. Had they copied it by hand, and read it in the process, they would have realized that it did not work. Keep in mind, these are simple school problems that have numerous examples on the internet. I have also seen, many times, where the code seems to have been intentionally written wrong, but someone who actually reads it will be able to fix it easily.
    When I have problems with code, I am often reluctant to ask questions because I do not want someone to just write it for me. I appreciate answers that simply point me in the right direction. On the other hand, with electronics, I tend to look for a more definitive answer. This is usually something like what size cap should I use, because I am trying to copy something that did not give the value, and I am just trying to get it to work, without ordering "one of each" or frying something.
    Personally, I appreciate everyone who tries to help me. 
  6. Like
    spirilis got a reaction from Medsimo in [Energia Library] RF430CL - TI NFC RF430CL330H library   
    Allocate an NDEF_TXT object first instead of just composing your "Value" variable and trying to send it directly over the NFC:
    NDEF_TXT t("es", Value.c_str()); int ndef_size = t.sendTo(nfc); nfc.setDataLength(ndef_size) Note the first string in the NDEF_TXT constructor is the language code describing the language used for the text.
  7. Like
    spirilis reacted to Rei Vilo in [Energia Library] RF430CL - TI NFC RF430CL330H library   
    So unfortunately, don't expect others to do your homework. Instead, they may provide you pointers. 
    See Netiquette for Newbies. 
  8. Like
    spirilis reacted to nickds1 in More C versus C++   
    Late into this thread, and I haven't read it top to bottom, but there seems to be a slight conceptual gap developing regarding what C & C++ really are.
    They are languages, not environments. The C language was originally designed for telephone exchange testing & control. Subsequently, it was used to implement the early UNIX kernels. There is a "C Standard Library", which is distinct from the language proper - this is where printf etc. come from.
    The story is similar with C++ - the language is distinct from its support libraries, e.g. stdlib, STL, and the various boost libraries.
    A huge amount of apocrypha and mis-information surrounds these languages and the pros and cons of their various implementations - most of the arguments are bogus and ill-informed. The truth is, IMHO, far more boring - that they each have pluses and minuses.
    The main differences are that C++ is geared to a more object-orientated design methodology, and generally, the mindsets used are different, which is why some feel that teaching people C, then C++ is a bad plan.
    When mis-used, C++ can be memory-hungry, which is one some decry its use for embedded work - I feel that this is a fallacy - C++ is absolutely fine for embedded work (I use it all the time), if you understand the consequences of your actions - C++ is a far more powerful & capable language than C, but with great power comes great responsibility (*) - blaming the language for your poor understanding of the consequences of your actions is not an excuse. C++ is easy to abuse, C can be plain dangerous...
    An analogy I like to use is the difference between "mathematicians" and "people who do mathematics".
    A mathematician has an intuitive grasp of numbers and mathematics - they can visualize the problem they are working on and come up with novel ways of solving it; further, when presented with a left-field/previously unseen problem, they will see ways of dealing with and solving that.
    Someone who does maths, OTOH, knows how to follow rules and can solve problems that are related to problems that they have encountered before, but may have real issues dealing with a novel puzzle..
    Same with programmers. There's a world of people who can do C or C++ and have used the support libraries - that does not make them good or even half-decent programmers.
    In my career, I have found very very few genuinely good programmers - people who understand architectural issues, who can see solutions, who can visualise novel approaches and solutions, who understand and then, very importantly, can implement with excellence - it's the difference between a programmer (rare beast), and journeymen who know how to program (common as anything).. 
     
    Note: I was involved in the ANSI C process and have been an editor or cited as a contributor to various C++ related books, including Scott Meyers' "Effective STL" etc Spent 30 years in the City of London and elsewhere as a CTO, designing, developing and implementing some of the world's largest real-time equity, derivative & FX exchange trading systems, mostly in C & C++.
    (*) Attributed to Ben Parker, Peter Parker's uncle...
  9. Like
    spirilis reacted to bluehash in Atomo Modular Electronics System - Raspberry-pi   
    Cool concept to adding boards to the Raspberry Pi.
    Atomo is a complete system for building electronic things with four parts: Control, IO, Power, and Connector. 
    https://www.indiegogo.com/projects/atomo-modular-electronics-system-arduino--2#/
    https://youtu.be/0uOsLvB1of0
     
     
     
  10. Like
    spirilis got a reaction from 43two in [Energia Library] Nordic nRF24L01+ library   
    Going to roll this up (with examples in the examples/ subdir, create the IDE hints, etc) and put it up on github shortly.
     
    This library is not the most flexible way to manipulate the transceiver, as it makes a few simple assumptions:
     
    1. Dynamic Payload Length is always enabled
    2. Only 1 receive pipe is supported, the MultiCeiver stuff is not (truth is, it's extensible enough that I could add that in the future)
    3. Pipe#0 is always using its default (E7E7E7E7E7) address and any data coming in to that addr gets silently flushed.  I recommend not using the E7E7E7E7E7 address for any of your applications.  (This internally has to do with implementing AutoACK properly)
    4. User needs to poll available() to see if incoming data is waiting, there are no ISRs that callback/wake-up the MSP430 in the event that data is available.
     
    The goal here is simplicity, in keeping with the spirit of Energia.  I think this will fulfill that and give users a quick & simple way to use their radios.
     
    Ideally I'd like to implement ISR/IRQ wakeup so the user can put the chip into deep LPM4 sleep, but it looks like the Energia/Arduino API just doesn't facilitate that.  I'd like to be able to attach an interrupt function to the IRQ pin so if it fires, it wakes the chip up, but I'd need some API in attachInterrupt() that tells it to do this (i.e. perform the __bic_SR_register_on_exit(LPM4_bits) in the main P1/P2 ISR function).  Rick tossed some ideas around with me and I'm just going to hold off on implementing any of that.
  11. Like
    spirilis got a reaction from 43two in [Energia Library] Nordic nRF24L01+ library   
    Hi folks... So I'm a little new to Energia, but since I wrote a library for the nRF24L01+ digital transceivers for native C-based apps I figured it'd be a great idea to port this to Energia.
     
    I'm rewriting it from scratch, trying to make it simpler & feel more like a native C++ energia lib.
     
    edit: This has been written and the latest version is up on Github.
    Github project- https://github.com/spirilis/Enrf24
    Latest version + comments- http://forum.43oh.com/topic/3237-energia-library-nordic-nrf24l01-library/?p=48805
     
     
     
     
    To that end, I'd like some feedback on the API choices I've made.  I want to know what some of you guys think should go in here.
     
    For now, here's an example of my "Nrf24.h" class definition (public's only, I haven't drafted the private's and probably won't until I really start writing the code):
    class Nrf24 { public: Nrf24(uint8_t cePin, uint8_t csnPin, uint8_t irqPin); void begin(); // Defaults used void begin(uint32_t datarate); // Specify bitrate void begin(uint32_t datarate, uint8_t channel); // Specify bitrate & channel void end(); // Shut it off, clear the library's state // I/O boolean available(); // Check if incoming data is ready to be read boolean write(void *buf, uint8_t len); /* Send packet, return true/false for autoACK * (true always if autoACK disabled or 250Kbps rate used) */ uint8_t read(void *inbuf); // Read contents of RX buffer, return length uint8_t read(void *inbuf, uint8_t maxlen); // Read contents of RX buffer up to 'maxlen' bytes, return final length. void autoAck(boolean onoff); // Enable/disable auto-acknowledgements (enabled by default) // Power-state related stuff- void deepsleep(); // Enter POWERDOWN mode, ~0.9uA power consumption void enableRX(); // Enter PRX mode (~14mA) void disableRX(); /* Disable PRX mode (PRIM_RX bit in CONFIG register) * Note this won't necessarily push the transceiver into deep sleep, but rather * an idle standby mode where its internal oscillators are ready & running but * the RF transceiver PLL is disabled. ~26uA power consumption. */ // Custom tweaks to RF parameters, packet parameters void setChannel(uint8_t channel); void setTXpower(int8_t dBm); // Only a few values supported by this (0, -6, -12, -18 dBm) void setSpeed(uint32_t rfspeed); void setCRC(boolean onoff, boolean crc16bit); /* Enable/disable CRC usage inside nRF24's hardware packet engine, * specify 8 or 16-bit CRC. */ // Protocol addressing -- receive, transmit addresses void setAddressLength(uint8_t len); // Valid parameters = 3, 4 or 5. Defaults to 5. void setRXaddress(uint8_t *rxaddr); // 3-5 byte RX address loaded into pipe#1 void setTXaddress(uint8_t *txaddr); // 3-5 byte TX address loaded into TXaddr register // Miscellaneous feature boolean rfSignalDetected(); /* Read RPD register to determine if transceiver has presently detected an RF signal * of -64dBm or greater. Only works in PRX (enableRX()) mode. */ } What do you think?  General usage would be to instantiate an Nrf24 object in the global, use begin() to start it and specify some custom params (data rate, or data rate & channel), then the transceiver is just sitting there idle until you either transmit (with setTXaddress() + write()) or enable RX mode with setRXaddress() + enableRX() and poll the available() function periodically.
     
    One thing I haven't worked out yet is how to implement the IRQ feature with Energia.  The nRF24 has an IRQ pin that is best hooked up for optimal function.  Can the library just use attachInterrupt() on the irqPin value that the user passes up top?
  12. Like
    spirilis got a reaction from dubnet in MCU recommendation   
    Well, I am not sure about the interrupt latency (not that familiar with the arch), and the price is more like $1.50ish... but Renesas RL78/G13 is close:
     
    https://www.renesas.com/en-us/products/microcontrollers-microprocessors/rl78/rl78g1x/rl78g13.html
     
    https://products.avnet.com/shop/en/ProductDisplay?storeId=715839035&catalogId=10001&langId=-1&productId=3074457345625366633
     
    OK, going down a bit, RL78/G12 has a 24MHz part that's <$1:
    https://www.renesas.com/en-us/products/microcontrollers-microprocessors/rl78/rl78g1x/rl78g12.html?status=No%3B&pin_count=20%3A20%3B#
     
    https://products.avnet.com/shop/ProductDisplay?catalogId=10001&langId=-1&storeId=715839035&productId=3074457345625120989&categoryId=&fromPage=autoSuggest
     
    IIRC the compiler is free, or at least there is a GCC port, and Renesas e2studio is a free Eclipse-based IDE.
  13. Like
    spirilis got a reaction from RobG in MCU recommendation   
    Well, I am not sure about the interrupt latency (not that familiar with the arch), and the price is more like $1.50ish... but Renesas RL78/G13 is close:
     
    https://www.renesas.com/en-us/products/microcontrollers-microprocessors/rl78/rl78g1x/rl78g13.html
     
    https://products.avnet.com/shop/en/ProductDisplay?storeId=715839035&catalogId=10001&langId=-1&productId=3074457345625366633
     
    OK, going down a bit, RL78/G12 has a 24MHz part that's <$1:
    https://www.renesas.com/en-us/products/microcontrollers-microprocessors/rl78/rl78g1x/rl78g12.html?status=No%3B&pin_count=20%3A20%3B#
     
    https://products.avnet.com/shop/ProductDisplay?catalogId=10001&langId=-1&storeId=715839035&productId=3074457345625120989&categoryId=&fromPage=autoSuggest
     
    IIRC the compiler is free, or at least there is a GCC port, and Renesas e2studio is a free Eclipse-based IDE.
  14. Like
    spirilis reacted to yyrkoon in RANT: Cloud of this, IoT of that . . .   
    I should point out that I have absolutely zero interest in anything apple / mac.
  15. Like
    spirilis got a reaction from Fmilburn in Why only prototyping?   
    Hasn't been tested to rigorous standards demanded by production use cases. Plus TI has to state that to avoid being sued if bad things happened that could be traced back to bugs in Energia.
     
    (Not an official explanation)
  16. Like
    spirilis reacted to chicken in [POTM] dAISy - A Simple AIS Receiver   
    What an enjoyable Sunday afternoon.

    Seriously, I love debugging!
     
  17. Like
    spirilis reacted to Fred in CCS 7.0 beta available   
    Good point. I just had a look and stumbled over the CC3220, CC3220S and CC3220SF. I found a single reference to the CC3220 on E2E which concluded with "you discuss unannounced product on public forum".
    https://e2e.ti.com/support/wireless_connectivity/simplelink_wifi_cc31xx_cc32xx/f/968/t/548741


    There is also reference to the CC3220S(F)-LAUNCHXL on Mouser and Octopart but nothing there. I'm sure this happened with the MSP432 Launchpad too.
    http://www.mouser.co.uk/ProductDetail/Texas-Instruments/CC3220SF-LAUNCHXL
    http://www.mouser.co.uk/search/ProductDetail.aspx?R=0virtualkey0virtualkeyCC3220S-LAUNCHXL
     
  18. Like
    spirilis reacted to zeke in PCB design guide   
    I stumbled across a really cool resource from Ford Motor Company tonight.
     
    It's called EMC Online and it's located here: http://www.fordemc.com
     
    Here's a copy-paste of their introduction:
     
    ======================
    Forward
    The quality and reliability of today's automobiles are dependent in part on its electrical system to operate as designed within the vehicle
  19. Like
    spirilis reacted to Rei Vilo in Energia can example   
    See chapter 6 of the http://www.ti.com/lit/ug/spmu298d/spmu298d.pdf'>TivaWareTM Peripheral Driver Library USER
  20. Like
    spirilis reacted to EdoNork in CCS 7 is out   
    http://processors.wiki.ti.com/index.php/Download_CCS#Code_Composer_Studio_v7.0_Downloads
  21. Like
    spirilis got a reaction from Fmilburn in MSP430 Wearable with Radio   
    Regarding making your own PCB with RF, one nice thing about the TI parts is the TI reference designs, I've used their 2-layer (0.8mm thick) ref design to build a few CC1310 boards of my own, and they work great but the RF passives are all 0402 and require a stencil for solder (OSHStencils stainless works great for this). 0402 is a bear and the absolute lower limit I will go.
     
    That said, one of TI's partners made a module for the CC2650 with LGA pads underneath IIRC. That makes the chip far more accessible. Trey German formerly from TI started a small company (Polymorphic Labs) building tiny gadgets based on that module. The CC2650 "BoosterPack" package includes a sample or 2 of that module. But of course all of that is probably over your budget
  22. Like
    spirilis got a reaction from Fmilburn in MSP430 Wearable with Radio   
    Well whatever you use, 2.4GHz is best due to PCB antenna size. It is a shame the CC26xx series is too expensive since its high sensitivity would help make the distance even with sketchy small PCB antennas.
     
    Also for nRF stuff, I wouldn't bet on those actually making 10m at 2Mbps, but it should at 250Kbps. The issue is the human body and how it may reflect/refract RF as the wearer moves around.
  23. Like
    spirilis got a reaction from jpnorair in How to program a CC1310F64RHBT in Energia   
    Without having any way of seeing your breadboard adapter socket soldering job and where the passives are, my first assumption is you probably did something wrong with the chip's layout; FYI this isn't a chip you can casually "solder to an adapter" and expect it to work.  It has several passives including an inductor, multiple values of decoupling capacitors, a 24MHz XTAL without load caps (load caps are internal) along with a 32.768KHz XTAL with load caps that are expected (earlier revisions of the CC1310 chip couldn't run without the 32.768KHz XTAL).  I've been successful in rolling my own boards by designing them from scratch but closely following the layout decisions demonstrated by TI's own reference designs.
  24. Like
    spirilis reacted to Fred in CCS for $9.99   
    I had the opposite. Licence sent immediately but launchpad took 4 weeks to ship. If anything, it looks like CCS7 might not need a licence at all. That might explain why they're being given away so readily.
  25. Like
    spirilis got a reaction from jazz in My time with the Renesas RX   
    Update-
     
    After playing with C++ templates in e2studio and GNURX, I ended up tracking down a nasty bug in the compiler that turned out not to be a compiler bug, but rather, an idiotic set of defaults in the GNURX project generator's default linker script configuration.  Learned quite a bit with that wild goose chase...
    (Or as a coworker software developer told me, "It's every programmer's favorite pastime to blame the compiler!")
     
    e2studio (Eclipse) has a graphical interface for configuring the ld sections, and one option you can do per section category is "KEEP" .... in reality GNU ld linker scripts allow freeform use of KEEP() for individual sub-sections included within a section, but the Eclipse GUI-ified ld configuration tool only lets you apply KEEP to the whole section.  Looking at a genuine RedHat Newlib ldscript is helpful in figuring out what should be forcibly "kept".
     
    As it turns out, in order to use C++ properly with inheritance and virtual functions, the C++ compiler uses something called "Virtual Tables" to perform at-runtime indirection of function calls (so that a pointer of a parent class type pointing to a subclass's memory contents will correctly run the subclass version of a function, rather than the parent class's version of a function, without necessarily knowing what the subclass type is at compile-time).  This requires a few pieces of plumbing- the virtual table itself (often starting with _ZTV in the verbose mangled symbol name) and the init function that loads the correct vtable addresses into each static instance of a class, typically called _GLOBAL_sub_I_<objectname>.
     
    The _ZTV virtual table symbol and type information is typically part of the .rodata section, i.e. .rodata._ZTVMyTemplateASDF or whatever, whereas the _GLOBAL_sub_I_<objectname> is part of the .init_array section.  However neither of these are necessarily referenced explicitly from the C init runtime routines (the GLOBAL initializer has a pointer loaded inside the __init_array section), so the linker (with -Wl,--gc-sections) will gladly garbage-collect them from the binary*, resulting in C++ objects that aren't correctly initialized (VPTR's stored as a hidden class member in the bss-initialized space which is all 0x00's) and with the vtable being used to look up function addresses, the CPU will go off into lala land (PC branching to 0x00000000 at the beginning of SRAM) when you execute an overridden subclass function.
     
    * - Something about this explanation doesn't quite feel right, as I would imagine with the GLOBAL init function's pointer present in __init_array it shouldn't see any reason to garbage collect it, but this is what I've seen with the GNURX toolchain builds.  Perhaps the problem is that this array is only referenced via some ldscript-provided pointers during the C init runtime routines.
     
    To alleviate this, .init, .fini and .rodata should have KEEP() around their symbols (or certain ones of them in the case of .rodata but I just have the whole section wrapped in KEEP) to ensure they aren't garbage-collected.
     
    Strange quirk, you can tell not many Renesas customers use C++ since this was never caught before.  I recall a video of a Renesas DevCon talk doing a call of hands of who uses C++ .... maybe 1 hand in the crowd went up.  Wouldn't be shocked if they never bothered with virtual functions either.
     
    I happen to think these 32-bit chips are perfect for this kind of work, as I previously stated, so I'm all about fixing the bugs if they're not too heinous.
     
    So here's my current "checklist" on starting a C++ application with Renesas e2studio + KPIT GNURX:
     
    Open Project Preferences > C/C++ build
    1. Compiler Miscellaneous options - enable -fdata-sections and -ffunction-sections
    2. Compiler user-defined: Add -fno-exceptions and -fno-rtti
    3. Library Generator user-defined compiler settings: Add -fno-exceptions and -fno-rtti
    4. Include paths - add the src folder of the project itself so I can reference my .h files with <> and not just ""
    5. Linker Sections - for .init, .fini and .rodata, expand the "Advanced" section on the right side and check the KEEP option
      ** after doing this and hitting "Apply", go back into the project settings and make sure these actually got set; seen many projects misbehave b/c the setting didn't "stick" for some reason... maybe hitting "Ok" without hitting "Apply" inside the linker settings section isn't good enough
    6. Linker Miscellaneous - enable -Wl,--gc-sections
    7. Library Generator > Other Options - set Optimization type to "Code size optimization" (-Os) or whatever else
    8. Compiler > Object - set Optimization level to "Code size optimization" (-Os) or whatever else
×
×
  • Create New...