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
some kinda jackal
Feb 25, 2003

 
 
Completely philosophical question:

Why would I ever set my peripheral clock to run at less than peak clock speed?

I'm looking at the clock tree for this cortex processor and I have my PLL driving my SYSCLK at 72mhz. I then select a prescaler to drive PCLK1 and PCLK2. PCLK1 appears to be documented to run at a maximum of 36mhz so I would need to select a prescaler of /2 for that particular clock, but I see that I have the option of driving it anywhere from /1 (which would be invalid, I assume) to /16.

So I guess I'm left wondering why I would ever drive the clock that low? Is it just something that is possible but would never really be done in the real world, or is it a "balance power draw and necessary speed" sort of situation?

edit: I just saw that I can pre-prescale the entire peripheral bus by /512 to begin with :q:

Adbot
ADBOT LOVES YOU

some kinda jackal
Feb 25, 2003

 
 
If you're not really fussed about impeccable accuracy in your timers and such, is there any reason to not use an external crystal to drive a PLL loop over just the internal RC oscilator? If so, is there a rule of thumb for how the internal oscilator will fluctuate over time? I can't find anything like that in the datasheet for the NXP chip I'm using. If my application is using a timer but counting seconds are we talking like a fluctuation of a few seconds over a minute or like microseconds over an hour or what. Just curious about a ballpark.

Obviously I mean building a board from scratch, not disabling the xtal on an existing dev board ;)

some kinda jackal fucked around with this message at 05:29 on Dec 21, 2012

some kinda jackal
Feb 25, 2003

 
 
Oh awesome, thanks for that. I'm using the LPC1768 but I assume it's pretty similar. I must have missed the accuracy portion in the 800+ page manual :smith:

e: Duh, or maybe I should actually look in the DATA SHEET and not the MANUAL :downs:

some kinda jackal
Feb 25, 2003

 
 
JTAG question:

If I want to use a 5 pin JTAG connection to program/debug a Cortex MCU on a dev board, should I be powering the chip from the JTAG adapter (it provides 3v3) or should I be powering the chip from its own power supply, or does it not matter as long as the chip meets minimum running voltage requirements?

I'm going to be wiring individual cables from my Bus Blaster JTAG card to my Cortex dev boards. I suppose I can either hook up the 3v3 line from the Bus Blaster and hook it into Vdd, or I can not hook up the 3v3 line and power the MCU boards over USB like I normally would.

I'm scouring datasheets for information so I avoid blowing my BB or MCU but so far programming info seems vague at best.



(I'm specifically not using SWD because the Bus Blaster needs to be re-flashed to support SWD and I don't really want to complicate things right now)

some kinda jackal
Feb 25, 2003

 
 
Thanks guys.

At this stage I'm not too fussed about profiling. I just picked up this Bus Blaster so I could standardize my development environment for all my boards, instead of using lpcxpresso for one and code composer studio for the other, etc :)

some kinda jackal
Feb 25, 2003

 
 
Can someone help me understand microcontroller memory maps? I'm getting kind of thrown off by the high values of memory listed. Like for example:

http://support.code-red-tech.com/CodeRedWiki/CM3_MemoryMap

Like I totally don't understand what the megabytes refer to. I'm completely thrown because I understand what memory is, and I think I understand memory mapping, but apparently not because I have no idea where large values like 511MB come from. Does this refer to some physical amount of memory or is it completely logical? I mean I think I already know the answer because there's no physical amount of memory like that on chip, but I'm having trouble connecting A to B.

edit: That is to say, I think I understand memory mapping to a point, and I understand how it's used to access peripherals and such, but there's so much more to it that I don't understand.

some kinda jackal
Feb 25, 2003

 
 
Ohh so it's potential. Not "there is 4gb of poo poo addressed on this chip", but there can be.

some kinda jackal
Feb 25, 2003

 
 
Pick up any of those "PIC projects" or "AVR projects" books. The concepts and things should mostly be interchangeable if you're using C and not using some high-level library. You'll probably need to figure out what registers you need to poke to do the same thing, but a little bit of learning is good.

I did all these AVR tutorials on an ARM board and it was a great learning experience: http://newbiehack.com/MicrocontrollerTutorial.aspx

some kinda jackal
Feb 25, 2003

 
 
Vague question: Is there any MCU with an on-package accelerometer?

I mean a single chip solution, not a development board. I can obviously just add a separate accelerometer to my project but I'm just curious if this thing exists.

