Which Microchip processors should I get? - Page 1
Forum section: electronics / general

author: biv
author_rank: Newbie
timestamp: October 08, 2017, 06:31:47 am
content: Hello there,I recently found out that I could get free microprocessors from Microchip as a student.http://www.microchip.com/samples/I can get 2 different microprocessors each month, up to 3 units of each.I would like to get into learning about microprocessors but am unsure which ones to get/how to utilize this resource to the best of my ability.I have been developing with the Atmega324A and Atmega328P but would like to learn about more processors.Which ones would you suggest getting and trying out?Thanks!(I tried inserting the URL as a hyperlink but couldn't figure it out)

author: ataradov
author_rank: Super Contributor
timestamp: October 08, 2017, 06:55:16 am
content: SAM D21 / SAM D11 may be a good choice for introduction to ARM. Or SAM S70/E70/V71 if you want to get some performance.But you will need to design boards for them, so the value of that free service may not be as great as it seems.It would be better to actually figure out a project, and pick a micro appropriate for that project.

author: Ian.M
author_rank: Super Contributor
timestamp: October 08, 2017, 08:42:19 am
content: Got a PIC programmer? If not the free samples will be useless to you. If using a 3rd party or older Microchip programmer always check it supports your PIC before ordering.If you stick to DIP package parts you can develop on a solderless breadboard. You could do a lot worse for an introduction to the 8 bit PICs than to follow theGooligum PIC tutorials(register for free samples of the tutorials)N.B. Microchip blocks free samples to users registered with a free email address, and allegedly blocks certain organisations and countries completely due to fraud e.g. packs of three PICS showing up on EBAY still in Microchip Samples packaging. You should be fine if you have your own domain. or a corporate or .edu address or an address from an ISP that does *NOT* do free email.

author: biv
author_rank: Newbie
timestamp: October 08, 2017, 08:45:49 am
content: I don't have a PIC programmer, or even an AVRISP either. I have one on loan from my university(AVRISP mkII), and that will soon be going back to them. I have seen these small USB programmers and will probably have to buy some of those.

author: biv
author_rank: Newbie
timestamp: October 08, 2017, 08:48:14 am
content: Quote from: ataradov on October 08, 2017, 06:55:16 amI don't mind designing boards for them, and would probably get a breakout board from them to test before making a PCB for the whole circuit.I'm really bad at coming up with projects so that's probably something I should tackle soon.

author: westfw
author_rank: Super Contributor
timestamp: October 08, 2017, 09:22:48 am
content: You'd be a lot better off spending $10 and getting one of the "ready to go" development boards like the Xplained Minis:http://www.microchipdirect.com/product/search/all/xplainedmini?mns=xplained%20minihttp://www.microchip.com/Developmenttools/ProductDetails.aspx?PartNO=DM164140The "328p Xplained Mini" is essentially similar to an Arduino Uno, except it includes debug/programming circuitry and is about 1/3 the price. That would give you the ability to run most Arduino examples, AND use a real IDE like Atmel Studio to do more rigorous development. Also, once you develop SOME expertise, you can probably use such a board to program other chips (certainly true of the AVR chips, and I think most 8bit PICs now come with low-voltage programming enabled, and MAYBE the ARM/PIC32 chips via swd.)

author: batteksystem
author_rank: Regular Contributor
timestamp: October 08, 2017, 10:04:33 am
content: Personally, I think PIC18F4520 would be a good choice, get one of them in DIP package to use on breadboard. Another one in a TQFP to learn schematic and layout design. You will need a PICKit 3 though, either original microchip or any chinese clone will work just as well. The only think I don't like is the MPLAB X development environment. I used to get a lot of samples in Hong Kong until they stop this sample service.

author: sasa
author_rank: Regular Contributor
timestamp: October 08, 2017, 10:30:52 am
content: For PIC16F and PIC18F series, pretty much any low cost programmer you can make in 10 minutes is enough.If want to have/test USB capability, old PIC18F2550/4550 is still in production. I started also 10 years ago with PIC16F84A, PIC16F628A and PIC16F877/887.These are some basic PICs have quite a bit of examples on internet and books.

author: mikeselectricstuff
author_rank: Super Contributor
timestamp: October 08, 2017, 10:33:53 am
content: PIC32MX170F256B - 32 bit in DIP package with tons of flash and RAM, plenty of peripherals to play with

