Jump to content

yyrkoon

Members
  • Content Count

    1,408
  • Joined

  • Last visited

  • Days Won

    34

Reputation Activity

  1. Like
    yyrkoon reacted to NurseBob in Implementing an I2C slave device.   
    @yyrkoon,
    One place you might explore is under the "code examples" sections for the G2553.  In particular, I'd start with:
    msp430g2xx3_uscib0_i2c_04.c ( USCI_B0 I2C Master RX single bytes from MSP430 Slave )
    msp430g2xx3_uscib0_i2c_05.c ( USCI_B0 I2C Slave TX single bytes to MSP430 Master )
    and
    msp430g2xx3_uscib0_i2c_06.c ( USCI_B0 I2C Master TX single bytes to MSP430 Slave )
    msp430g2xx3_uscib0_i2c_07.c ( USCI_B0 I2C Slave RX single bytes from MSP430 Master )
    As the examples note, you need the external pullup resistors.  These examples will compile under CCS, IAR and GCC and while simplistic, they are a starting point for seeing the I2C comm in the debugger.
    I've used similar examples for the F2013 and F5529 to get those ICs to talk to each other, and subsequently to write code for the F5529 to talk to an sx1509 port expander (an adventure in reading and understanding docs...).  FWIW, I would never have gotten very far without using both my logic analyzer and my oscilloscope...
    As to the jtag header and spy-by-wire headers (how I build all of my prototypes) - make sure there's the 47k resistor for the reset line (most devices do not need the capacitor placed), and you may want to account for using an external supply instead of the FET.  The debuggers generally are limited in their supply capacity to ~50-60 mA.  If your circuit is driving other devices, that can lead to failure for the debugger to even start.
    HTH
    Bob
  2. Like
    yyrkoon reacted to zeke in Implementing an I2C slave device.   
    This is my approach to state machines. Your mileage may vary.
    Determine all of the sub-systems that you will want to service Commands, Controls and Inputs, User Interface, and Data Setup a system tick timer that fires its interrupt on a regular consistent basis. This system doesn't have to go into LPM4. If it does then periodically wake up the system and cycle through the software service loops then go back to sleep. Setup a series of service flags that are set during the interrupt service routine and cleared after being serviced: Flag(s) for Commands, Flag(s) for Controls and Inputs, Flag(s) for User Interface, and Flag(s) for Data Setup a variable that acts like the system timer odometer. Every Odometer == (DesiredInterval%ServiceFlag_n_now) set the ServiceFlag_n Decide how often you will service the other functional blocks of your code. For example, Update the 2x20 LCD display every one second, or Update the Serial Console every 250ms, or Retrieve the Temperature from a sensor every 15 minutes. Setup an Interrupt Service Routine to catch any characters coming into the Serial Port Buffer. Stuff them into the Input Ring Buffer Set a flag that there's something to service. In the main loop, scan all of the service flags to see if any are set. Call the servicing function for each set flag. Clear the service flag at the end of that process. Configure the program to repeat continuously until Kingdom Come.
    I've left out significant details about setting up all of the peripherals and general variables so don't forget to do that stuff.
    This is just the basic gist of my state machines on a bare metal level.
  3. Like
    yyrkoon got a reaction from NurseBob in Open Source Books that teach C Programming   
    I will add that, I do not know of the others, they look like they'd be good reads, but the Beej guide to( anything ) is not what I'd consider a good "book". I've read through several of his online books, relating to interprocess communications, and networking. Neither of those two topics were very well written, and the content is old. e.g. the content is outdated.
     
    I will also add that LDD( Linux Device drivers ) while in hard copy format is a paid book. The author felt compelled to make the book available free online: http://www.xml.com/ldd/chapter/book/ The third edition I believe is also available for free online here: https://lwn.net/Kernel/LDD3/. free electrons also seems to have a single pdf file version, but i have not looked into it.
     
    Anyway LDD2 is a very good book if you need to understand Linux device driver, I paid for a hard copy and have not regretted it.
     
    For C++, these are supposed to be pretty good as well: http://mindview.net/Books/TICPP/ThinkingInCPP2e.html, but they are dated.
  4. Like
    yyrkoon reacted to zeke in Implementing an I2C slave device.   
    I have done both of these tasks for more than one client.
    The 1-Wire protocol speed ends up being about 15kHz, which is slow but reliable. It's really cool to see on an scope though.
    I developed the I2C slave code using the sample TI code as the starting point.
    Here are the research materials that I referred to while writing my I2C code:
    http://www.nxp.com/documents/application_note/AN10216.pdf http://www.nxp.com/documents/user_manual/UM10204.pdf http://i2c.info/i2c-bus-specification http://www.ti.com/lit/an/slva704/slva704.pdf My slave code just follows the logic of the transaction.
  5. Like
    yyrkoon reacted to Clavier in Implementing an I2C slave device.   
    Clavier's Short Guide to I²C Slaves on the MSP430x2xx Family
    Read section 17.3.4.1 of the User's Guide, and the example code.
    Slave mode is somewhat easier than master mode because you do not have to care about getting the transaction sequence correct; you just react to the master's requests.
    The slave address is an arbitrary but unique 7-bit number. Just put it into the I2COA ("own address") register; the USCI module will automatically handle transactions to this address.
    You do not need to configure a clock source; the clock signal is supplied by the master.
    When the master has written a byte, you get an RXIFG interrupt. Your interrupt handler must read that byte from RXBUF. (You can set the TXNACK bit after reading RXBUF, this will tell the master to stop after the following byte.)
    When the master wants to read a byte, you get a TXIFG interrupt. Your interrupt handler must write a byte to TXBUF.
    If your code is slow, the USCI module will automatically stop the bus via clock stretching until you have reacted.
    You can get notifications when start and stop conditions happen (STTIFG and STPIFG), but that is not always necessary.
    The I²C protocol itself defines only byte reads and writes. If you have registers, you have to handle the register address yourself. Typically, the first write after a start condition is the register address, and all following writes (and all reads) are from/to the specified register (and often the register address automatically increments).
    As a slave, you have no control over what the master does; you must react to any write and read requests at any time. (If you really have nothing to read, just send the last byte again, or some garbage byte.)
  6. Like
    yyrkoon reacted to enl in More C versus C++   
    Most of his talk was not about C++, but about how to social engineer others into adopting in a non-supportive environment. It was a religious rather than technical exposition, as many Java talks, for example, also are. 
     
    As to the data, I buy it. The technical points made are that strong typing reduces run time bugs is true, under the umbrella that only certain flavours of bug are caught, but these flavours lead indirectly to bugs of kinds not caught directly. Another advantage of strong typing is that, properly used, it can let the compiler do better optimization. His test case,  a lightweight class, is probably where the advantages are greatest, but this is where, for many embedded applications, the other benefits to C++ are most available. I am not convinced that many of the 'more advanced' C++ tools and abstractions will give the same benefits, other than, with proper design, reduced debugging.With improper design (as one of the questioners put it, 'naive') there are likely to be losses. Some tools impose run time penalties that are unavoidable (often space rather than time) even with strong typing, but many of the standard tools (vector, for example) minimize this hit and save enough in other ways to be a net gain.
     
    Well designed standard tools pretty much always beat implementation specific, since they are designed (usually) by a specialist whose sole point is to get the best performance (by some metric) on the specific hardware. C++ provides a LOT of these tools. There are cases where a special purpose tool is better, but these are often brittle when changes are required, and the next revision has a net loss, either in performance (time or space) or in increased debugging.
    For reference, I tend to be a 'well written C is valid C++' kind of programmer, and use the C++ tools sparingly, especially in embedded work, and am NOT a C++ guru. I am, in fact, quite out of date with regards to the state of the C++ art. I still use the tools as they are appropriate, though.
     
    As for the social engineering aspects of the talk, nothing new. Read Dale Carnagie for the same. It is an effective model for understanding others and working with them. Nothing that hasn't been in writing for a good century, and known much longer, though in this case there is the extra fancy four quadrant graph of belief presentation.
  7. Like
    yyrkoon got a reaction from chicken in More C versus C++   
    Sure, I get it. Like you, I guess I am just more used to using C most of the time, but I still like many aspects of C++, as well as other languages.
    It's kind of funny, I was watching a youtube video the other day before bed, and I forget the speakers name( He's pretty well known, I should remember his name, but I dont - I'm not a "fanboy" that way ), where he was explaining why C++ was what he considered the better choice for embedded software development. Then he showed a chart from the last 10-15 years. Which showed C graphing upwards, while C++ was trending downwards . . . Ah right, Dan Saks, but his contention is that C++ is better than C, and I completely disagree with that. I think every language has it's place, and for different people, that will skew one direction or another.
    But there is a reason why you will never, at least within the near future, see any C++ code in the Linux kernel.
     
     
  8. Like
    yyrkoon reacted to bluehash in Other SBC's I've been considering.   
    The closest I've come to on SBCs are RasPis and BBB. They suffice most of my needs. With real time requirements on specific processes, the choice is towards any of the ARM Cortexs running bare metal or RTOS code.
     
  9. Like
    yyrkoon got a reaction from bluehash in Other SBC's I've been considering.   
    So in interest of full disclosure. I *will* be purchasing the two board I'm about to mention. Soon.
     
    The ODROID XU4: http://ameridroid.com/products/odroid-xu4
    The ODROID C2  : http://ameridroid.com/products/odroid-c2
     
    I've done a lot of reading over the last several months. In hopes of finding an embedded Linux SBC(ARM) that can be used as a desktop, as well as a work station for ARM board development. To come straight to the point. For that purpose, and in the same price range. Nothing comes close to the ODROID XU4. The things that "sinched" the deal for me was the quad A15's( quad A7's too ! ), the inclusion of USB 3.0, and true GbE networking( not shared with the USB buses ). A friend of mine has one and has demonstrated it for me a couple times. This thing is a beast ! Passed all that, one can run Android on this hardware, and I've been considering tinkering around with Android development as well,
     
    The ODROID C2 is very much like the Raspberry PI 3, but at a higher price point, and added performance / features. I think I paid $35 for my rPI including a power supply, and free shipping. That's a really good price for the hardware. The C2 on the other hand, like stated above has very similar hardware with a few key differences. First, for all intents and purposes they use the same processor type. An A53 quad core. However the C2 is clocked at 2Ghz. Secondly, the C2 has true GbE networking. Potentially very useful for many applications. Lastly, the C2 has twice the memory - 2G versus 1G.
     
    We actually have a project involved using a C2 in a professional capacity. No, this project is nothing like a NAS, SAN, or anything of that nature . . .Although it would perform that type of job very well I think. I am very anxious to get my hands on one. Very anxious to get my hands on an XU4 as well, but the XU4 will be more of a toy for a while. As well as handling any kernel, or debian package compiling I need done in the future.
     
    What boards are all you interested in ?
  10. Like
    yyrkoon got a reaction from bluehash in BeagleBone Blue robotics controller board   
    Yeah, pretty cool little board. I was offered a chance to get a "beta" board in exchange for developing open source software for this specific board. Unfortunately, I was hired full time just a week prior by a person whom was contracting some work out to me . . . So I was, and am still busy doing work for my "day job".
    I think one of the neatest things about this board, is the Octavo SoM. Which is pretty much an AM335x processor, with internal memory( no need to worry about getting DDR traces exactly right ), and from what I was told around 6 months ago from one of the team members of the SoM is that many of the processors "pins"( balls ) can be brought out and used. Where the beaglebone does have many I/O / peripheral options, but from memory, less than half of the pins are used( if memory serves correctly ).
     
     
  11. Like
    yyrkoon reacted to chicken in More C versus C++   
    I don't try to convince anybody. I'm way too busy myself to unlearn bare metal C.
    But I thought the video will be relevant for people that venture down the rabbit hole.
  12. Like
    yyrkoon got a reaction from chicken in More C versus C++   
    Didn't know you posted, heh been super busy with the day job building a monitoring system for the company, in addition to building an update system( for our own software )from scratch . . . pretty interesting stuff, and I learned A  LOT about systemd services + timers, but without actually getting into the architecture of it all. It's a nightmare trying to visualize all this in your head.
    Chicken, I've come to realize that that for myself, C is the only real way to go with embedded design. I personally find C++ good for when you need to use a lot of strings, and perhaps other various constructs, it can be ok to work with. But when you need all out performance, C will usually be the best option. Unless you're super proficient with C++, and you write all of, or at least all of the important code from scratch. Same goes for C though really. An example would be my two process application where I needed to share a file between the two halves, and I wrote my own binary file lock. Because the C std API calls were all way too slow.
     
    EDIT:
    Oh, and you can bet I will eventually get around to watching the video.
  13. Like
    yyrkoon reacted to chicken in More C versus C++   
    Here's some more C++ magic which seems applicable to embedded programming.
    I think he optimized for speed instead of space (using tons of mov instead of a loop to initialize sprite bitmaps). But a lot of impressive optimization by the compiler.
    On the downside, I didn't understand half the constructs he was using. I guess I need to relearn C++ 
    via embedded.fm podcast
  14. Like
    yyrkoon reacted to bluehash in BeagleBone Blue robotics controller board   
    There is a new BeagleBone out in the field. This one is the "Blue", following the "Black" and "Green" ones.
    Expected retail price is $80. 
    Feature list:
    Processor: Octavo Systems OSD3358 1GHz ARM® Cortex-A8
    • 512MB DDR3 RAM
    • 4GB 8-bit on-board flash storage
    • 2×32-bit 200-MHz programmable real-time units (PRUs)
    • On-board flash programmed with Linux distribution
    Connectivity and sensors
    • Battery: 2-cell LiPo support with balancing, 6-16V charger input
    • Wireless: 802.11bgn, Bluetooth 4.1 and BLE
    • Motor control: 8 6V servo out, 4 DC motor out, 4 quad enc in
    • Sensors: 9 axis IMU, barometer
    • Connectivity: HighSpeed USB 2.0 client and host
    • Other easy connect interfaces: GPS, DSM2 radio, UARTs, SPI, I2C, analog, buttons, LEDs
    Software Compatibility
    • Debian, ROS, Ardupilot,
    • Graphical programming, Cloud9 IDE on Node.js


     
     
  15. Like
    yyrkoon reacted to chicken in Make (digital) book bundle starting at $1   
    I don't know how good those books by Make are, but if you're looking for some beginner books for Arduino and Raspberry Pi and don't mind that you only get a digital copy (PDF, ePUB or MOBI), this might be of interest:
     
    Humble Book Bundles: Arduino & Raspberry Pi
    https://www.humblebundle.com/books/make-arduino-and-raspberry-pi
     
    $1 bundle:
    Make: magazine, Volume 38: Everything you need to know about DIY consumer electronics
    Make: Basic Arduino Projects
    Making Things See: 3D vision with Kinect, Processing, Arduino, and MakerBot
    Make: Getting Started with the Internet of Things
    Make: Getting Started with Netduino
     
    $8 bundle adds:
    Make a Mind-Controlled Arduino Robot
    Make: A Raspberry Pi-Controlled Robot
    Make: AVR Programming
    Make: FPGAs
    Make: Bluetooth
     
    $15 bundle adds:
    Make: Getting Started with Arduino, 3rd Edition
    Make: Getting Started with Raspberry Pi, 3rd Edition
    Make: Getting Started with Sensors: Measure the World with Electronics, Arduino, and Raspberry Pi
    Make: Raspberry Pi and AVR Projects
    Make: Arduino Bots and Gadgets
    Make: Sensors
    Make: Getting Started with the Photon: Making Things with the Affordable, Compact, Hackable WiFi Module
     
  16. Like
    yyrkoon got a reaction from zeke in Open Source Books that teach C Programming   
    I will add that, I do not know of the others, they look like they'd be good reads, but the Beej guide to( anything ) is not what I'd consider a good "book". I've read through several of his online books, relating to interprocess communications, and networking. Neither of those two topics were very well written, and the content is old. e.g. the content is outdated.
     
    I will also add that LDD( Linux Device drivers ) while in hard copy format is a paid book. The author felt compelled to make the book available free online: http://www.xml.com/ldd/chapter/book/ The third edition I believe is also available for free online here: https://lwn.net/Kernel/LDD3/. free electrons also seems to have a single pdf file version, but i have not looked into it.
     
    Anyway LDD2 is a very good book if you need to understand Linux device driver, I paid for a hard copy and have not regretted it.
     
    For C++, these are supposed to be pretty good as well: http://mindview.net/Books/TICPP/ThinkingInCPP2e.html, but they are dated.
  17. Like
    yyrkoon reacted to zeke in Open Source Books that teach C Programming   
    I stumbled across a list of nine open source books on Hacker News today that will help people learn how to program in C.
     
    YMMV
  18. Like
    yyrkoon reacted to zeke in For Sale: Clock ring (APA102 based)   
    @@yyrkoon,
     
    Check out the linki @@timotet posted.
     
    The way I describe this LED is that it's an addressable RGB LED that uses a one way protocol SPI-like protocol.
     
    Each LED emitter inside the unit consumes up to 20mA of current for a grand total of about 60ma when the color White is commanded.
     
    The refresh speed appears to be quite quick - faster than the common WS2812 RGB LED anyways.
     
    I believe I have the SPI configured for an unrealisticly high speed of 8MHz and the LEDs are working, mostly. In my test code, the last LED's Red element glows slightly. I beleive if I were to slow down the SPI port then that artifact would go away.
     
     
    My motivation for making these rings was to push myself forward to learn new skills with Altium, MSP430s and to make a clock that my kids would enjoy having in their rooms.
     
    My motivation for offering these units for sale is to gauge the interest of you all in this technology. Not many people seem interested therefore I can conclude that this design is a dud i.e.: It's just a clock.
     
    I am considering a completely different kid friendly design using these LEDs where I will use a standard sized picture frame and install a single board matrix of APA102Cs that can display pretty much anything your creative mind can come up with.  I'm still doing a feasability study on that design.
     
    Feel free to ask questions.
  19. Like
    yyrkoon got a reaction from spirilis in RANT: Cloud of this, IoT of that . . .   
    I should point out that I have absolutely zero interest in anything apple / mac.
  20. Like
    yyrkoon got a reaction from zeke in What is "our" time worth ?   
    I think this job will keep me busy for a while. So, I do not think I'll be doing any work for anyone else while that holds true. My needs are rather modest . . .and I'll be meeting the company owner face to face very soon. Flown across the country to meet with the guy, to talk about the future of the systems software, etc. As well as play with their test bed.
  21. Like
    yyrkoon reacted to Rei Vilo in RANT: Cloud of this, IoT of that . . .   
    Read 
     
    CES 2017: Hands-On With a Smart Ring, Smart Shower, Smart Shoe, and Smart Everything 
    at http://www.macrumors.com/2017/01/04/ces-2017-hands-on-day-one/
     
    Hint: there's even a connected smart brush!
  22. Like
    yyrkoon reacted to zeke in What is "our" time worth ?   
    @@yyrkoon
     
    I am thinking of all kinds of things but the first is this...
     
    Congratulations! You did it! You Delivered! Clients love it when you DELIVER! Good Job!!!
     
    I am also thinking how you have begun to develop a process for doing various tasks. Things like this:
    - How do I capture the client's requirements?
    - How do I program a chip?
    - How do I invoice the client?
    - and so on ...
     
    Once you have figured out one of those processes then I recommend writing it down immediately. Then you will remember how to do it next time. Also, you will be able to teach your employee how to do the same thing in the future.
     
    I'm also thinking about liability. That is, this hush hush product is now out in the wild being used. Will it fail? When will it fail? How will it fail? Will someone get injured or die if it fails? If any of that happens then who will bear the liability for that unintended and unexpected event? For me, I have an insurance policy that covers me for "Errors and Omissions". That's the policy type.
     
    And then I am always hunting for the next job or task. Who could or should I talk to to get more work?
     
    I'm sure there are many other things that I could think about but it's important to celebrate the present successes first.
     
    <fistbump>
    Good Job!
     
    This is awesome. Let's do some more of this!
  23. Like
    yyrkoon got a reaction from energia in sprintf weirdness on cc3200   
    Hello . . .
     
    So first thing off. Your buffer is too large. This isn't Windows, or even Linux. This is an embedded device where memory is at a premium. Now, perhaps 500 chars( or bytes ) may not be too much, but still far from necessary. reduce its size to ~100.
     
    Second off, you should zero out your buffer before you use it. Use memset() or at initialization assign the value of {0} like so:
    char buffer[100] = {0}; Thirdly, don't use sprintf(), use snprintf() if available. It's much safer. However if you're dead set on using sprintf(). Check the return value. You're not checking the return value in your code, so for all intents, and purposes. Your code will fail silently.
     
    Lastly, float types can sometimes behave very oddly if you're not careful how they're initialized, or used. Sometimes even just adding an 'f' at the end of a value can help. Post-fixing the type, but that's not strictly speaking, necessary.
  24. Like
    yyrkoon reacted to Rickta59 in More C versus C++   
    # best solution
    $ while true; do for sensor_file in /tmp/bus/w1/devices/28-*/w1_slave; do echo "scale=2; $(cat ${sensor_file} | grep  -E -o ".{0,0}t=.{0,5}" | cut -c 3- )/1000.0" | bc; done; sleep .5; done
  25. Like
    yyrkoon reacted to Rickta59 in More C versus C++   
    You are linux. Maybe you should just bash it:
    #!/bin/bash SENSOR_FILES=$(echo /sys/bus/w1/devices/28-*) while true; do for sensor in ${SENSOR_FILES}; do VALUE=$(sed -e 's/t=//' < $sensor); echo "scale=2; ${VALUE}/1000.0" | bc; done; sleep .2 done; -rick
×
×
  • Create New...