some kinda jackal
Feb 25, 2003

 
 
Is your ISR defined in the startup_xyz_something.c file?

some kinda jackal
Feb 25, 2003

 
 
Cornell posted their FPGA and uC design classes on youtube. Looks pretty good so far, but I haven't gotten through very much of it yet. 22 hours in the FPGA lecture, 24 hours in the Microcontroller lecture.

FPGA (2011): https://www.youtube.com/course?list=EC2BA78454E71FF0E5

uC (2012): https://www.youtube.com/course?list=ECD7F7ED1F3505D8D5

some kinda jackal
Feb 25, 2003

 
 
http://www.cs.indiana.edu/~geobrown/book.pdf

and this one was probably my favourite just because it lists a lot of cool stuff that an embedded newbie might have a hard time figuring out. Like the clock bootstrapping process, etc:

http://www.hitex.com/fileadmin/pdf/insiders-guides/stm32/isg-stm32-v18d-scr.pdf



Overall I found that ST really had no desire to get newbies interested in the ARM platform. TI has a ton of amazing tutorials on StellarisWare and gives you Code Composer Studio for free; NXP has less awesome tutorials but give you LPCXpresso, a cut down version of the Code Red IDE. I don't like StellarisWare (by virtue of being locked into a vendor's proprietary API) so I didn't go with TI, but NXP's stuff was pretty easy to get into.

Overall it is just really difficult to get into ARM programming unless you're already sort of up on embedded development I think. There is such a drought of community support outside of a few niche unknown forums when compared to something like the Arduino.

I've had to put my embedded stuff aside for the time being while I look for a job, but I have a quick prototype of my PCB exposure timer running on my LPCXpresso board already. It was really quick and easy once I got the hang of it, but I won't lie and say it was a cakewalk to get started :(

As far as libraries go, I tried not to use any. I know I probably made things a lot harder on myself by not using StellarisWare or something, but I was determined to figure out how to bitbang registers to get what I wanted done. I think this is the best way to go about it if you plan to use multiple chip families. I guess there's really no reason to, once you find a family you like, but I am really against being locked into one specific vendor. To be honest though, it's not really that difficult to bitbang registers to get things done. Most of the M3 chips I worked with pretty much had the same general flow for getting things done, even if the register fields were numerically different or something.

some kinda jackal fucked around with this message at 05:08 on Mar 23, 2013

some kinda jackal
Feb 25, 2003

 
 

evensevenone posted:

Does anyone have suggestion about using a discovery with a breadboard? The dual headers look a little annoying.

There's also this but I'm not sure what I'd be giving up.

Dual headers: Very annoying


I have the above STM32F3Discoevry. They're both M4 cortex uCs, you just have to go look up the feature set for the specific chips.

some kinda jackal
Feb 25, 2003

 
 
That's pretty much it. There's no way to plug it into a breadboard without shorting each pair of pins. At least with single headers you can either use one breadboard (admittedly a little cramped), or two separate breadboards with lots of room to grow. This is like the best of neither and the worst of both.

some kinda jackal
Feb 25, 2003

 
 
I need to write a rather simplistic firmware to replace a fried AVR chip in a student-built board that runs some lab equipment.

I'm not really familiar with the AVR infrastructure but it doesn't seem too difficult. AVR Studio looks like a nice IDE. I'm mostly curious about what sort of programmer I should pick up. I'd like something that I can use to debug on chip, if that's possible. Do the more expensive official programmers support something like JTAG? I presume the $5 hong kong ones on eBay probably won't.

some kinda jackal
Feb 25, 2003

 
 
Probably a really frowned-upon opinion, but I'm starting to think everything I need to do I can just do on an arduino because I'm way too impatient to do low level stuff these days.

I'm actually kind of looking forward to this thing: http://www.sparkdevices.com/. Cortex M3 Arduino + WiFi onboard. Use Wiring or use the JTAG headers to write low level stuff to the chip.

some kinda jackal fucked around with this message at 20:45 on May 6, 2013

some kinda jackal
Feb 25, 2003

 
 

Victor posted:

Hey that's a pretty cool Kickstarter. I don't know why yours should be a frowned-upon opinion; why must you become a microcontroller whiz and be able to design PCBs in your sleep?

Yeah I tried to not link directly to the kickstarter to avoid clashing with your project, but it's the perfect board for my little pet project (basically a clone of the Budweiser goal light). Will let me hop on the nearest wifi, and I'll just hook up an SD card to store the goal horn audio. All I have to do is write the parser to scrape the actual scores from an online source, which will likely run on an endpoint at my house anyway.

There's actually no reason it should be frowned upon, but I like to pride myself on learning something by going all out and learning every little thing about it, down to the nuts and bolts. So basically I like to abstract as little as possible. Which I guess is fine if you're just learning and toying around, but if you want to get something done in a reasonable amount of time it's best to just use the tools you've got available. I don't even want to imagine implementing a TCP/IP stack and WiFi without third party libraries though, so I would probably have gone down that route anyway.

some kinda jackal
Feb 25, 2003

 
 
I haven't really dug too deep into the unit but I hope they have plans for some sort of antenna jack on the production model. If not, yeah... ehhh..

some kinda jackal
Feb 25, 2003

 
 
I'm curious how the adoption of something like the Arduino Due with an 80-something MHz Cortex M3 affects the above. Still no FPU AFAIK, but more cycles to spare.

As an outsider to the entire industry I think part of your problem might be that there's been something of an embarrassment of riches when it comes to niche microcontroller boards lately. There's arduino and there's "everyone's kickstarter" where it's hard to gain purchase even if you have an amazing product. You're still one of dozens of boards vying for people who need something more powerful than a base Arduino UNO. I don't know enough about larger projects to comment on your particular offering and I wish you luck, but it just seems like it's an uphill battle for upstart kickstarters :(

some kinda jackal
Feb 25, 2003

 
 
Is Atmel Studio really a one-stop IDE for all their devices? Like can I use the same IDE to work on an 8 bit AVR and a SAM3/4 device? For free?

some kinda jackal
Feb 25, 2003

 
 
Asked this a while back but I think it might have gotten lost. If I want to debug AVR 8bit chips, do I need to shell out for the JTAGICE mk2 or will a Dragon do in circuit debugging as well?

some kinda jackal
Feb 25, 2003

 
 
Oh no rush at ALL. I'm just dabbling in this stuff as a hobby. If you could just try to step through something simple that would be great :)

If possible maybe set a breakpoint on an ISR and see if it lets you step through at that point?

Thanks :)

