Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Locked thread
Delta-Wye
Sep 29, 2005

poeticoddity posted:


I don't have to send a lot of data (usually under 10 bytes at a time and generally at least double-digit milliseconds between transmissions) but it does need to move quickly. On some things, the time sensitive stuff could be moved around if I have a good way to sync a time reference between uCs.

Time synchronization is a common problem:

http://www.cs.wustl.edu/~jain/cse574-06/ftp/time_sync/index.html#Section4.0

Check out flooding time protocol.

Adbot
ADBOT LOVES YOU

poeticoddity
Jan 14, 2007
"How nice - to feel nothing and still get full credit for being alive." - Kurt Vonnegut Jr. - Slaughterhouse Five

ante posted:

I've seen people with spaghetti wire going everywhere on their projects, and I always always suggest ethernet.

It's ubiquitous, cheap, easy to terminate, the connectors lock into the sockets, and if you need to send fast signals long distance, that is literally what cat 6 is designed to do.

When I was first working on something with really sensitive timing, I was digging around trying to find the propagation delay through ethernet cabling so I could compensate for that in my code. Then I saw that it was something crazy like 0.6*c and I just laughed and realized I'd wasted all that time worrying about it.

Delta-Wye posted:

Time synchronization is a common problem:

http://www.cs.wustl.edu/~jain/cse574-06/ftp/time_sync/index.html#Section4.0

Check out flooding time protocol.

Neat. The best I'd come up with on my own was to send out a hardware interrupt line pulse from the master to all of the peripherals, but this looks way better. Thanks!

reading
Jul 27, 2013
I got an Intel Edison. Has anyone used one of these?

A colleague of mine said that he got fantastic benchmarks from one compared with the BBB and Raspi, even only using 1 thread.

FSMC
Apr 27, 2003
I love to live this lie
I go a new SSD, and decided to start from scratch. I've been working with my STM32 boards, with LCDs, etc. I have been using eclipse, but everything was limited to C. I seem to be having a nightmare trying to get Eclipse luna working, most of the guides seem to work for the previous versions. It seems like every version eclipse, code sourcery, cdt cross, etc are different and I'm getting lost.

Should I just stick with trying get my setup back working with the previous version Helix? OR what's the best setup for windows, for using C++ on STM32. (I have tried some of the other IDE's and quite liked Attolic's interface (Eclipses).

Popete
Oct 6, 2009

This will make sure you don't suggest to the KDz
That he should grow greens instead of crushing on MCs

Grimey Drawer
Alright so in an attempt to learn more about board bring up and OS porting I've bought a Raspberry Pi with the intention of doing my own port of FreeRTOS. I realize there are ports out there already but I want to do this on my own as a learning exercise for future projects.

In the mean time I've been reading An Introduction to GCC for the GNU Compilers gcc and g++ in an attempt to finally sit down and force myself to learn how to create a build system. How would go about cross compiling for the Rapsberry Pi? I realize you can compile on the Pi natively with the Rasbian included gcc compiler. But lets say I wanted to write my own bootloader for the Pi and I needed to directly invoke gcc with the right compiler options from my desktop Ubuntu machine. Would this just be setting the right -march for the ARM core? What compiler options should I be looking for and what tools do I need to directly flash a Pi?

Hunter2 Thompson
Feb 3, 2005

Ramrod XTreme
I only know a little about this, but I think you need to use a build of GCC for bare-metal ARM (the "none" ABI).

This is the package for Ubuntu, it comes with all the typical binutils
https://launchpad.net/ubuntu/+source/gcc-arm-none-eabi

Somebody please correct me if I'm wrong, I'm a neophyte.

evensevenone
May 12, 2001
Glass is a solid.
Yeah, you need a build of gcc that is set up for cross-compiling. gcc-arm-none-eabi is the correct thing there. Then you will build with "arm-none-eabi-gcc", debug with "arm-none-eabi-gcc" etc.

You'll need to look into how a Raspberry Pi actually boots. My guess is that it has a bootloader stored in ROM somewhere that knows just enough to get the external RAM and SD card running, and reads a bootloader stored in a file with a predefined name on SD-card that eventually loads Linux. So you probably can get away just replacing that file with your FreeRTOS image.

I'd recommend getting JTAG going as well, it'll probably be a fair bit of work before you even have a serial port up and running so having a hardware debugger is pretty useful: http://sysprogs.com/VisualKernel/tutorials/raspberry/jtagsetup/

yippee cahier
Mar 28, 2005

meatpotato posted:

I only know a little about this, but I think you need to use a build of GCC for bare-metal ARM (the "none" ABI).