author: Ian.M
author_rank: Super Contributor
timestamp: October 08, 2017, 11:03:01 am
content: I'll leave recommendations for the 16 and 32 bit families to those that use them more than I do and only consider the 8 bit PICs.The PIC18F4520 is a rather old device (released 2004) - second generation PIC18 that superseded the original PIC18F452 (released 2001). If you are looking for a general purpose 40 pin PIC18 without USB or CAN bus, you'd do better with the PIC18F46K22 (released 2010). Its 33% faster, has double the memory and more and better peripherals. Also when you've used up your free samples, its about 25% cheaper. In most applications, its a pin-compatible replacement for its predecessors with only minor code changes. The 28 pin PIC18F26K22 is basically the same but with fewer pins, and the 20 pin PIC18F14K22 is similar but with lower specs, when you need something small and cheap.There's more good Enhanced Midrange devices (PIC12/16F1xxx(x)) than you can shake a stick at. You really need to choose the peripherals and features you need for your application rather than picking a generic one to stock.For the 'classic' standard midrange devices, consider the 18 pin PIC16F88, 28 pin PIC16F886 and 40pin PIC16F887. All are top of the range for memory and peripherals and have built in silicon support for debugging, which is somewhat rare in standard midrange devices. If you need a standard midrange PIC12, get the PIC12F683 - again its the top end one in an 8 pin package. No built-in debugging for this one, but loosing 3 pins to the ICSP/ICD interface isn't really viable with only 5 I/Os and one input only pin to start with.For baseline PICs my recommendation is 'not with a long barge pole' - they are best totally avoided. There are better cheaper (non-Microchip) choices for their only remaining niche in high volume production when you need to squeeze every cent out of the cost of a simple MCU.

author: sasa
author_rank: Regular Contributor
timestamp: October 08, 2017, 11:32:16 am
content: BTW, a bit of help in choice would be the following online filter:http://www.microchip.com/ParamChartSearch/chart.aspx?branchID=1005

author: mikeselectricstuff
author_rank: Super Contributor
timestamp: October 08, 2017, 11:34:31 am
content: The new PIC16F15xxx are nice e.g. 16F15355 - lots of pin remappability, multiple UARTS, lots of PWM & other goodies. DIP up to 40 pins.

author: 22swg
author_rank: Frequent Contributor
timestamp: October 13, 2017, 02:18:09 pm
content: Hi Biv, take a look at PIC18FxxK42... a wealth of features speed and ram.... I would suggest however you walk before you run,

author: NivagSwerdna
author_rank: Super Contributor
timestamp: October 13, 2017, 02:36:23 pm
content: PIC24FJ128GA204 Curiosity Board is a nice into. Has a programmer built on the board.The earlier comments above have some good suggestions if you want to breadboard and later move to PCB and/or other packages.The PICs have a large variety of peripherals... so which one you choose might depend on what you want to do... e.g. if you want to drive an LCD screen direct... get one with an LCD driver... etc..PSMicrochip don't just do microcontrollers.... there are other interesting things to sample too.

author: JPortici
author_rank: Super Contributor
timestamp: October 13, 2017, 04:29:30 pm
content: IMHO you shouldn't get a MCU sample if you don't know for what you're going to use it.What i would do is get samples of all those juicy ADCs/DACs/Digipots and whatever, you can reuse them with any mcu you want.

author: Rasz
author_rank: Super Contributor
timestamp: October 13, 2017, 04:56:40 pm
content: Quote from: biv on October 08, 2017, 06:31:47 amyou live in Australia and have a low low price of ~$10 a month for deciding your future? coolWhen picking microcontrollers look at what is well documented, doesnt have 100 page erratas, has healthy ecosystem and following so you can get online help if needed, not random microchip errata laden garbage because they were willing to spot you ~HALF A PIZZA a month. Its healthy to practice critical thinking, start recognizing when someone is bribing you and what are the repercussions.If you really need one (and not because someone is willing to give you something for "free") get some dev boards, not bare chips. For example bluepill ($2 stm32 arduino compatible board), Teensy 3 (freescale arm), try different vendors.Quote from: JPortici on October 13, 2017, 04:29:30 pmthis!

author: eugenenine
author_rank: Frequent Contributor
timestamp: October 13, 2017, 09:30:35 pm
content: Quote from: JPortici on October 13, 2017, 04:29:30 pmOP is a student, use for it is educational, its called learning.

author: jpanhalt
author_rank: Super Contributor
timestamp: October 13, 2017, 09:37:59 pm
content: Quote from: biv on October 08, 2017, 06:31:47 amJust abuse that generosity all you want. Then sell them on eBay.Now, that is not being very decent and has led to other manufacturers pulling back from the freebies. The decision is yours. Ethically, you should request the minimum number to do what you need to do for your current project. In your case, that might be three (3) 12F509's.