some kinda jackal
Feb 25, 2003

 
 
I finally gave up any hopes of using a native MacOS programming environment, and I got really tired of not being able to breadboard any of the Cortex chips I bought, so I'm just calling it quits on that front until I can find a good DIP cortex chip that isn't out of stock.

Atmel studio 6 is surprisingly awesome and runs really well in VMware Fusion, and the AVR simulator is pretty great. I've just got to figure out how to simulate peripheral input and I'm all set :)

I noticed it doesn't have any support for older JTAGICE devices though, so I guess I can't really use one of those cheapo eBay programmers. Still though, the Dragon is not really expensive or anything, at $46 from Newark through work. Desperately trying to come up with a simple project for them so I can justify expensing one out instead of spending my own money though :twisted:

some kinda jackal
Feb 25, 2003

 
 
Thanks for this. No specific requests, I just wanted some feedback on the usability of Dragon to step through code running on the AVR. I'm developing in a VM on OSX, but I'm not terribly worried about that. I can't imagine that would make a huge difference :)

It's actually a pretty ridiculous request so honestly unless you're interested in seeing it go then I wouldn't even bother. I can't imagine that the Dragon won't debug an AVR properly in Atmel Studio 6 ;)

(but thanks again)

And thanks to everyone for their input. I'm still investigating my options but it's nice to know there's a place to fall back on to get good opinions. I'm mainly interested in the debugging angle of working on micros because I learn best by stepping through code, so being able to hit a button on my breadboard and have a breakpoint trigger is amazing. Rather than having to hook up an LCD and display debugging messages or something.

some kinda jackal
Feb 25, 2003

 
 
IMHO as a beginner at embedded stuff, if you have a Dragon then I would just get Atmel Studio and an 8bit AVR chip and go to town.

All the other dev kits are super nice, but if you're just learning to flip registers and turn GPIO pins on and off then you'll be fine with an AVR (or pic or whatever) for a while. That's just my opinion as someone who's starting out myself. I bought a ton of Cortex dev kits but the added complexity just gets in the way. I found that throwing an AVR on a breadboard and using ArduinoISP to program it is fine. I want to get a debugger (Dragon? We hashed over this last page) so I can step through my code and program my AVR without using ArduinoISP, but I'm not really worried about exhausting the limits of an 8 bit AVR while learning.