This is the package for Ubuntu, it comes with all the typical binutils
https://launchpad.net/ubuntu/+source/gcc-arm-none-eabi

Somebody please correct me if I'm wrong, I'm a neophyte.

It comes with a precompiled C library too, which is nice and handy. You might to flesh out some newlib stubs so you can use printf. http://www.billgatliff.com/newlib.html is a guide for that when your linker can't find symbols. It's way overkill for getting printf to work.

Get FreeRTOS to do the reentrant stuff with configUSE_NEWLIB_REENTRANT and you can safely use non-reentrant C library functions.

yippee cahier
Mar 28, 2005

Unrelated career advice Q:

I'm currently working with ARM CM3 and CM4 platforms, running an RTOS. For the last little while I've been eyeing all these cheap Linux SBCs and been thinking that they were the way to go instead. Learn to write a kernel driver for some SPI connected chip on my BBB or something like that, get a job anywhere. Then I see an opportunity that would have me working with an MSP340. Yeah, I know it's a popular platform and low power applications are always popular, but moving to a 16-bit micro seems a bit like going backwards. Got any advice? Or am I overthinking all of this and as long as I don't spend 20 years working with the same chip and ignoring what's going on in the industry I'll be fine?

Hunter2 Thompson
Feb 3, 2005

Ramrod XTreme
Going to the msp430 is not backwards, it's just different! Pursue the area that interests you the most, finding a job in either won't be difficult for the foreseeable future. The msp isn't going away soon and neither is embedded Linux on ARM.

Popete
Oct 6, 2009

This will make sure you don't suggest to the KDz
That he should grow greens instead of crushing on MCs

Grimey Drawer
Cool, thanks for the tips. I figured it would be arm-none or something along those lines but just wanted to be sure. Also I'll take a look at picking out a JTAG tool, that would be very useful.

Hadlock
Nov 9, 2004

This is a really dumb question but here goes :downs: (note 12/5 = 2.4)

If I have a 2.4W, 5v solar panel in a dark room directly wired to the terminals on a 12v 4 Ah battery what happens? Does the solar panel short out the battery and the solar panel acts as a resistor generating an imperceptible amount of heat?

And then, in direct sunlight, what happens?

If I put a load on the 12v battery (12v 1W electric motor) with 2.4W 5V panel attached in direct sunlight, what happens?

peepsalot
Apr 24, 2007

        PEEP THIS...
           BITCH!

Stick a diode on the solar cell so it can only charge and not discharge your battery.

carticket
Jun 28, 2005

white and gold.

meatpotato posted:

Going to the msp430 is not backwards, it's just different! Pursue the area that interests you the most, finding a job in either won't be difficult for the foreseeable future. The msp isn't going away soon and neither is embedded Linux on ARM.

This is an unpopular opinion, but I think MSP is going to start fading from the market if ARM keeps going with the CM0+ type devices. The Arduino has already pushed AVRs in its place for hobbyists, and those hobbyists will go on to design around what they know. It requires an investment in tools for a limited range, where an ARM setup gets you from tiny CM0+ to CM3/4/7 and A5. I don't think shops that have been using MSPs will phase them out, but I don't think it's that appealing an option for a new design or a startup that needs to purchase tools.

Edit: CM0+ being 32-bit also helps portability across different scales of platform. I inherited some MSP code that needed to be ported into a platform running an ARM9, and ran into issues because the code was written to depend on storing an address in two bytes. Admittedly, that's just bad coding practice, but not having to worry about that is appealing.

carticket fucked around with this message at 08:10 on Jan 12, 2015

movax
Aug 30, 2008

Mr. Powers posted:

This is an unpopular opinion, but I think MSP is going to start fading from the market if ARM keeps going with the CM0+ type devices. The Arduino has already pushed AVRs in its place for hobbyists, and those hobbyists will go on to design around what they know. It requires an investment in tools for a limited range, where an ARM setup gets you from tiny CM0+ to CM3/4/7 and A5. I don't think shops that have been using MSPs will phase them out, but I don't think it's that appealing an option for a new design or a startup that needs to purchase tools.

Edit: CM0+ being 32-bit also helps portability across different scales of platform. I inherited some MSP code that needed to be ported into a platform running an ARM9, and ran into issues because the code was written to depend on storing an address in two bytes. Admittedly, that's just bad coding practice, but not having to worry about that is appealing.