author: Howardlong
author_rank: Super Contributor
timestamp: October 14, 2017, 12:41:28 pm
content: Quote from: mikeselectricstuff on October 08, 2017, 11:34:31 amAs are the PIC16F18xxx, similar specs/packages to the 16F15xxx series with a slightly different peripheral distribution. I also agree with your suggestion regarding the PIC32MX170F256B.Maybe the OP would be interested in a Microstick II, it includes and onboard debugger and comes with four devices including PIC24, dsPIC33 and a PIC32MX250F128B (similar to the PIC32MX170F256B that adds USB but with a bit less memory). You can easily use the Microstick series on their own of on breadboard. The Microstick II is compatible with dozens of devices.

author: A Hellene
author_rank: Frequent Contributor
timestamp: October 14, 2017, 01:51:21 pm
content: Well, if you insist on using 8-bitters, the following message will NOT be in favour of the PIC microcontrollers line of products.Yet, this is NOT intended to be the beginning of another uCU war; it will be about FACTS only...Quote from: A Hellene on May 05, 2012, 12:12:35 pmand,Quote from: A Hellene on April 04, 2012, 02:52:13 amThe conclusions are yours...-George

author: jpanhalt
author_rank: Super Contributor
timestamp: October 14, 2017, 02:31:33 pm
content: Quote from: A Hellene on October 14, 2017, 01:51:21 pmOf course your "facts" are not only dated but several are wrong.Have you considered the enhanced mid-range PIC's that were introduced in 2008 or maybe a little before?Just a few examples:1) The stack is accessible and up to 16 levels;2) Relative jumps of +/- 256 with the "bra" instruction; and3) Manipulations directly on the w register, like rotates, bit tests and so forth.

author: Howardlong
author_rank: Super Contributor
timestamp: October 14, 2017, 02:33:38 pm
content: The best microcontrollers are the ones that pay the rent.Reports of the death of the 8 bit market are exaggerated to paraphrase Mark Twain: we've been hearing them for a couple of decades now ;-)A reasonable approach when it comes to landing a job would be to have at least some grounding and understanding across the market.

author: Ian.M
author_rank: Super Contributor
timestamp: October 14, 2017, 02:49:39 pm
content: Quote from: jpanhalt on October 14, 2017, 02:31:33 pmAdditionally 'BRW' does a computed relative branch of up to +256 locations based on the W contents.Even the PIC18C core, introduced back in 2000, (and its successor PIC18F cores) support most of the above: The return stack is 31 levels with a modifiable top of stack and stack pointer so is fully accessible although not directly memory mapped. 'BRA' has a 10 bit signed address offset but the conditional branches only have an 8 bit signed address offset, and W is mirrored as the memory mapped WREG.It would appear A. Hellene's knowledge of the 8 bit PIC families was a decade out of date already when he first registered here.

author: A Hellene
author_rank: Frequent Contributor
timestamp: October 14, 2017, 03:01:48 pm
content: Quote from: jpanhalt on October 14, 2017, 02:31:33 pmRegarding the mid-range PICs of 2008, even the 1999 (now obsolete) AT90S family of the AVR (that predated the Tiny, the Mega and the XMega 8-bit AVR families) were ahead of those specifications above:: AT90S: The stack was limited ONLY by the (internal/external) SRAM amount.: AT90S: How can this beat therelative branchand therelative jumpAVR instructions?: AT90S: Just a (very) small subset of the AVR16 general purpose registersdirect bit/byte manipulation capabilities...Just try to builtthatwith an 8-bit PIC...If anyone needs something faster than that, with almost the same power consumption, they should feel free to ignore the 16-bit machines and directly go for the 32-bit ARMCortex-M architecture(the M0+/M4/M7 flavours).-George

author: mikeselectricstuff
author_rank: Super Contributor
timestamp: October 14, 2017, 03:04:24 pm
content: Quote from: A Hellene on October 14, 2017, 01:51:21 pmFew people will argue that AVR is a "nicer" CPU architecture, but the fact that Microchip now owns Atmel shows that the architecture just doesn't matter.

