Author Topic: EEVblog #1140 - 3 CENT Micro LED Blinky with ICE!  (Read 14323 times)

0 Members and 1 Guest are viewing this topic.

Offline EEVblogTopic starter

  • Administrator
  • *****
  • Posts: 37661
  • Country: au
    • EEVblog
EEVblog #1140 - 3 CENT Micro LED Blinky with ICE!
« on: October 26, 2018, 01:10:50 am »
Getting the 3 cent Padauk microcontroller to blink a LED.
Or at least the in-circuit emulator blinking a LED with C.

 
The following users thanked this post: SeanB

Offline xrunner

  • Super Contributor
  • ***
  • Posts: 7496
  • Country: us
  • hp>Agilent>Keysight>???
Re: EEVblog #1140 - 3 CENT Micro LED Blinky with ICE!
« Reply #1 on: October 26, 2018, 01:13:56 am »
I guess I don't need to put in my 2 cents now.  ;)
I told my friends I could teach them to be funny, but they all just laughed at me.
 
The following users thanked this post: blueskull

Offline FrankBuss

  • Supporter
  • ****
  • Posts: 2365
  • Country: de
    • Frank Buss
Re: EEVblog #1140 - 3 CENT Micro LED Blinky with ICE!
« Reply #2 on: October 26, 2018, 02:51:53 am »
Looks like a useful IDE. The "go" behavior is the same as other IDEs do it, e.g. Simplicity Studio from Silabs: first click on go stops at the first line of the main function, and then you can set breakpoints, and next go click actually runs the program.

Of course, standard ANSI C would be much better. I would recommend to use LLVM/CLANG instead of GCC, if someone wants to write a backend for it, because less headache and Dave2 could probably do it in one week  with it.

BTW, you can buy from Taobao with an agent. I have used this in the past without problems: https://www.yoybuy.com
So Long, and Thanks for All the Fish
Electronics, hiking, retro-computing, electronic music etc.: https://www.youtube.com/c/FrankBussProgrammer
 

Offline EEVblogTopic starter

  • Administrator
  • *****
  • Posts: 37661
  • Country: au
    • EEVblog
Re: EEVblog #1140 - 3 CENT Micro LED Blinky with ICE!
« Reply #3 on: October 26, 2018, 03:15:06 am »
Just heard back from LCSC. They do not currently provide programming of the parts to customers, but have offered the service to me for free  ;D
When they have a public price for a programming service option they'll let me know.
So the wheels are turning.
If they offer this service then I suspect adoption will skyrocket.
 

Offline 5n44p

  • Contributor
  • Posts: 13
  • Country: it
Re: EEVblog #1140 - 3 CENT Micro LED Blinky with ICE!
« Reply #4 on: October 26, 2018, 08:05:05 am »
Give us GCC compatibility and a 10$ programmer and i'll take 1k of these.
 

Offline Whales

  • Super Contributor
  • ***
  • Posts: 1899
  • Country: au
    • Halestrom
Re: EEVblog #1140 - 3 CENT Micro LED Blinky with ICE!
« Reply #5 on: October 26, 2018, 08:45:29 am »
Give us GCC compatibility and a 10$ programmer and i'll take 1k of these.

Don't forget the programming protocol itself, it's just as important as the programmer hardware.

  • Open toolchain support (compiler+linker+bytecode gen).
  • Open programming protocol (HW levels & sequences, ideally along with the soft protocol for the official programmers)
  • Open headers (including info on entry points, everything else needed, etc)

ATMEGAs and STCs fulfil all of these (the last point is a little fiddlier in practice, but the info is still free to access).  Because of that they're damned easy to develop for on any computer + os; and will continue to be so 20 years down the track. 

Of course this is all just what I personally want, and I'm not a big company.  But this is the sort of stuff that makes the devices look like good options for students and small companies.  Arguably you want to hook these sort of people whilst they're still young.
« Last Edit: October 26, 2018, 08:50:44 am by Whales »
 

Offline timelessbeing

  • Frequent Contributor
  • **
  • Posts: 929
  • Country: 00
Re: EEVblog #1140 - 3 CENT Micro LED Blinky with ICE!
« Reply #6 on: October 26, 2018, 09:15:21 am »
Maybe it could be reverse enginerded.
 :-//
 

Offline EEVblogTopic starter

  • Administrator
  • *****
  • Posts: 37661
  • Country: au
    • EEVblog