some kinda jackal fucked around with this message at 16:57 on May 25, 2013

some kinda jackal
Feb 25, 2003

 
 
Thanks for the update, armorer :)

some kinda jackal
Feb 25, 2003

 
 
Thank you so much! A great write up :)

Since I'm just hobbying poo poo up I'm probably just going to get the Dragon in spite of some other suggestions here that I get something else. The price is right for something I plan to basically just toy around with :)

some kinda jackal
Feb 25, 2003

 
 
Yup, I've got a few ZIF sockets lying around at work so that oughtta be no problem.

some kinda jackal
Feb 25, 2003

 
 
This may be a really stupid question, but does anyone have any good material on implementing i2c communication on an 8 bit AVR uC? Just looking for something to get me going in the right direction, codewise. An implementation note would be great, but either I'm blind or I just can't find anything good.

some kinda jackal
Feb 25, 2003

 
 
Thank you, this looks great :)

I will parse through it and if I have any questions I'll let you know! At the moment this was more for my knowledge than for any immediate use, but I'm going to try to at least hack something on my breadboard sometime soon.

e: Oh man. Apparently it's all in the datasheet as well, only for some reason Atmel decided to call it straight up TWI instead of I2C. Oh, the follies of being inexperienced :downs:

some kinda jackal fucked around with this message at 12:34 on Jun 3, 2013

some kinda jackal
Feb 25, 2003

 
 
Hey Dragon users. Mine finally arrived and it is basically pretty awesome. Do you guys use the board itself to power your target or do you typically run external power to your target and just rely on the dragon to run ISP/debugWire? I read that the voltage regulators on the Dragon are fragile as a teenager's self esteem, and people are recommending using them via a powered USB hub instead of a direct connection to a computer's USB port. Is this a real thing I should be worried about?

I have to throw mine in a case anyway, and I have a big-ish project box I'm planning on using, so I'm thinking about just killing two birds with one stone and making one projectbox that holds the AVR, and has a small standalone circuit that steps a separate wall wart down to 5v for powering my target.

Just wondering how you guys are handling your fragile baby dragons.

some kinda jackal
Feb 25, 2003

 
 

Arcsech posted:

It's made (and therefore presumably documented by) Texas Instruments.

All their documentation is like that.

I thought their StellarisWare stuff was pretty comprehensive and easy to follow, for a beginner v:shobon:v

Of course that could have been a "blind squirrel" thing.

some kinda jackal
Feb 25, 2003

 
 
I found Hitex's insider guide to the STM32 to be super invaluable when it came to learning about ST's Cortex stuff. A great companion.

NXP has good ARM docs as well. I pored through their LPC1769 manual and it was really comprehensive and well written IMHO.

The Hitex guide I'm referring to: http://www.hitex.com/fileadmin/pdf/insiders-guides/stm32/isg-stm32-v18d-scr.pdf

some kinda jackal
Feb 25, 2003

 
 
I think that's part of what people's problems with it are. Something about USB ports not providing enough current, plus an additional current draw of the target micro makes components on the dragon implode.

Which I guess isn't a problem if you have a good USB port that provides the right amount of current and aren't powering the device under test.

some kinda jackal
Feb 25, 2003

 
 
Yup. I threw mine in an alum. projectbox and I'm just trying to figure out how to route the headers outside for ease of connecting. I should just make two cables and run those but I like being modular more than I like simplicity I guess.

some kinda jackal
Feb 25, 2003

 
 

Krenzo posted:

I was looking at playing around with the ARM Cortex family of microcontrollers, but I'm not sure of what tool chain and programmer to use. I already have several evaluation boards, but I need to be able to implement the chip on my own PCB and program it via JTAG/SW. Does anyone have any advice on where to get started?

You can use a lot of eval boards to program your own off-board chips via JTAG/SWD as long as they're the same manufacturer (and sometimes even not).

What's your budget? If you rule out the free offerings, you can buy Rowley CrossWorks for ARM for fairly cheap as long as you're using it for personal stuff. Then you move up to the more expensive and traditional IDEs like IAR and such.

The free ones are typically limited somehow, but they should let you program the same manufacturer's ARM chips off-board: Code Composer Studio for TI's chips, LPCXpresso for NXP's chips, Atmel Studio for Atmel's chips. I forgot what, if anything, ST provides.