I'm not a MSP fan at all, but they (TI) have got customers that are buying fuckloads of the things, somehow. The FRAM parts are absurd when it comes to power savings -- without trying (i.e. not using low power modes at all), the drat thing consumes 1mA at 10MHz, core + I2C running. I think ARM's got the advantage of sheer numbers + a wider tool ecosystem though, which is nothing to sneeze at.

Tiger.Bomb
Jan 22, 2012

Popete posted:

Alright so in an attempt to learn more about board bring up and OS porting I've bought a Raspberry Pi with the intention of doing my own port of FreeRTOS. I realize there are ports out there already but I want to do this on my own as a learning exercise for future projects.

In the mean time I've been reading An Introduction to GCC for the GNU Compilers gcc and g++ in an attempt to finally sit down and force myself to learn how to create a build system. How would go about cross compiling for the Rapsberry Pi? I realize you can compile on the Pi natively with the Rasbian included gcc compiler. But lets say I wanted to write my own bootloader for the Pi and I needed to directly invoke gcc with the right compiler options from my desktop Ubuntu machine. Would this just be setting the right -march for the ARM core? What compiler options should I be looking for and what tools do I need to directly flash a Pi?

Take a look at these: https://github.com/dwelch67/raspberrypi

JawnV6
Jul 4, 2004

So hot ...
How do I have 2 different JTAG cables that won't work with the chip (MSP430F2) that I'm using? Atmel and ST aren't playing nice.

I'm assuming this FTDI part won't have any restrictions and will easily be compatible with various toolchains and chips. This strategy should delay further tears until at least Monday of next week.

e: and someone just threw a FET430UIF on my desk for completely unrelated reasons :v didn't know we had one around

Mr. Powers posted:

This is an unpopular opinion, but I think MSP is going to start fading from the market if ARM keeps going with the CM0+ type devices. The Arduino has already pushed AVRs in its place for hobbyists, and those hobbyists will go on to design around what they know.
Is it competitive on power yet? We were looking at a Kinesis M0, it's lowest claimed standby 2uA was bigger than TI's maximum value 1.5uA. I had a serious problem with the stupid thing booting off of UART leakage currents on a test jig, caused a lot of confusion for operators.

Mr. Powers posted:

Edit: CM0+ being 32-bit also helps portability across different scales of platform. I inherited some MSP code that needed to be ported into a platform running an ARM9, and ran into issues because the code was written to depend on storing an address in two bytes. Admittedly, that's just bad coding practice, but not having to worry about that is appealing.
You don't need values over 65k anyway. Your way sounds lazier.

JawnV6 fucked around with this message at 18:57 on Jan 23, 2015

ante
Apr 9, 2005

SUNSHINE AND RAINBOWS
Hey, so give me two good reasons to use anything other than internal oscillators.


I would assume better stability / accuracy, but other than that... ?

No Gravitas
Jun 12, 2013

by FactsAreUseless

ante posted:

Hey, so give me two good reasons to use anything other than internal oscillators.

I would assume better stability / accuracy, but other than that... ?

Redundancy comes to mind, although I think if things have gone so far that the internal oscillator fails then you may have other things to worry about than clocks.
Also, if you need to operate timers off a strange frequency then an external oscillator might be handy.
Also, if you have many clocks ticking, it is handy to have one more extra frequency to tick them with.

Delta-Wye
Sep 29, 2005

ante posted:

Hey, so give me two good reasons to use anything other than internal oscillators.


I would assume better stability / accuracy, but other than that... ?

An example would be a situation where you wanted multiple clock domains. For example, MY UNDERSTANDING is that an external 32KHz clock running a timer peripheral is cheaper power-wise than running the internal RC oscillator on an MSP430. However, you may want to run the intenral oscillator for the CPU when it wakes up to do work because who cares about the accuracy of an 4 or 8 MHz clock when you're only running a couple dozen instructions and then going back to sleep.

Aurium
Oct 10, 2010

ante posted:

Hey, so give me two good reasons to use anything other than internal oscillators.


I would assume better stability / accuracy, but other than that... ?

The internal oscillator might be fixed.

Sharing the same clock over different chips.

One Eye Open
Sep 19, 2006
Am I awake?

ante posted:

Hey, so give me two good reasons to use anything other than internal oscillators.


I would assume better stability / accuracy, but other than that... ?

Given that internal oscillators can be out by up to +/-10% (Sec 29.4.1) without user calibration on some devices, and it can wander with temperature changes, etc., it can cause quite a few problems, especially with interfacing to other peripherals. It especially affects things like reliable serial communication, limiting the maximum speed, especially with a software UART, as I found out many years ago when using a PIC12f675's internal +/-5% oscillator(Table 12.2 - +/-1% best conditions).