Re: EEVblog #1140 - 3 CENT Micro LED Blinky with ICE!
« Reply #7 on: October 26, 2018, 09:22:15 am »
An official dealer will program them for about 0.3 cents each in 10k qty
https://skywiner.world.taobao.com/
Practically free!

This is getting serious.
 

Offline Whales

  • Super Contributor
  • ***
  • Posts: 1899
  • Country: au
    • Halestrom
Re: EEVblog #1140 - 3 CENT Micro LED Blinky with ICE!
« Reply #8 on: October 26, 2018, 09:34:48 am »
0.3c programming cost for 1kbyte of rom

... that's still $307.2 per megabyte!

EDIT: Doh!  $3.07 per megabyte.  Ignore me :D
« Last Edit: October 26, 2018, 10:56:05 am by Whales »
 

Offline H.O

  • Frequent Contributor
  • **
  • Posts: 807
  • Country: se
Re: EEVblog #1140 - 3 CENT Micro LED Blinky with ICE!
« Reply #9 on: October 26, 2018, 09:56:19 am »
$307.2 per megabyte, how do you figure?
 

Offline EEVblogTopic starter

  • Administrator
  • *****
  • Posts: 37661
  • Country: au
    • EEVblog
Re: EEVblog #1140 - 3 CENT Micro LED Blinky with ICE!
« Reply #10 on: October 26, 2018, 10:38:51 am »
LCSC have just said that they will offer the free programming service for a limited time to anyone. Just email them when you place your order.
 

Offline Jebnor

  • Regular Contributor
  • *
  • Posts: 170
  • Country: ca
  • Absolutely! Yes, kind of, sort of, not really, no.
Re: EEVblog #1140 - 3 CENT Micro LED Blinky with ICE!
« Reply #11 on: October 26, 2018, 12:41:12 pm »
Hey Dave & David,

Dave mentioned "YOu can test it over voltage and fully qualify one of these if you have means" (or something like that).   I, for one, would like to see the process of how to do this.  Maybe it's a niche area of interest like the Metrology gear, but I think it would be some interesting insite.
Before this, there was a typo.
 

Offline jonovid

  • Super Contributor
  • ***
  • Posts: 1425
  • Country: au
    • JONOVID
Re: EEVblog #1140 - 3 CENT Micro LED Blinky with ICE!
« Reply #12 on: October 26, 2018, 12:45:24 pm »
Chinglish   :clap: Chinese English
Hobbyist with a basic knowledge of electronics
 

Offline Fungus

  • Super Contributor
  • ***
  • Posts: 16560
  • Country: 00
Re: EEVblog #1140 - 3 CENT Micro LED Blinky with ICE!
« Reply #13 on: October 26, 2018, 12:59:27 pm »
$3.07 per megabyte.

$300k per terabyte? Totally unacceptable in 2018!
 

Offline FrankBuss

  • Supporter
  • ****
  • Posts: 2365
  • Country: de
    • Frank Buss
Re: EEVblog #1140 - 3 CENT Micro LED Blinky with ICE!
« Reply #14 on: October 26, 2018, 01:07:37 pm »
Maybe it could be reverse enginerded.
 :-//

I guess if Dave asks them, they might publish the programming protocol, but right, shouldn't be rocket science to look at it with a logic analyzer.

For the GCC or Clang port: I think Dave mentioned in the video that the assembly instruction set is documented, so should be easy.
So Long, and Thanks for All the Fish
Electronics, hiking, retro-computing, electronic music etc.: https://www.youtube.com/c/FrankBussProgrammer
 

Offline Whales

  • Super Contributor
  • ***
  • Posts: 1899
  • Country: au
    • Halestrom
Re: EEVblog #1140 - 3 CENT Micro LED Blinky with ICE!
« Reply #15 on: October 26, 2018, 01:14:15 pm »
Not sure how well the big backends can optimise for size; or if sdcc has any advantages here.  Could be interesting.

Offline Fungus

  • Super Contributor
  • ***
  • Posts: 16560
  • Country: 00
Re: EEVblog #1140 - 3 CENT Micro LED Blinky with ICE!
« Reply #16 on: October 26, 2018, 03:40:04 pm »
What's wrong with micro-C?

 

Offline FrankBuss

  • Supporter
  • ****
  • Posts: 2365
  • Country: de
    • Frank Buss