Unfortunately there's not really a go-to "ARM development for beginners" manual anywhere. You have to piece it together. If you're new to embedded programming altogether then a lot of AVR or other 8-bit tutorials will be helpful. Unfortunately a lot of the other stuff you will have to figure out yourself by reading the docs. If you stick to a specific manufacturer and use their libraries then you'll probably have a lot easier time than if you just try to learn generic ARM development. StellarisWare, for example, seems to be really comprehensive and has a lot of good tutorials on TI's site IMHO.

some kinda jackal
Feb 25, 2003

 
 
Thanks for the input guys. I actually came up with a sweet projectbox enclosure for mine and dragged a few cables out the back. I'll grab a pic on Monday when I get back to the office. Really loving Atmel Studio + Dragon combo right now though.

some kinda jackal
Feb 25, 2003

 
 
I like how they have an IDE for OSX and I wouldn't have to dig around for a month trying to get a thing set up on my own which is a thing that a newbie like me has :(

AVR I'm looking at you :argh:

some kinda jackal
Feb 25, 2003

 
 
TI has done a fairly decent job supporting and documenting its Stellaris Launchpad product and if you're comfortable learning to use their StellarisWare API then I think it's probably as good a platform to start on as any when it comes to ARM. Plus you can always ditch the libraries and go to registers and bare metal, but I think TI is banking on you finding StellarisWare so easy to use that you just keep on using it.

There's a non-negligible community of MSP developers and I think they're starting to adopt the Launchpad now too. It's literally a drop in the bucket compared to the PIC/AVR online community, but if you're going to start I honestly think that's the way to go.

I say this as someone who tried to make a foray into embedded programming starting with the ARM Cortex line. I started with the Launchpad and then went to NXP's lpcxpresso platform before just ditching both and moving to AVR for simplicity's sake.

I had a big problem with learning to use a platform with a vendor library because I wanted to keep myself pretty much vendor independent so I tried to bitbang everything, but being someone who relies primarily on online support I found that the ARM communities out there are pretty much still in their infancy, whereas people have been using AVRs and PICs for forever so finding an off-the-shelf solution to a problem is easier when you go with one of the 8 bit micros. That isn't to say that what you learn doesn't apply to the ARMs -- it pretty much directly carries over and if I had a project that could make use of an ARM micro I would probably be fairly comfortable using one, but so far none of my pet projects have come close to even maxing out an 8 bit AVR let alone needed an ARM so I'm sticking with what is comfortable.

I don't want to say something like "once you learn how to code for X, coding for Y micro will be pretty much just a matter of looking up registers and switching your compiler" because that's an oversimplification, but if you start out with an AVR or PIC tutorial I think you'll find that moving up is pretty easy. If you're like me and just want to start with ARM then that's definitely doable, but you're kind of putting yourself at a disadvantage because the hobbyist community is much smaller and you'll be doing most of the grunt work yourself.

And obviously I don't want to sound like someone who's an expert in the field. I started in this thread and I'm still struggling, but I've managed to make lights turn on and RFID stuff read and motors step and all that without an arduino, so I can safely say that if I can do it, you certainly can.

some kinda jackal fucked around with this message at 19:06 on Sep 4, 2013

Adbot
ADBOT LOVES YOU

some kinda jackal
Feb 25, 2003

 
 

Arcsech posted:

Also for what it's worth, it's called the Tiva C Series microcontroller, and TivaWare now.

Shows you how long it's been since I last used my Stellaris :q:

mfny posted:

I am thinking having dev tools that work well and not be a buggy piece of poo poo would be important or maybe im being naive in my newbieness ?

I use Atmel Studio which I would consider kind of buggy and annoyingly slow, but it hasn't really hampered my ability to make a light blink. I suspect that it's probably buggy once you start to dig into the guts, but for someone who's starting out it should be perfectly fine. I downloaded and played around with MPLAB X for OSX and I thought it was pretty serviceable. It did everything I really asked of it. It's not the prettiest looking software on the block but it doesn't really need to be.

Really, all you need for an IDE is the ability to compile and upload your code (and probably not even that if you use third party tools). If you don't like the IDE then they're just tools that you can switch out for other editors. I use Sublime Text for AVR development at work since my Mac is too bogged down to run a VM with Atmel Studio sometimes.

And I'll second that Microchip has some amazing documentation. They have application notes for scenarios that I have bookmarked even though I don't use a PIC. They blow Atmel out of the water there IMHO.

some kinda jackal fucked around with this message at 19:14 on Sep 4, 2013

  • Locked thread