igor

Members
  • Content count

    586
  • Joined

  • Last visited

  • Days Won

    6

igor last won the day on November 15 2016

igor had the most liked content!

About igor

  • Rank
    Level 3

Profile Information

  • Gender
    Not Telling
  • Interests
    User ID for my Stellarisiti posts: igor1426459857
    eLua
  • Github
    https://github.com/ecdr
  1. It is on github in my fork of eLua, in the branch named SAM. The direct link is. https://github.com/ecdr/elua/tree/SAM Most of the SAM specific adaptations are in the src/platform/sam34 directory. https://github.com/ecdr/elua/tree/SAM/src/platform/sam34 If you haven't used git it takes a bit of learning, but is really nice when using/managing a large project. I haven't done much on this recently, but would welcome contributions to the branch. (Would be nice to get it totally working and incorporate into the eLua main line.)
  2. More particulars - what giving you problems, how long do you need to store, etc. (The quick answer is put the readings in an array - then they are stored. But maybe you want to do something more than that.) www.catb.org/esr/faqs/smart-questions.html
  3. Did you consider just using an old (or new prepaid) cell phone? At least in the US one can get no contract prepaid android cell phones for 5 to 15 USD. (on sale, but they are on sale routinely) Gives you battery, GPS, flash storage, some have uSD. Don't know if you could find one as small as your previous unit (I didn't see dimensions listed). Of course programming it would be a pain (unless you could use one of the existing hike logging apps). Weatherproofing might also be an issue, as might weight. (Might also give you other things to play with if you wanted - like compass, accelerometer, WIFI) Just a thought.
  4. The main thing to be kept short in an ISR is execution time. Even the longest execution path in this ISR isn't long. 3-4 compares, a similar number of assignments, maybe a computed jump. Doesn't even have any procedure calls or loops.
  5. What is your actual sampling frequency? With this code speed of the ADC is least of your worries. Print takes a long time, so would try to optimize that first (i.e., move it out of the loop if you can - just record the values in the loop, then worry about finding the maximum and displaying it). Once you have gotten the prints out of the way, if it still isn't fast enough could look at inlining the reads/writes. (The arduino/Energia calls are nice for abstraction and portability, but they are slow.) If you wanted to get fancier about it (and your threshold was amenable) you might be able to use the comparator. It would give you an interrupt when threshold reached, then start looking for the peak (so you could sleep most of the time).
  6. Once you get this going if you need to make it even faster the Tiva C has some nice features for reading/writing GPIO pins - if you read/write from an address that is at an offset from the base port address the offset acts as a mask - so you don't have to suffer the overhead of read/modify/write, or have to mask the read value. See the Tiva C documentation. I posted some macros that help with this someplace on 43oh, (think it is in the thread about porting arduino libraries) but don't have time now to find the post.
  7. Where did you make the function take a void argument? Need to do in function definition, just leave function name in call. void calibrate(void) { if(maxValue<threshold) maxValue=threshold; }
  8. Rather than using ADC, have you considered using the comparator? (I believe this device has one). You would have to see if it does what you want (e.g. can you set threshold voltage close enough to what you want to do). If it did, you might be able to just set up the timer and comparator, go to sleep until you got a comparator interrupt, then record the crossing, reset the comparator, and go back to sleep.
  9. Keeping pointer in RAM would be good move if you could. If you can't, can you get away with not storing a pointer at all? When you need to add a reading, search for the the end of where readings already are - takes more time, and have to reserve one reading value to mean there is no reading, but don't have to store the pointer. Using binary search should be able to find the end in order of log2(maximum number of samples). (One of the examples below just used a simple linear search.) I have definitely seen a temperature logger for the MSP430 using flash a long time ago. This isn't the one I was thinking of, but similar concept. http://benlo.com/msp430/ Here is another one - which seemed to be unavailable at the moment, so I went to an archived version: https://web.archive.org/web/20130923235655/http://hiwaay.net/~bzwilson/temp_recorder/
  10. Many of the simpler changes mentioned in the howto thread can be handled automatically using macros, etc. More recent versions of Energia include some macros which handle some of the changes mentioned in the thread. Having standard, cross-platform libraries for some common functions (which are not currently abstracted) would help. (i.e. create a common abstraction layer for functions which are currently handled on a device specific basis). For instance: a standard timer class. I worked some on a cross-platform timer object which would work on MSP430, AVR, SAM, Tiva. (Based on DueTimer, TimerOne, etc.) But this would only help if it became widespread enough that the program writer happened to have used it. (Though I suppose it might help if there was a simple enough way of translating timer access idioms on a particular machine into uses of the standard library that it could be done automatically.) Given that there are now Arduino environments used for many different processors (x86, STM32, etc.) it would probably help to have a more general guide to porting code/writing Arduino code that is easy to adapt to many different processors/families. (Of course most writers of Arduino programs, being inexperienced, would probably not use it. But it might help for those writing libraries.)
  11. In the description you say you want the pin to go high, but in the code you make the pin change from whatever state it is to the reverse. (P1OUT ^= BIT6) - rather than make it high (P1OUT |= BIT6), likewise the timer interrupt toggles a (different) pin, rather than turning it off. "If the code and the comments disagree, then both are probably wrong." --attributed to Norm Schryer What does the program do currently? (In what way does it not work.)
  12. Have you tried generating an assembler listing of the code produced by Energia, and looked through that to see what instructions are being generated? It is a little convoluted to do (wish there was a switch/button for it in Energia). e.g. http://forum.43oh.com/topic/7485-assembler-listing/
  13. Out of curiosity, why use a USB storage device rather than SD card? (Since there are already libraries for SD card access.)
  14. Seems like an ethernet witch would be just the thing for the thread on halloween projects. ;-)
  15. Wouldn't it make something like remotely controlling vehicles easier? Chevrolet's ethernet to CAN bridge seems very ad-hock. http://hackaday.com/2015/08/22/how-those-hacker-took-complete-control-of-that-jeep/ I do not think that connecting cars to networks is sensible, however there is a big push to do that. I do not have a need for such a bridge, but I can see where it could be useful for those experimenting with V2V, etc. http://hackaday.com/2015/09/02/v2v-means-safer-roads/ Seems like a really strong firewall/packet sanitizer/saneitizer should be part of such a device, since CAN buss often local/may not make robust assumptions about insecurity and misbehaving agents.