Re: EEVblog #1140 - 3 CENT Micro LED Blinky with ICE!
« Reply #17 on: October 26, 2018, 06:36:57 pm »
Not sure how well the big backends can optimise for size; or if sdcc has any advantages here.  Could be interesting.

That's the advantage of LLVM and GCC: all the optimization is already done before the backend has to translate it, and a simple intermediate result is created. You have to write only how these intermediate instructions (simple instructions like AND, OR, load, store etc.) are translated to the target machine. I guess in the end it might be not that easy, but for LLVM there is a tutorial how to do it and doesn't look too difficult:

https://llvm.org/docs/WritingAnLLVMBackend.html

And LLVM optimizes a lot. For example it can replace a loop by a multiplication and one shift (divide by 2), and some adds and subs, by detecting that the loop is just a sum of the loop variables and then applying the well known mathematically transformations (as already Gauss as a kid knew). See the compiler explorer:

https://godbolt.org/z/tzU5rc

No way SDCC would find such optimizations.
So Long, and Thanks for All the Fish
Electronics, hiking, retro-computing, electronic music etc.: https://www.youtube.com/c/FrankBussProgrammer
 

Offline Macbeth

  • Super Contributor
  • ***
  • Posts: 2571
  • Country: gb
Re: EEVblog #1140 - 3 CENT Micro LED Blinky with ICE!
« Reply #18 on: October 26, 2018, 07:50:50 pm »
LCSC have just said that they will offer the free programming service for a limited time to anyone. Just email them when you place your order.

That "limited time" offer is totally nebulous and completely impractical, but not unexpected from China.  :palm:

I hope LCSC can explain exactly what they mean by "limited time" - surely there is a minimum order qty? what is the lead time? Will they only offer it if you purchase the ICE/programmer from them?
 

Offline JuanAG

  • Newbie
  • Posts: 6
  • Country: es
Re: EEVblog #1140 - 3 CENT Micro LED Blinky with ICE!
« Reply #19 on: October 26, 2018, 10:06:53 pm »
I didnt understood how the led can blink at a visible speed

If we do that on any other low speed micro like arduino it will need a sleep/delay/interrup with timer but in the example it blinks at speeds that can be see by the eye without any of that, the chip it is running at 2 MHz so i dont understand why, i can guess that maybe it is because the I/O are extremely slow but the logic analyzer shows that no, it changes fast

Any info about that?
 

Offline chickenHeadKnob

  • Super Contributor
  • ***
  • Posts: 1054
  • Country: ca
Re: EEVblog #1140 - 3 CENT Micro LED Blinky with ICE!
« Reply #20 on: October 26, 2018, 10:21:56 pm »
I didnt understood how the led can blink at a visible speed

If we do that on any other low speed micro like arduino it will need a sleep/delay/interrup with timer but in the example it blinks at speeds that can be see by the eye without any of that, the chip it is running at 2 MHz so i dont understand why, i can guess that maybe it is because the I/O are extremely slow but the logic analyzer shows that no, it changes fast

Any info about that?
His first experiment was to toggle the pin that fast, then he divided down with the timer for his blinky. It is not that clear. re-watch from 20:00 --> end.
 
The following users thanked this post: JuanAG

Offline JuanAG

  • Newbie
  • Posts: 6
  • Country: es
Re: EEVblog #1140 - 3 CENT Micro LED Blinky with ICE!
« Reply #21 on: October 26, 2018, 10:33:56 pm »
Looks like a useful IDE. The "go" behavior is the same as other IDEs do it, e.g. Simplicity Studio from Silabs: first click on go stops at the first line of the main function, and then you can set breakpoints, and next go click actually runs the program.

Of course, standard ANSI C would be much better. I would recommend to use LLVM/CLANG instead of GCC, if someone wants to write a backend for it, because less headache and Dave2 could probably do it in one week  with it.

BTW, you can buy from Taobao with an agent. I have used this in the past without problems: https://www.yoybuy.com

Yeah, Run-> Continue it is a normal thing and i hate it, if i wanted to stop i will use a breakpoint, no?

CoIDE which it is an Eclipse by CooCox (one of the operating systems for microcontrollers) also has the option by default (i dont know if it can be changed) so it is not only a thing by the official tools