author: A Hellene
author_rank: Frequent Contributor
timestamp: October 14, 2017, 03:11:28 pm
content: Quote from: mikeselectricstuff on October 14, 2017, 03:04:24 pmYou are quite right. BUT,Are we talking aboutBrands popularity(Microchip or Atmel) or about uCU families (see:architecture) capabilities (PIC/AVR), in order for the OP to choose from?Was not me the one who suggested the (non Microchip/Atmel but STM, perhaps)Cortex-Marchitecture as the next step performance level?-George<EDIT>: Additions...

author: sasa
author_rank: Regular Contributor
timestamp: October 14, 2017, 03:12:19 pm
content: Quote from: A Hellene on October 14, 2017, 01:51:21 pmIf there is some simple logic control mid-range PICs with only 35 instruction set and much lower than 1K SRAM are pretty much good as any AVR with 120+ instruction set, probably much cheaper than AVRs. And reduced cost always means better position to beat competition and more annual income for any company...When firmware is much more complex, AVRs clearly have advantage over 8-bit PICs - the same functionality in less flash and faster execution. Etc..With (conditionally) recently making new generation of mid-range PIC family with much more SRAM and latest acquiring of ATMEL, the "war" is ended for sure for a while now.Nothing to argue about, however educational purpose is completely free of any pro et contra discussion.

author: Howardlong
author_rank: Super Contributor
timestamp: October 14, 2017, 03:44:26 pm
content: Quote from: A Hellene on October 14, 2017, 01:51:21 pmNo, of course not.

author: nctnico
author_rank: Super Contributor
timestamp: October 14, 2017, 04:05:16 pm
content: Quote from: sasa on October 14, 2017, 03:12:19 pmThe latter depends entirely on the volume which companies usually grossly overestimate. Nowadays I'd go for ARM so at least you can use a free C compiler and don't worry about speed and different kind of memories. The 8 bit PICs have a slow and crappy architecture which sooner or later requires a massive amount of work to get a project going (try to use pointers on a PIC for example). This means a lot of extra engineering costs and time and making a product more expensive compared to the competition. Penny wise pound foolish.

author: Ian.M
author_rank: Super Contributor
timestamp: October 14, 2017, 04:11:34 pm
content: Define 'free'. XC8 in Free mode is licensed for commercial use. However it doesn't do much optimisation unless you've paid for a Standard or Pro licence so bloats the code and RAM usage.The architectures are crappy, and the lower/older you go in the Microchip PIC product range, the crappier they get, OTOH if you've got a compatible programmer and just need to wiggle a few pins to bring some other chip up, a PIC10F part can look rather cost effective

author: nctnico
author_rank: Super Contributor
timestamp: October 14, 2017, 04:14:52 pm
content: If you have a microcontroller with a serial bootloader (like NXP's LPC ARM controllers for example) then the only thing you need for programming is a serial port. Some with USB can even behave as a mass storage device so you just drag & drop the firmware onto it. No need to mess around with programmers at all.

author: CD4007UB
author_rank: Contributor
timestamp: October 14, 2017, 05:24:50 pm
content: Quote from: biv on October 08, 2017, 06:31:47 amFor a beginner, it might help to start at the simpler end of the range of PIC microcontrollers. A good example is the PIC12F1840. It's only an 8-pin device but is still useful as a small MCU in a simple project. (In fact, it's also used by PICAXE with a BASIC interpreter as their 08M2.) If you have a PicKit2 (or similar programmer), you can program it in C/C++ (or assembly language, if you prefer). Of couse, you have to be prepared to dive into the datasheet, which, even for this simple MCU, is 382 pages long.Programming a PIC from scratch is not as easy as with an Arduino or a TI Launchpad (with Energia), where you don't have to get to grips with low-level details. It is, though, a good idea to get at least some experience of this type of bare-metal programming.

author: NorthGuy
author_rank: Super Contributor
timestamp: October 14, 2017, 06:00:33 pm
content: Quote from: A Hellene on October 14, 2017, 03:11:28 pmEngineering is not a popularity contest. Certainly, ARMs are popular, but does this make them more powerful?Speaking about PIC16 architecture. It is certainly somehow clumsy, but it has what you need for MCUs. For example, you can set a bit anywhere in the memory with a single instruction such asCode:bsf variable,0Similarly, it can do increments, decrements, logical operation etc. How the all-powerful ARM fares against that? Here it is:Code:ldr r1,orr r1,r1,#1str r1,This is three instructions instead of one - three times slower (given all cache hits) and three times more code space. Doesn't sound very powerful, does it? And I don't even begin to discuss how the address of the variable got into r0.But wait a minute, PIC's operation was atomic, but with ARM we now have 3 instructions. If an interrupt happens between loading and storing and try to modify other bits of the same variable ... Boom! Hopefully, your arm has LDREX/STREX instructiions. Then you can do:Code:again:ldrex r1,orr r1,r1,#1strex r1,r1,cmp r1,#0bne againIt is now 5 instructions and it takes much longer to execute, and even longer if an interrupt happens in the middle. Looks like 48 MHz STM32 with ARM hardly can keep up with 8 MHz (32 MHz FOSC) PIC16 doing simple bit-setting. Does it sound extremely powerful to you?Of course, this is only one particular operation, but this is not the only situation where PICs fare well. However, if you want to multiply bunch of 32-bit numbers as they do in benchmark tests, STM32 will go way ahead. If you really want to do lots of 32-bit arithmetics or floating point, it would be silly to take PIC16. This is something that PIC16 cannot do. But for simple embedded tasks, PIC16 is actually quite efficient.

author: nctnico
author_rank: Super Contributor
timestamp: October 14, 2017, 06:13:04 pm
content: Perhaps you should do more research before posting! Ofcourse ARM controllers have ways to set or clear bits on a GPIO so a single store instruction does the job. No need for read-modify-write and atomicity isn't an issue.

author: NorthGuy
author_rank: Super Contributor
timestamp: October 14, 2017, 07:43:06 pm
content: Quote from: nctnico on October 14, 2017, 06:13:04 pmPerhaps you're responding to my post (since yours is next to mine), but I was discussing the instruction set and haven't say a word about GPIOs, so I don't understand what you wanted to say and why it is relevant.

author: nctnico
author_rank: Super Contributor
timestamp: October 14, 2017, 07:54:29 pm
content: Quote from: NorthGuy on October 14, 2017, 07:43:06 pmGPIOs are the only place where bit-flipping is really necessary. And yet if you insist on using bits there are ARM controllers which have SRAM bits mapped to a memory address so you can set/reset a single bit with a single instruction if you want to.

author: mikeselectricstuff
author_rank: Super Contributor
timestamp: October 14, 2017, 08:00:06 pm
content: Quote from: nctnico on October 14, 2017, 07:54:29 pmAnd interrupt flags.

author: NorthGuy
author_rank: Super Contributor
timestamp: October 14, 2017, 08:33:30 pm
content: Quote from: nctnico on October 14, 2017, 07:54:29 pmI don't think so. Using flags is a very common programming technique. Besides, what I said also applies to increments, decrements, and other operations. PICs can do it directly in the memory.It is even more advanced in PIC24/dsPIC33 where you can read from one memory location, perform an operation and store it at a different memory location, such asCode:add w0,[w1++],[w2++]which executes all in one cycle. Not to mention no-overhead looping, which (as an example) lets you add very long numbers at a rate of 1 byte/cycle.Any of these operations would take several instructions in ARM, so the overall performance of the ARM processor per MHz is nowhere close.Of course, ARM can do 32-bit multiplication very quickly, and there are cases where this is important, but in many other cases it is not - what you read from sensors/ADC is usually 8-bit or 16-bit, rarely 32. So, I wouldn't equate 32-bitness with performance.Quote from: nctnico on October 14, 2017, 07:54:29 pmInteresting. I've never came across such beasts. What are they?

author: Howardlong
author_rank: Super Contributor
timestamp: October 15, 2017, 10:11:59 am
content: Quote from: NorthGuy on October 14, 2017, 08:33:30 pm"Bit banding" is available in Cortex M3 and M4(f) by mapping a 32MB address space to a 1MB physical address space. Cortex M3, M4(f) and M7 also have some additional bit field manipulation instructions.

author: hans
author_rank: Super Contributor
timestamp: October 15, 2017, 10:58:36 am
content: Quote from: A Hellene on October 14, 2017, 01:51:21 pmThis shouldn't even be an argument; just a discovery that there are multiple architectures in the world.The AVR is register based, load/store architecture as most modern architectures.The 8-bit PICs still uses an accumulator architecture.Both have their advantages and disadvantages (e.g. chip area). The AVR has 32 registers, but that also means a large context to save on an interrupt or context switch. Other architectures like ARM struggle with this as well, e.g. a huge selling point for Cortex m3 CPU's over ARM7TDMI was the better interrupt latency.Also the AVR has a powerful instruction set, but also quiteinconsistent. E.g. on ATMEGA328P there is a subtract-carry with immediate instruction, but no add-carry with immediate instruction. You can use MUL unsigned on all registers in the map, but MUL signed on only r16-r31. Memory loads only work on r16-r31 as well. AVRs have X/Y/Z registers for indirect pointer accessing, of which X does not support offsets - yet the GCC compiler likes to use the X register like that. Hence the GCC flag "mstrict-x".And I could go on.. Of course this is a limitation from the 16-bit instruction words (valid reason for PIC24 to use 24-bit instructions); but they chose to implement a feature rich ISA, which eventually grew in to this heterogenous instruction set (a nice way of saying it's a mess). It makes coding for the AVR in assembly harder (AVR-GCC7 still generates strange looking code), but you can create higher performance programs because it is more capable.The PICs are really quite straight forward and simple. Yes, you can be frustrated by the CLK/4 ratio and the very limited memory model of an accumulator architecture - but that's the way it is. And as long you're dealing with stuff in tenths of microseconds, it's probably fast enough.For learning get both architectures. Discover differences for yourself.

author: nctnico
author_rank: Super Contributor
timestamp: October 15, 2017, 11:13:10 am
content: Quote from: NorthGuy on October 14, 2017, 08:33:30 pmThat won't execute in one cycle because it needs two memory access cycles. Besides that ARM Cortex Mx has similar indexing operation (both post and pre -indexed) and the Cortex M4 (and higher) have SIMD instructions to speed up DSP algorithms. Also ARM microcontrollers usually have several memory busses capable of doing an instruction fetch, DMA transfer and memory access at the same time (modified harvard). ARM has a huge amount of resources to throw at creating really clever CPUs for microcontrollers so don't think they'll leave out anything which makes their cores perform considerably less than the CPUs from a competitor.

author: NorthGuy
author_rank: Super Contributor
timestamp: October 15, 2017, 01:51:23 pm
content: Quote from: nctnico on October 15, 2017, 11:13:10 amPIC24's instruction cycle is two clock long.Quote from: nctnico on October 15, 2017, 11:13:10 amThis is not a question of performance. They only need to make you believe they cores MUST be better than others, make sure you don't question their performance, and you will buy them. Real performance doesn't really mater. As you can see, it is working brilliantly. Marketing dollars go a long way compared to R&D. Of course, it all will be in the dust as soon as the next popular thing emerges.

author: A Hellene
author_rank: Frequent Contributor
timestamp: October 15, 2017, 01:57:07 pm
content: Quote from: Howardlong on October 14, 2017, 03:44:26 pmHey, guys! The best CPU is the one that does the job.-George

author: nctnico
author_rank: Super Contributor
timestamp: October 15, 2017, 02:49:50 pm
content: Quote from: NorthGuy on October 15, 2017, 01:51:23 pmWell so far you haven't shown me anything the ARM can't do and/or is particulary slower at.

author: NorthGuy
author_rank: Super Contributor
timestamp: October 15, 2017, 03:52:32 pm
content: Quote from: nctnico on October 15, 2017, 02:49:50 pmNo. I'm not a match to ARM marketers.

author: JPortici
author_rank: Super Contributor
timestamp: October 17, 2017, 05:06:17 am
content: Quote from: eugenenine on October 13, 2017, 09:30:35 pmeven more, he shouldn't get an MCU from the free samples program.he should buy one of the inexpensive st or cypress or atmel or nxp boards or even the mplab xpress board.. and get samples of ADCs, DACs, Other chips, which won't care a bit which processor is talking to them.

author: Howardlong
author_rank: Super Contributor
timestamp: October 17, 2017, 05:43:51 am
content: Note that the MPlAB Xpress board is that it’s programmer only, there’s no debug on board. While this might not be a problem for everyone, it's a significant limitation for many. On the other hand, the Microchip Starter Kit, Curiosity and Microstick boards all offer onboard debug.

author: Ian.M
author_rank: Super Contributor
timestamp: October 17, 2017, 06:22:12 am
content: If Microchip wished to restrict their free samples program to registered companies or to account holders at major component distributors they could easily do so. Instead they supply samples to hobbyists and students without quibbling. If they can persuade one out of a hundred students to design in Microchip parts in a high volume commercial product after they graduate it will pay for all the free samples. As a bona fide student, don't be reluctant to make use of manufacturers' free samples, but please don't abuse the program by ordering parts you do not need or by not contributing to the user community.The advantage of a Microstick is it has a very cheap on-board debugger, all the decoupling required and a suitable crystal. With care and good layout, you can do exactly the same with a bare chip, a PICkit 3 and a solderless breadboard.The MPLAB Xpress boad is a joke - they could have given it a PKOB debugger and either used their remote debugging capability to support cloud based development or provided a PKOB firmware module that implements a mass storage drop a file programmer.

author: JPortici
author_rank: Super Contributor
timestamp: October 17, 2017, 10:22:09 am
content: Quote from: Howardlong on October 17, 2017, 05:43:51 amsuggested only because it was in the sub 10 €/$/whatever classto re-iterate my point, if one need a suggestion for a "free" mcu, even if it is for learning he probably doesn't know how to choose one, to understand what he needs, he probably doesn't have the tools to program his free mcu so it's pointless.get peripherals/addon chips instead, they'll create the need and the requirements.I actually prefer no debugger than the pile of crap that is the PKOB. If you want a pickit 3 that freeze a hundred times more and has worse part support* that a pickit3... please use the PKOB.*MPLABX 4.0.1, PIC32MK GPE board, PICKIT3 has production grade support, PKOB has beta support on both programming and debugging. At least one in three times i hit pause or a breakpoint was hit, connection would be lost and the only thing i could do would be disconnect everything, kill every process, reconnect and retry. PK3 and ICD3 of course had no problems.And because it's not only for brand new boards, last i checked the same situation applies for the dsPIC33EV CAN-LIN starter kit... which is several years old now

author: Howardlong
author_rank: Super Contributor
timestamp: October 17, 2017, 01:17:26 pm
content: I can't say I've encountered such symptoms with PKOB boards such as Starter Kit, Curiosity or Microstick boards, or PicKit3 for that matter.I do frustratingly get problems connecting to the debugger (can be any of PKOB, PickKit, ICD3, RealICE) on random occasions, sometimes it seems to be to do with the specific USB port, other times it's not so clear what fixes the problem, restarting the IDE and/or reconnecting the debugger fixes it sometimes. FWIW, I usually power the target from the debugger.Recently I had a scenario where I needed to reboot after each debugging session which seemed to be hub-related, I don't use that hub anymore!

author: JPortici
author_rank: Super Contributor
timestamp: October 17, 2017, 01:29:51 pm
content: heh, while the issues i'm having may be depending on something in my hardware configuration, doesn't change the fact that the support is officially in beta while the "real" pk3 is fully supported. they should be exactly the same thing, right?

author: eugenenine
author_rank: Frequent Contributor
timestamp: October 17, 2017, 07:56:15 pm
content: So being a student are there any general area you are interested in, IOT, robotics, etc? Look for ones that meet those interests.I bought a pickit 3 a couple years ago after selling my stuff a decade or so before that. I got the pack with the 44 pin demo board so I ordered a couple of the equivalent but in dip form so I could protoboard them.I subscribe to Microchip's mailing list and when they introduce or highlight something that interests me I'll order a couple. I'm not a student so I have to order through mouser or digikey but I usually just stick a pair on an existing order so the cost is trivial. I always buy in pairs in case I let the smoke out of one

author: westfw
author_rank: Super Contributor
timestamp: October 19, 2017, 10:11:43 pm
content: QuoteBy my calculations, a modern 8bit PIC (PIC16f1707 is the datasheet I happen to be looking at) can set a bit in any IO register in two (14-bit) instructions:Code:movlb bank(regAddr)bsf offset(regAddr), regBitA modern AVR requires 3 instructions, two of which are 32bits long - 10 bytes (because not all IOregs are accessible via SBI):Code:lds r16, regAddrori r16, bitsts r16, regAddrA modern ARM CM0 takes a whopping 5 instruction plus 2 data words, for 18 bytes total:Code:ldr r1, =regAddrldr r2, ldr r3, =regBitorrs r2, r3str r2, (ok, you could do that with only 16 bytes by changing the load of regBit to a mov (immediate) and a shift, adding one instruction but deleting 4 bytes of constant.)(Cortex m3 and so on are better (14 bytes, one less register used) because orr gets a thumb2 "immediate" mode.)This doesn't include "secondary effects" - the PIC code sets the memory bank register, the AVR and ARM codes use one or more of the GP registers, etc. Nor ease of applicability to more general or less general cases. And it's not really meant to show "better" in any real sense. It's just a reminder that these things are more complicated than they seem at first glance.(Now, I don't actually program any of these in assembly language on a regular basis, so I'd be happy to see these "improved." But I did look pretty carefully, and checked C output, so I'm pretty sure that these are pretty accurate.)(I've been finding the CM0 "16-bit thumb-only" instruction set to be pretty depressing. Especially since it's being positioned against 8bit chip with versions having similar flash content. But then, I guess you're not supposed to program it in assembly...)

author: ataradov
author_rank: Super Contributor
timestamp: October 20, 2017, 02:37:52 am
content: ARM can be optimized a bit:Code:ldr r1, =regAddrldr r2, mov r3, #1lsl r3, r3, #Norrs r2, r3str r2, More instructions, but less data and lower overall memory usage. And if we are only setting low 8 bits (we are comparing against 8-bitters, aren't we?), then lsl is not needed, mov can take 8 bit immediate.It is useless to compare 32-bit and 8-bit MCUs in this respect.

author: NorthGuy
author_rank: Super Contributor
timestamp: October 20, 2017, 03:11:31 am
content: Quote from: ataradov on October 20, 2017, 02:37:52 amIf you use LDRB/STRB then you only need to access low 8 bits to reach everywhere.Quote from: ataradov on October 20, 2017, 02:37:52 amWhy not? By strange coincidence, all modern (perhaps not all) 32-bit processors are RISC. IMHO, RISC is not a good idea for embedded systems which execute code from flash. Of course, 32-bitness is a good thing, but is it so good that it overshadow all the drawbacks of RISC-ness?

author: ataradov
author_rank: Super Contributor
timestamp: October 20, 2017, 03:17:03 am
content: Quote from: NorthGuy on October 20, 2017, 03:11:31 amFor me, it absolutely is. And we are really talking about CM0+. CM3 and up have a lot of good instructions for this kind of stuff.You can't compare isolated chunks of code like this. There is a lot of optimizations that come from reusing the same constants, values in registers, etc. And that's where good compiler comes in. And GCC for ARM is a very good compiler.Furthermore, a lot of peripherals in 32-bit world are designed with registers that have set/clear on write, so you only need one write to set or clear a set of bits. This also ensures atomic operation.

author: westfw
author_rank: Super Contributor
timestamp: October 20, 2017, 06:19:42 am
content: QuoteYeah, but I had set the bar at "set any bit in an IO register", and in the ARM world, many of those registers can only be accessed as 32bit quantities. It's an interesting look at why you might want your GPIO registers to be 8bit, too.QuoteYes, and yes. There seems to be a big problem in general defining what "typical 8bit embedded code" actually looks like. This sort of "set one bit at a time" is very common. ARM will show you benchmarks on how a 32bit CPU is SO much better at doing 32bit math, which is obviously true, but 32bit math is somewhat avoided by 8bit programmers. It's hard to separate the needs from the habits...Cases like this are interesting to explore, to see what special cases are used and when they fail. The AVR has "sbi" that can set SOME ioreg bits. And it has "in/out" that would shorten the code for SOME other bits. But then if you want to make the address and bit be variables, the code bloats up even more and you get (close to) Arduino's digitalWrite() at ~50 instructions. Whereas the ARM code is already much more "generic" and doesn't HAVE a bunch of special case instructions to tempt the assembly-language programmer or frustrate the compiler writer.QuoteIntel x86 is far from RISC (perhaps far from "modern" as well, but it's still the elephant in the room.) I'm a bit stunned that there aren't more x86 microcontrollers out and about, now that the original instruction set is out of IP protection.AlsoMotorolaFreescaleNXP "Coldfire", which is essentially 68k.

author: ataradov
author_rank: Super Contributor
timestamp: October 20, 2017, 06:31:36 am
content: Quote from: westfw on October 20, 2017, 06:19:42 amx86 ISA is only efficient if supported by a very complicated multilevel cache system. Otherwise it will lose big time.

author: nctnico
author_rank: Super Contributor
timestamp: October 20, 2017, 06:32:57 am
content: Quote from: westfw on October 19, 2017, 10:11:43 pmYou forgot about ARM Cortex bit-banding and seperate bit set/clear registers on typical peripherals found in an ARM microcontroller which reduce a bit set/clear operation to two instructions.

author: westfw
author_rank: Super Contributor
timestamp: October 20, 2017, 10:36:28 am
content: QuoteI didn't "Forget." Few CM0 chips include bit-banding, and it doesn't help much anyway (you still need to load a 1 or 0 to store to the bitband region.) I didn't include the bitset/clear registers, because they're not present for all IO registers (which was my target) (frequently they're only present for GPIO pin registers. (which is one of the places they're most needed, of course.))QuoteShow me? I don't think you can get less than three instructions/8bytes (Hmm. Better than the AVR!)Code:ldr r1,=bitband(regAddr, regBit) ;; doesn't matter if direct reg or "set" register?mov r2, #1str r2,