One Eye Open fucked around with this message at 13:11 on Feb 1, 2015

carticket
Jun 28, 2005

white and gold.

Temperature. That's pretty much the biggest reason side from required clocks like the 32kHz clock used for RTC. You can dial in an internal RC to make it satisfactory for USB (which has tight timing requirements), but unless you calibrate it over temperature, it probably won't function for USB at cold. The new Kinetis low power parts have a USB clock recovery feature that let's you run USB crystalless over temperature (or so they claim).

movax
Aug 30, 2008

JawnV6 posted:

How do I have 2 different JTAG cables that won't work with the chip (MSP430F2) that I'm using? Atmel and ST aren't playing nice.

I'm assuming this FTDI part won't have any restrictions and will easily be compatible with various toolchains and chips. This strategy should delay further tears until at least Monday of next week.

e: and someone just threw a FET430UIF on my desk for completely unrelated reasons :v didn't know we had one

MSPs aren't JTAG compliant -- you probably get out 0x99 (if anything at all) for every shift into it, or antihero fixed byte that indicates MSP CPU core version. They can't be part of a standard system-wide chain; we use FPGAs to debug and program them in-system over a standard chain.

Once you enter debug mode (proper timed pulses on TEST and RESET_B), the behaviour is a little better, but still not ideal. The FET430UIF (grey or black one?) is your only hope. I don't remember if the F2 shares the XV2 core with the FRAM parts, but the JTAG behaviour is probably similar.

Also, yeah, leakage current is a bitch on these guys (posted about that before I think), a good reset supervisor may help avoid corruption if you can't avoid said leakage.

movax
Aug 30, 2008

ante posted:

Hey, so give me two good reasons to use anything other than internal oscillators.


I would assume better stability / accuracy, but other than that... ?

High stability
Higher clocks (if you can't PLL the internal FRC like some PICs)
Synchronous operation in a distributed system
Running chip and peripherals at highest possible speed

Lowering the BOM cost is possible if you write software that can do some calibration routines over temp, or leverage the auto clock tuning/recovery some guys advertise for low-cost USB MCUs.

Pan Et Circenses
Nov 2, 2009
Just to give a comparison with oscillators, 50ppm is pretty much the bog standard in stability for decent external oscillators. Compare that to internal oscillators that tend to be in the 10000ppm or more. Basically, if you're using an internal oscillator, you need to be VERY sure that you're not communicating with anything that has any kind of strict timing requirement. UART for example is almost certainly okay. USB of any kind and you'll probably have trouble.

Aside from that, there are application specific reasons why having an oscillator so far off would be unacceptable. I make mid-range to expensive audio equipment at my job, for example, and obviously the frequencies produced by your DAC are going to be out by however much the clock driving your DAC is out. Being off by 1% or even more is basically a non-starter.

Popete
Oct 6, 2009

This will make sure you don't suggest to the KDz
That he should grow greens instead of crushing on MCs

Grimey Drawer
The one time I've used an external oscillator in a personal project was with an Atmega328P. Wanted to generate 115200 baud and the 8 MHz internal clock couldn't get there.

Usually you see them for specific peripherals that you need to generate a specific clock for (USB, SDHC, etc...).

movax
Aug 30, 2008

I suppose it's worth clarifying that there's both external crystals and oscillators for generating clocks. With the former, you have to carefully match load capacitance, and depending on the amount specified, you may have to factor in the additional capacitance of the MCU's pins + your PCB traces. The MCU has an internal oscillator circuit that will "hammer" that external crystal to operate at the desired frequency. Crystals require no external power directly, they are basically two-terminal devices attached to your MCU.

An oscillator in this context is generally a device that generates a single-ended clock (of course there are many types, LVPECL, etc) that you feed into a single MCU I/O pin intended for that purpose. It does require external power (clean power too -- decoupling + a ferrite or RC filter is a good idea), and most usually have an enable pin. Generally 4-pin devices: VCC, GND, Enable and Clock Output. Depending on the frequency and how much you load it down, they can draw a decent amount of power; low-power applications requiring these, you'll probably want to tie the enable pin to your MCU, so the micro can enable/disable it before/after switching to it from the internal RC.

Everyone probably knew this already, but figured I'd post it for any folks lurking.

TheresaJayne
Jul 1, 2011
I am looking to have an arduino (probably nano with usb) to activate a servo to unlock a box when a special usb key is plugged into it -

The key will have power to run the arduino, and would hold one half of a public / private key so that the arduino would have the other half (simple form of not necessarily the real deal)

so only the correct usb key insterted would open the lock (servo)

any suggestions on how to read/write through a usb port without having to mess with usb protocols.

Hadlock
Nov 9, 2004

Probably easiest to squeeze a microcontroller in the key, send power over the USB power pins, and then wire up I2C, Serial or TTL over the data pins. You're just using USB for the mechanical connector, right? Microcontroller to microcontroller over serial would be the most simple way of doing that, instead of trying to replicate USB host/client crap. Initiate serial connection, send a header, the key payload, process the key for message, and then if(message = X){myservo(180);}. If you have to use USB, the Arduino Leonardo has native HID support.

My Rhythmic Crotch
Jan 13, 2011

Curious if anybody has done any super low power Cortex M0/M3 stuff? STM32L1 looks like it is out front. Datasheet says "1.2uA stop mode + RTC" which, if that's legit with no weird bullshit would be pretty cool.

carticket
Jun 28, 2005

white and gold.

My Rhythmic Crotch posted:

Curious if anybody has done any super low power Cortex M0/M3 stuff? STM32L1 looks like it is out front. Datasheet says "1.2uA stop mode + RTC" which, if that's legit with no weird bullshit would be pretty cool.

Check it against the Kinetis L series. I found the STM32Ls are beat handily in most scenarios.

Hunter2 Thompson
Feb 3, 2005

Ramrod XTreme
I use the Nordic nRF51822 at work, it's an M0 SoC with a Bluetooth radio onboard. Despite being new at embedded systems, I've found it's really easy to use for super low power stuff (6 months - 1 year powered off a CR2032 with some peripherals).

My Rhythmic Crotch
Jan 13, 2011

I've done limited tinkering with the KL26 series so I should have thought of that right away. The nrf51822 I have tinkered a lot with, but I actually want this to be a 915Mhz wireless device so the BLE radio would be redundant. I really love the USB mass storage bootloaders that come on many of the LPC series chips though. Hmm...

carticket
Jun 28, 2005

white and gold.

My Rhythmic Crotch posted:

I've done limited tinkering with the KL26 series so I should have thought of that right away. The nrf51822 I have tinkered a lot with, but I actually want this to be a 915Mhz wireless device so the BLE radio would be redundant. I really love the USB mass storage bootloaders that come on many of the LPC series chips though. Hmm...

The KL27 has a USB boot loader in ROM, I don't know what it looks like, though. I think that's one of the new things added that the 26 didn't have.

My Rhythmic Crotch
Jan 13, 2011

That's great news. It appears the USB mass storage bootloader is available on KL17 to KL47 series devices. There's not a lot of dev boards to choose from so these chips must be brand new.

carticket
Jun 28, 2005

white and gold.

My Rhythmic Crotch posted:

That's great news. It appears the USB mass storage bootloader is available on KL17 to KL47 series devices. There's not a lot of dev boards to choose from so these chips must be brand new.

They are. The 43 is the top of the family, and there's a Freedom board for $15 and there's a Tower board for it, too. I'm running into a problem where their software support for the new line is not complete. They're transitioning to something else and its lacking MQX-Lite support at the moment. Kinetis is new to me, so its crummy trying to learn the Freescale way when they're transitioning from the old Freescale way to the new Freescale way.

My Rhythmic Crotch
Jan 13, 2011

How restrictive are the licenses on their included libs and headers? Is it permissive enough to base open source projects around? It seems they have a GCC-based windows toolchain but I've never tried it. I was using bare metal GCC on the KL26 and it pretty much sucked because there was no USB stack.

My Rhythmic Crotch fucked around with this message at 17:59 on Feb 6, 2015

carticket
Jun 28, 2005

white and gold.

My Rhythmic Crotch posted:

How restrictive are the licenses on their included libs and headers? Is it permissive enough to base open source projects around? It seems they have a GCC-based windows toolchain but I've never tried it. I was using GCC on the KL26 and it pretty much sucked because there was no USB stack.

I think they have GCC versions now. Not sure about licenses, but mbed uses some of their code, so maybe it's okay to distribute.

Adbot
ADBOT LOVES YOU

Popete
Oct 6, 2009

This will make sure you don't suggest to the KDz
That he should grow greens instead of crushing on MCs

Grimey Drawer
I'm looking into options for a project I'm working on using an Atmega328. I'd like to have some sort of on board storage (NAND or NOR Flash maybe?) to store off data. Is this feasible for a small micro like the AVR Megas? What overhead and requirements am I looking at? If you guys have suggestions on interfaces or even devices to recommend that would be awesome. I don't need a lot of storage, but something persistent.

  • Locked thread