Even if the chip is very cheap and has potential i dont see any others manufacturers dont doing similar low cost chips, now that RISC V is a thing it can be done and if it trends it will happen, as it happened before with many others things like arduino/raspberry or even the Software where now the toolschains/operating systems/ides are free instead of a few thousand dollars, so taking that effort to develop a new toolchain it is not a good idea in my opinion, it is a matther of time NXP, TI and others start to release things like that to the market

Bad times for ARM if you ask me, i believe that NXP, Microchip, Cypress or ST can release a microchip below 10 cents, they cant rigth now because licences cost money, thats where RISC come in, they took any open source micro like LEON, modify it slightly and boom, ARM will be in big trouble because once you start to roll you cant stop it
 

Offline JuanAG

  • Newbie
  • Posts: 6
  • Country: es
Re: EEVblog #1140 - 3 CENT Micro LED Blinky with ICE!
« Reply #22 on: October 26, 2018, 10:41:35 pm »
His first experiment was to toggle the pin that fast, then he divided down with the timer for his blinky. It is not that clear. re-watch from 20:00 --> end.

Thanks, i will watch until the end, i stopped at 19:31 assuming Dave will do more digging so i stoped and come to ask why, he didnt say anything when shows to us the board so i thought it will be was he intented from minute one, as any of us when we try to blink a led will do, use a x00ms period blinking, i still remenber my first try, i used the oscilloscope because the code was rigth and it was really blinking but was that fast that it looks like it was on all the time, douh

Edit: Ok, i finished, i believed that the led blinking at 14:26 was the led and not the "it is alive" led of the simulator board, thats why i didnt undestand it, i imagined that the led was directly conected to the I/O as arduino/ST boards does, where you has an integrated led in the board, my mistake
« Last Edit: October 26, 2018, 10:55:49 pm by JuanAG »
 

Online nctnico

  • Super Contributor
  • ***
  • Posts: 26751
  • Country: nl
    • NCT Developments
Re: EEVblog #1140 - 3 CENT Micro LED Blinky with ICE!
« Reply #23 on: October 26, 2018, 10:54:56 pm »
Not sure how well the big backends can optimise for size; or if sdcc has any advantages here.  Could be interesting.
That's the advantage of LLVM and GCC: all the optimization is already done before the backend has to translate it, and a simple intermediate result is created. You have to write only how these intermediate instructions (simple instructions like AND, OR, load, store etc.) are translated to the target machine. I guess in the end it might be not that easy, but for LLVM there is a tutorial how to do it and doesn't look too difficult:

No way SDCC would find such optimizations.
There is more to it then just producing small code. I don't know about this particular 3 cent microcontroller but chances are it doesn't have a real stack (or no room for it). This means you'll need to write and compile C in an entirely different way which is not supported by GCC at all (and probably not by LLVM). Look at Keil's C compiler for the 8051. It is a true work of art because of the way it manages to produce fast and efficient code for such a contorted architecture.
There are small lies, big lies and then there is what is on the screen of your oscilloscope.
 

Offline coppice

  • Super Contributor
  • ***
  • Posts: 8605
  • Country: gb
Re: EEVblog #1140 - 3 CENT Micro LED Blinky with ICE!
« Reply #24 on: October 26, 2018, 11:06:09 pm »
Not sure how well the big backends can optimise for size; or if sdcc has any advantages here.  Could be interesting.
That's the advantage of LLVM and GCC: all the optimization is already done before the backend has to translate it, and a simple intermediate result is created. You have to write only how these intermediate instructions (simple instructions like AND, OR, load, store etc.) are translated to the target machine. I guess in the end it might be not that easy, but for LLVM there is a tutorial how to do it and doesn't look too difficult:

No way SDCC would find such optimizations.
There is more to it then just producing small code. I don't know about this particular 3 cent microcontroller but chances are it doesn't have a real stack (or no room for it). This means you'll need to write and compile C in an entirely different way which is not supported by GCC at all (and probably not by LLVM). Look at Keil's C compiler for the 8051. It is a true work of art because of the way it manages to produce fast and efficient code for such a contorted architecture.
The GCC ports for MCU cores which look vaguely like larger scale cores - AVR, MSP430 - work very well. Attempts to make GCC ports for very basic MCU cores - 8051, PIC8 - have been dismal failures.

Keil isn't that great. Until MicroChip bought HiTech, and killed their 8051 C compiler, it wiped the floor with Keil.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf