Это видео недоступно.
Сожалеем об этом.
#156
HTML-код
- Опубликовано: 1 авг 2019
- An improved ATMega328P with this cheap clone Logic Green LGT8F328P running at 32MHz (eventually)
$8 off your first order at LCSC Electronics with lcsc.com/?href...
Seriously, folks, see all this information with full colour pictures, step-by-step instructions and much more on my GitHub:
github.com/Ral...
Links to all products at the bottom of this description
So we're looking at the 32MHz Nano-sized drop-in replacement but I'm using a different sized development board just for ease of use in the video. My device looks like this (and well worth it for experimenting with)
github.com/Ral...
But the final device is Nano sized, and a drop-in pin replacement
github.com/Ral...
Or you can have a Pro-Micro sized device that will require a USB-to-Serial adapter to program.
github.com/Ral...
The 6 simple steps to get a LGT8F328P-based board running at 32 MHz are listed on my GitHub.
github.com/Ral...
6 Simple Steps to get a LGT8F328P-based board running at 32MHz
*1 Download the LogicGreen zipped resources here*
github.com/LGT...
There's a copy of this zipped folder on my GitHub
*2 Extract the download (unzip it)*
and move the unzipped LGT/avr folder to under the hardware folder in your Arduino sketch folder. If you do not have a hardware folder in your Arduino Sketches folder, just create one.
Your structure should look like this:
github.com/Ral...
*3 Replace the boards.txt*
In the Hardware - LGT - AVR folder **delete the boards.txt**.
Then copy the boards.txt in this GitHub there in place of the one you just deleted. Easier than trying to edit it!
Testing
-----------------------------------------------------------------------------------------------------------
Oh no! I've exceeded my RUclips word count so head on over to my GitHub to complete the process!
github.com/Ral...
-----------------------------------------------------------------------------------------------------------
What's this GUID then?
Each LGT8F328P has a unique GUID (serial number) built in. Useful for encrypting things.
To retrieve the number (it's read-only) do this in your sketch setup():
uint32_t guid = *(uint32_t*)&GUID0;
To display that number in its intended *HEX format* do this:
Serial.println(guid, HEX);
Simples, right?
======================================
LINKS LINKS LINKS LINKS
======================================
Please visit my sponsor who made this video possible!
$8 off your first order at LCSC Electronics with lcsc.com/?href...
*KEYES Open Source LGT8F328P Control Module Development Board*
www.banggood.c...
*AliExpress Nano/pro Micro replacements*
LGT8F328P LQFP32 replaces NANO V3.0 HT42B534 chip
s.click.aliexpr...
This seller has both variants (SOP20 & LQFP32) but look around there are other sellers too!
*Logic Green's GitHub for the support files (also on my GitHub)*
github.com/LGT...
*LGT8F328P Schematic (also copy on my GitHub)*
www.electrodra...
*Chinese Documentation for what it's worth*
www.logicgreen....
English version of similar family of chips on my GitHub
*Top 10,000 Prime Numbers*
www.di-mgt.com...
If you like this video please give it a thumbs up, share it and if you're not already subscribed please consider doing so and joining me on my Arduinite journey
My channel and blog and GitHub are here:
------------------------------------------------------------------
/ ralphbacon
ralphbacon.blog
github.com/Ral...
------------------------------------------------------------------
Thanks for covering this Ralph, i enjoy working with the NRF24 modules and have done since your first video years ago. However i moved on to the Rfnano's from keywish V1.0 which worked but had other issues so abandoned them. I recently noticed keywish were selling a V2.0 with ipex ext connection which was what i previously wanted - and i overlooked the fact these new ones were LGT8f328p and had no idea. I managed to get them running, and performance was good but came across the Baud rate issue, the seller didn't initially mention i had to use the nulllab package and i was sucked in with the arduino compatible statement. They also provided a few lines of code including a sysclock and a digital toggle on 13 but i coudnt work out how to use it ! i couldn't get to 32Mhz without using your work and the "boards text" - i found mine unstable, locking up but that maybe down to my coding but it was 32Mhz and isn't that important to me so i run at 16Mhz as i just really wanted the ipex facility.
Have you considered one of the now many ESP32 variants? Arduino compatible (albeit at 3v3 not 5v) and many have IPEX connectors or built in antennae. I used some of the newer C3 and S3 variants recently and they work well (I usually use the larger ESP32 DEVKITC v4 which gives more GPIO pins).
The use of an external aerial makes a lot of difference, I've found. I've only used a few like that (two are up in the attic, one at the far end of my house) but the difference was quite amazing!
@@RalphBacon Thanks for the reply, I have thought about it but don't know where to start or which board/s to try. I will look through your videos on the subject.
Look at some of the well known brands, such as Adafruit, Sparkfun, DF Robot, Seeed Studio - they all make the smaller ESP32 variants (C3, S3). They won't be cheap from these sort of places but the quality should be good.
Amazon will probably sell them all plus all the cheap no-name Chinese clones, some of which are also very good, albeit mostly without much documentation. In the UK, The Pi Hut and Pimoroni are great resellers too.
The Arduino IDE supports them all so you just scour the Internet on how to add those boards to the IDE and you will soon be up and running.
The built-in DAC is what compels me to adopt this board. Previously I was using expensive and bulky DUE boards with the humongous Atmel ATSAM3X8E chip. Was really disappointed the RPi Pico had no internal DAC. Same with the Blue Pill. I guess the expectation is that we'll add an external serial DAC or use PWM and an external LP filter.
I've been eyeing these clones myself. I'm very happy you've been investigating the STM32 and Atmega "Functional Replacements" (aka clones) from a hobbyist perspective! Information regarding these things is quite hard to find.
Now you need to get a couple, Mike, and start using them and see how they perform. That's when it gets really -frustrating- interesting!
Thank you so much for your work and to dbuezas! As you know I am a real newbie to this but i got both my Wemos LGT8F and my green LGT8F running from your sketch and his board manager url at my first try! These boards are a great deal, and at half the price of a regular Chinese clone of a Nano. Very strange that they don't wish to divulge the name of the chip on the ic itself, though. Thanks again!
I'm very glad you got it all running, that's awesome! If you want to identify the chip, rumour has it that the name is _underneath_ the chip, so go on, get out your hot air desoldering stations and remove it. Then tell us what it is (if anything). Then resolder it back again. What? You don't want to do that? Me neither! We'll just have to live in ignorant bliss, for now, anyway!
At 79p I will have to order one to do just that ...
@@almostanengineer Good man! If you need to split it, i will go half with you! Lol!
Following on from my last comment I have just tried adding the extra lines in the code in the blink sketch, as this is an ideal way of "seeing" the clock speed.
With the Logic Green board selected, it would not load. However, going back to the standard AVR boards, and selecting 'nano', it loaded and ran perfectly! If I coded,
(clock_div_1);
The blink sketch ran at twice the normal speed. Coding (clock_div_2); made it run at normal speed.
A great success, I'm very happy, thank you!
It may be useful to let your viewers know there are clones out there that use the AVR Board type, and those two extra lines of code are all that is needed.
Nice to know such a simple change gets the full speed of the processor, thanks for sharing.
Great video. Very informative as I’ve not seen those. Only just ordered stm32 boards due to your video and now I’ll be getting those. Thank you, Ralph.
Sounds like you will be very busy, Chris, have fun!
Wow, you made me famous! (blush) -- My own order of these boards is still not here! I am jealous.
Am interested in trying to compile USBASPLoader and other VUSB projects on these. Will be fun to find out if the RC oscillator is accurate enough for the device to bang out USB 1.0 (shrug). The whole idea is to use serial over USB (ACM) without the need for an FTDI / CH340G companion. Of course, the mega48/8/88/168/328 already do this, but have little time for anything else reliably above 9600 baud.
I remember using #ifdef clauses undefine/redefine the F_CPU value for my 12mhz boards, then setting the divider from within a sketch w/o a boards definition. Will let you know. Will definitely be using the new, proper LGT8xxx core for the other enhanced features anyway ... and giving your github page a visit. Though subscribed and notified for your channel, I have still received no notification for this one. Maybe it will be along later today.
Enjoy your 15-minutes (well, more than that) of fame, GnuReligion (you still didn't tell me how to pronounce that). Regarding being notified, you have to click the bell AND say you want notifications - something RUclips seem incapable of fixing. But good luck with your boards (when they arrive), keep us all posted.
@@RalphBacon GNU is pronounced like the animal--"new". So a new gnu sounds like a speech impediment.
Excellent video.
Like many, I got caught by an Ali trader selling WAVGAT pro mini boards (cheap) as Atmega328P chip - which they weren't. They had been consigned to the bad buys bin.
This video prompted me to see if they were LGT8F328P boards - which they seem to be. At least they perform that way - I ran the primes from your Github and got the results. So there are probably a lot of disenchanted buyers of these boards who don't know they are sitting on a little treasure.
There are some really interesting 'extras' on this chip which you have mentioned. But also an analogue comparator function with 10mV resolution which opens up all sorts of goodies.
I look forward to your next episode with great interest.
The WAVGAT boards are well known for having this chip on them. But, as you rightly say, if buyers are not aware of what they are buying they will wonder what it is they have bought. I'm convinced that on many occasions the seller is not _au fait_ with the things he's selling. S/He is just selling stuff. They (probably) don't use it themselves at all.
Is there a discreet pin or set of pins that implement the analogue comparator or is it a software thing? How do you set it up?
Robert Coyle The ‘details’ are in the dual language data sheet on Ralph’s Github. In/out pins are given and there is a whole section describing it later in the document. There seems to be some digital filtering that can be enabled too. Haven’t had a chance to see if I can make it work - it’s a bit close to the edge of my comfort zone!
@@mahudson3547 Thanks for the response. I'll give it a look.
Great video and glad to see basic Arduino stuff still has a place. Never found too much use for an UNO, but love the 32u4 boards as the can emulate USB devices and I use the Nano quite a bit too due to cost. I'd rather build projects around multiple cheap boards, especially the Nano rather than build something complicated on a single more powerful device 😀
Yes, there is still plenty of life in the Arduino Uno/Nano and this sort of device ensures it is not being left behind in terms of capabilities or speed!
@@RalphBacon I have two UNO clones. I just use them with boot loader shields fitted. For anything else I use a Nano, Pro Mini or chip on a breadboard
Got my boards today. Followed your instructions and it worked a treat! Thanks very much. Now to play around with this.
Glad to hear it, now you get to play with them, as you say!
Thank you for very informative video. Thanks to your video, next batch of Nanos that I'll order could quite likely be LGT8F328P based.
Yes, me too, these seem an ideal replacement for a Nano, just improved!
Interesting chip, I should get some to have a play, I’m more interested in the higher voltage reference levels and higher ADC bits
Indeed, speed is not everything, but there's enough on this chip to make it interesting to a wider audience, I reckon.
Great video again Ralph, that is a very interesting chip and great bit of detective work to get that running at 32MHz. A lot of chip manufacturers actually print the details on the underside so that it's hidden so if you blow up one of these and fancy sacrificing it then you might find writing there...
I did think this too but wasn't prepared at the time (pre-video) to desolder one, but as a couple of viewers have suggested I might just do that now (and I feel more confident now about soldering it back on too).
You're a genius with relevant interesting content, clearly explained. Go Ralph!
Wow! High praise indeed. But I'm still not sending you that $20! Glad you enjoyed it and thanks for posting.
The boards arrived, and after reading carefully your instruction (i am not a native speaker) it works like a charm - so many thanks for your time and the sharing of your knowledge!
Glad to hear you had success, Mike. Some would say I am not a native speaker either, the way I mumble through my videos, but they are just rude! Thanks for posting, great to hear from you, wherever you are.
@@RalphBacon rudeness and quality are not natural enemies :-) I am one of that fu* Germans - so greetings from Berlin
I've never been to Berlin, Mike, but my family all live around Stuttgart as my Mutti is German (I am only half). I am the only one in England now, mit diesem Scheisswetter und Brexit jetzt auch noch dazu! Oh well, mustn't complain. Mfg.
@@RalphBacon
I know the Swabian area quite well - I was married twice with a woman from there :-)
I really like Scotland, my first visit was in 1984, I wanted to see the island of George Orwell (Jura) - they stay with us - you'll see this :-)
Er, married twice to the same woman? You know what they say about Schwabishe Frauen - zugeknoepfte Taschen, or in the English idiom, Tight as a Duck's Ar*se! Sorry, I mean to write 'frugal' but my fingers would not obey me.
I've never been to Scotland. One day, one day...
They are the Pro mini and Nano replacements, I really like the fact that it has 12 Bit ADC and DAC. That helps alot ! Im switching :-)
If you find the missing 1% (apart from EEPROM being shared program memory) do let us know, John! Thanks for posting.
it's a good job it's 99% compatible! as looking at the Chinese data sheet your have a real problem to change any of the internal settings for SPI, i2c etc other wise. being old school I wish that fuses were still called configuration bits, in my mind fuses are one time settable as in Programmable Array Logic (PAL's) etc. blow the wrong fuse and throw the chip away and get another out of stores.
I'm with you on that term! I guess 'fuse' is shorter, trendier but ultimately less accurate (although there _some_ fuses which will brick your chip if set incorrectly; even the RST fuse will do that, so you can't upload - then you'd need to use my fuse resetter PCB with 12v to fix it).
Hi Ralph,
Great information, thank you
ATB Adam
Glad you think so, Adam, great to hear from you, thanks for posting.
This chip is pretty amazing. A differential ADC will let you do things you normally can not do with a single ended. I agree with you that for the Chinese to make any money they would have to make millions. So there must be large market in China/Asia for these since it seems no one knows about them around here. This chip narrows the gap between the lower end STM32's and Arduino standard.
And the fact is it a pin-compatible drop-in also helps, Joey.
I found one on ali baba for 71 cents, however the shipping was 1.60 so not such a bargain. I find them now on Ebay for around 3 bucks each. Don't need any right now and bucks are short, however just a note. My better half did clam onto my income from selling off my Orange Micro PC on Mac cards, but when it came time to transfer the 2 hundred bucks I got out of the pair, she relented and told me to keep it and spend it on things I need for my hobby. What a sweetheart, no damn wonder I stayed married to her for over 50 years now, and I even neglected to get her a box of candy yesterday on Valentines day, however I have been ill now for a couple of weeks and spent all morning in the Doctor's office whilst he tried to balance my narcotic intake with sleeping pills, anti-PTSD medication and now a needed anti-histamine because of fluid in both my ears that keep making me fall down when I am not concentrating on NOT falling down. Hope this will turn out OK, he as referred me to a major hospital where they will try and get the pain under control and perhaps work on taking me off the damn narcotics he has been pushing into my system for over 25 years,
Your wife sounds like a real sweetie! Sorry to hear you are having such a mountain of health issues, I wish you well and a speedy recovery. Positive vibes being sent in your general direction.
That was interesting, I never knew about that board.
I think high output current pins is bigger thing than 32MHz. If I need cpu power, I tend to pick up ESP32 or ESP8266 type boards. For hobbyist a tiny price difference is not an issue usually unlike in high volume product manufacturing. However, in many my applications there seems to be a need for external drivers to drive relays etc.
I'm sure there are some situations where you are on the edge of enough power and there 32MHz helps though. More cpu power is never a bad thing.
Oh man, that DAC and 12b ADC are the bee's knees for mee's :-)
I didn't even notice the 80mA bonus feature before I ordered some of these. I don't know if I would connect a relay though. Do you trust a simple clamping diode with a relay coil on a pin directly connected to the μC? I think I'd want to add an additional zener clamp or something, especially with a surface mounted μC design. That would result in the same, if not more complexity, but I do unnecessary foolish stuff out of caution far too often. I could definitely see myself using this to power more peripherals directly from the GPIO though, especially something like a wireless radio connection.
-Jake
@@UpcycleElectronics DAC could really be usefull to keep parts count down and when you need faster output than filtered pwm gives you. I see the point of 12b adc too, even though my projects have been fine with standard 10 bit.
I see no reason not to rely on something liike diode clamp with a relay. A schottky near relay should do just fine. However, cpu power needs some extra care due to larger currents than normal.
Glad that everyone seems happy with this board!
Another great video sir! Very interested in seeing some tests of that 12-bit ADC (and the 12-bit PWM mentioned in the comments)...
Yes, I (or others) need to do some experimentation. Why not get a couple and try them out, Gavin?
@@RalphBacon Well funny you should say that... I have indeed ordered one.
I'm not sure I have the understanding or knowledge to investigate new features though, or to indeed to have got them running at 32MHz by myself.
I can, and will, follow your wonderfully clear instructions! But that says much more about your knowledge and understanding than mine.
I just dig and dig and try things out and read datasheets! Even Chinese ones! Win some, lose some.
Here's a more convenient method, Install via board urls:
github.com/dbuezas/lgt8fx
This video got me hooked in the topic and for convenience I made a board package definition to install via url. It has all frequencies between 1-32Mhz and the clock prescaler hack is not needed anymore!
Thanks Ralph!
I'll add that link into my GitHub too, David, excellent work, very nice to use. Can I pretend I did all the work instead of you... whatsat? No deal? Oh, Ok... credit where credit is due then! 🤣
Just got a few in the mail today, and came across your comment when re-watching the video. Saved me so much time. Thanks dbuezas - great work.
@@slm60uk Thanks! Glad to hear it is already being used :)
@@RalphBacon Haha, well you did get me hooked and provided the initial pointer to clock_preset :)
By the way, I got the differential amplifier to work with two pins. Now I need to make a proper interface and allow for choosing arbitrary pins and gains.
Soon we have a new feature in the board!
Sounds great, true collaboration indeed. :)
Thanks for making this video! I have been looking for a 5v 12bit ADC Nano or something similar for a while! Super handy. Thanks again.
Glad you found it useful Carl, thanks for posting.
excellent video ..saw those boards on eBay and did wonder if they'd work in some of my more 'demanding' Arduino projects ..think i'll have to buy some to try.
It should - just make sure the chip on the board is actually an LGT8F328P and not some other weird chip!
great video, never heard of this IC. I will need to find the datasheet and see if it's pin-compatible, it could be a good little replacement ic for a project
Yes, it's pin compatible, Colin. Datasheet should be in my GitHub. But there are some minor differences, apparently, as it is only 99% compatible. No EEPROM for one, it is emulated in FLASH memory.
The LGT8F328PU is the best with oled displays. This chip is amazing!! I use it for a time now and very satisfied with it. I do not recomend the Wemos XI !!!!!
The question, László, is _why_ you don't recommend the Wemos XI boards that have this chip? But the LGT boards I got certainly are very good and quick, although the analog accuracy is not very good at the extreme range. Thanks for sharing and if you want to answer my question that would be fabulous!
Ralph S Bacon Whenever i wanted to program the XI chip it got a bootloop3 times, and the chip becomes useless. My programmer is CP2102 and FTDI 232. I use the correct installing packages with Arduino IDE. The IDE won't let me program it with Wavgat or LGT packages. Don't understand why 🤔 The other Lgt and pro mini clones can be programmed easily and use them all the time. Because of the installing packages i am having difficulty compiling my sketches with color tft lcd. But!!! Maybe my pc and IDE needs a clean start. Basically i am very satisfied with the LGT8F328PU :) I hope i answered your question 😊
Nice overview/tutorial. Thank's, Ralph.
You're welcome, Pekka, glad you liked it. thanks for posting.
Great video! It was very informative and sparked my interest in this MCU. Thank you!
Great, mission accomplished! Thanks for posting.
Inspiring! I have one of these boards I've been having issues with. I'll try this out!
I see you have been having fun, Simon!
Great tutorial video Ralph. Not used this chip but had I used it, I would definitely be one of those people who wouldn't have noticed the fact that is was not operating at 32Mhz. How do you find all this stuff out? Thank goodness you can and do to help people like me make progress with this hobby. So, SPI TFT/OLED with STM32 next? All the best
Glad you found this useful, Paul. Finding all this stuff out is not easy sometimes, but with Benny doing the purrfect C++ coding and Dougle doing the research (even though he sometimes barks up the wrong tree, he's still my Sherlock Bones) I find it easier, it must be said. Ah yes, STM32 and SPI, still on my TO DO list.
Keep up the great work Ralph.
I shall try to, Stephen, I hope you liked the video. At these prices, it's a no-brainer, right?
@@RalphBacon It's so hard not to spend money 'hand over fist' to our far eastern friends.
Very useful and interesting. Thank you Ralph.
Thank you for your feedback, Roger Furer, noted and appreciated!
Excellent. I have the mini's on order, and I'm excited. I use a Nano/Nrf24 setup for RC airplane stuff, this could be a direct drop in with higher resolution for servo control. For a buck I got a few, who would know? Awesome, Thanks for your work!
Good luck with your project 👍
Dear Mr. Ralph. It's really a nice and informative video. I'm beginning my research project, because I'm slowly running out original 328p micros. I was lucky enough to buy 200pcs when they were still around $2. Now the same seller sells them at $4. They work normally and have 2102 date code, which is strange. During writing this I went to check the price at the only EU supplier that has stock and it is around $8/pc for 100pcs. Terrible. Nice lady at Alibaba gave me $1.9 for LGT in 200pcs quantity. And that would be OK, but the sleep modes are different and that is one of the things, that are NOT in the 99%, but very important to me. 😬But those chips are at least marked. When I see unmarked chip, I get a bit paranoid. Thanks again and keep on the good work.
Yes, Srečko , unmarked chips are a sure sign they are either fake or different to what the manufacturer specified and now have their markings removed. You got a good price for your micros; it's a pity that the LGT's sleep modes are not 100% compatible. Thanks for the information, it will be of use to others too.
@@RalphBacon Thanks for your quick reply. I ordered two different boards to play around and see what I can do with sleep states. For non battery projects I'll use ESP8285H16 with 2MB of FLASH and one I/O expander. It is under $1 and has "all included". Too bad so many I/Os are "wasted". BTW have you heard of GCW /Great Cow Basic)? Interesting stuff. Have fun and thanks again.
Yes, I looked at GCB a while ago but figured that it was going to be a niche product and I'd stick to C++. I used to use Swordfish (basic) on my PIC chips, very good but once again, fairly niche.
Great investigation of that little board.
I would have loved to see if the FASTLed lib works, but for the price i will try it myself ;)
And let us know how it goes. Please. Pretty please!
Update:
github.com/dbuezas/lgt8fx has now support for the integrated Differential Amplifier and currently adding SoftwareSerial support for 32Mhz. I actually need testers for that (more info in the issues tab in github)
Good idea to get independent testers on this new feature, David. When it's all settled down I will do a complete update on its features. Apart from some dodgy analog readings towards the end of the scale it's looking good. One viewer has also report problems swapping a Nano out for this and having the SPI TFT screen not work, something I want to look into.
Haven't tested the diff amp stuff yet, but fastio is not there from just the board url install. I grabbed a copy of the .h file from the other github and put it in my sketch folder just to test - it works. Else I get the "not defined in this scope" error.
I found that the fastio_digital.h file is missing from the linux /nome/username/.arduino15/whole bunch of subdirs/lg8t and copied it in from the older github. I still have to #include it to get fastio to work, but now can use instead of "".
In fact, it appears quite a few files are missing in the dbuezas json version. More when I know more.
@@DCFusor Oh, interesting, I'm not sure how that happened. Will fix in next version (re copy all files from the original core).
BTW: if you add those as issues in github I'll not miss them :)
@@dbuezas Will do. I'm doing a blurb on my own sci/tech website and linking back to here, your github, Ralph's, etc, as well.
This will show up in a few projects there (and in different sub forums as match the situation). This one's just the hardware intro (and not yet complete either): www.coultersmithing.com/forums/viewtopic.php?f=6&t=1149&p=6775#p6775
Hi Ralph. Many thanks for all the video's. Very instructive, however I am now somewhat confused.
I have a couple of projects related to model railway control, running on Nano's. One of them - an interlocking system for point and signal control - is stretching the 2K memory of the Nano. I have a number of array's holding lever states and locks etc. Which push up the memory requirement. The compiler issues a warning that memory is low and the sketch could be unstable. This is true, as when running the program tries to address an array outside it's bounds and re-boots frequently, despite the code attempting to stop this. When you brought out the video on the ESP32 I thought - great, load of memory, that's what I need. However you have now confused me with all these later options.
I don’t have an issue with the speed of the Nano - it can run the logic faster than I can pull levers, but I need more memory. What would you suggest out all your recent offerings?
How about a video on the pros and cons of each chip/board?
That's a good suggestion, Colin.
The problem for me is that I don't know what features you are using. for example, is I2C critical? SPI? Timers? Interrupts? You get the idea. Compatibility is going to be important if you use such features. You would have to rewire things anyway.
The STM32F103 (Blue Pill or Maple) has a relatively massive 20Kb of run-time memory (10 times that of the Nano) but for all I know it might require 10Kb just to compile the Blink sketch! The ESP8266, for example, has to drag in so much code it requires a 100Kb or more for that sketch - but then it does have 4Mb to play with!
But if it is memory you need, not speed _per se_, then the ESP8266 and ESP32 would both offer you that. The STM32F103 _might_ also do that (others here would know). And, of course, you can code them on the Arduino IDE with the same sketch with just a few pin changes (best scenario).
I'm going to definitely add this suggestion to my list of things to consider. When, or if, it ever gets done is another matter as I suspect it might be quite some work, but we'll see!
Ralph,
Many thanks for that. My main requirement is for I2C. I am receiving data from a 3rd part board (Megapoints Multipanel) which is controlling the model railway stuff, and also outputting to a LED screen over I2C. From my recollection of those video's the I2C is comparable.
Thanks again for the suggestion. I'll obtain a suitable board, revisit your video's and give it a go.
I'll second the need for more SRAM. 2K runs out too quickly with text, LCD and serial buffers, etc, etc. I've even resorted to external serial RAMs a few times. I'm currently working on a USB-connected paper-tape punch (!!) and really want to reserve 1K SRAM for an input buffer. Thanks for the excellent video and hope the LGT8F328 catches on.
Are you using bytes such as "Ture" and "False" to record your point data, If so that it taking 8x the memory than you need to. Using bit masks you can use a single bit to store the same data.
Other tricks could include putting a lot of your static data into flash or even the EEPROM, so data that never needs to be changed, just looked at, can live there. which leaves the ram for the dynamic data.
You can avoid the use of C++ type things, objects and libraries which bloat the memory footprint. C++ is a great language, but for these small microcontrollers it can be quite sprawling if you're not careful.
And lastly, the array over runs and such should not be happening at all, It's either a bug in your code... or there's a library doing something silly. a lot of libraries assume the library is used in isolation and don't care much for what else may be using the hardware or memory. As such they can conflicts with memory and hardware. You can try to unpick the libraries and minimise them - a good example of this is libraries which use init functions, that initi will layout an area of memory that the library will use. but you may not be using all of the features of the library and so that area may not be fully used, and could be reduced.
I use Teensy boards for anything that needs extra speed/memory. Sounds pretty strange you do need that much RAM for states though, there must be a lot of optimization potential in your code.
Excellent video! Ill have to check the documentation to see if the pinout is the same, or at least share the same banks for adc and interrupt pins. I have some designs in production and would consider swapping the Atmel out for this chip.
It's pin compatible, Anthony (that's the whole point, really). But as to whether the interrupts work the same... well, you need to test all that out.
Good info Ralph, keep it up!
Thanks, Robert, I will do my best.
Would love to see more video of the smaller board with the dip package chip. Though I do acknowledge the lack of documentation would make that a challenge
More like SOIC.
The smaller board (pro Micro clone?) should behave the same with its SOP20 chip. Just be aware it will require a USB-to-Serial adapter to program (easy to do, of course). Regarding lack of documentation, one of my viewers, Jeff, has translated the first page of the spec. I'll put it on the GitHub later today.
Thanks Ralph. Good stuff!
Glad you liked it, Glenn, nice to hear from you.
Interesting, I wonder how the deep sleep consumption compares. Also I can't see a crystal does it have a internal 32mhz oscillator or some sort of prescaller?
It has an internal 32MHz oscillator, Andrew, keeps the cost (and size) down. I shall have to investigate the sleep mode, same tests as I did for the Arduino bare chip several videos ago.
Update:
github.com/dbuezas/lgt8fx
Easy way to add arduino IDE/vscode support with easy in menu clock setup
SoftwareSerial support for 32Mhz thoroughly tested and more goodies (e.g. diff op amp API)
Add an issue if something differs from atmel chip :) me and others actively work on the repo.
Thanks for the update link, David, greatly appreciated. Thanks for posting here.
Hi David,
I have posted the LGT8F328P issues to:
forum.arduino.cc/index.php?topic=720242.msg4839787#msg4839787
Please advise.
@@nexuzinnovation-com use another lgt board as ISP and follow this tutorial github.com/dbuezas/lgt8fx/blob/master/lgt8f/libraries/LarduinoISP/readme.md
Excellent video Ralph. great job. I'll try one.
Always worth a go, James, easy to use, just watch the so-called EEPROM, it's not! It's just shared program memory, but I guess if EEPROM were essential to a project we'd use a real Nano or add a small module connected to I2C if you need the speed.
@@RalphBacon 90% of my little projects do not require an EEPROM. Yes I2C memory would be my choice. Thanks for a very good video.
@@RalphBacon got it!
Handy bit of kit to know about.
Indeed. It _might_ take the place of all my Nanos in future. But I'll always keep a Nano handy just to ensure that unknown 1% doesn't come back to bite me!
If I had to guess the 1% that's not compatible would be EEPROM and clock cycle count for some instructions. Not in the sense that it won't work, but that it behaves differently. EEPROM could be faster/slower to write for example or some instructions might take a clock cycle more or less. So if you wrote a program that relies on a certain piece of code take a known exact number of clock cycles to get timings in the tens of nanoseconds right, you might have to rewrite that.
There's no separate EEPROM chip on this board, apparently, it's 'shared' with program FLASH, but is user-configurable in size. Of course, you could always add a FLASH chip module. I think that should equate to more than 1%, however!
One word about the "slow", "outdated" and "old" Atmega 328 chip....i managed to sample an audio input from an Analog pin and calc a 64bin audio FFT, using the FixFFT library and have it displayed all in realtime on a CRT TV using the TVout library with a nice 25Hz update rate (PAL TV)...the reason why i chosen libraries is i wanted to have something to show off on our "radio-museum society meetup" and also show that there´s no reason to code it all yourself and also there´s no need using inline ASM anymore even for fast stuff, as the libs are already highly optimized by today from the maintainer(s) ....Here´s it: ruclips.net/video/ZPxV5bVl7dI/видео.html
I don't think I was damning about the ATMega328P, but I did say it was being left behind these days when we have STM32s, ESP32s and ESP8266s. But, as you have demonstrated, there's plenty of life left in it yet. Now swap your Nano for one of these and see if it runs any better (or as well, at the very least). And..
And a question on your 4K video demo. As my monitor is only 1080p should I notice any difference? I watched another one the other day and it looked just the same as other non-4K, standard HD videos but I'm not an expert on 4K.
@@RalphBacon As you also said, it always depending on what you want to do....i´ve tried to do a stereo VU meter using 2x64 WS2812B and i first used a 328p and it was about ok, but when i tried it with the ESP8266 it was a lot smoother and also it´s roll-off was not as "bulky" as with the 328p...good eye-candy needs some more execution cycles ;)
I didn´t expect much difference using 4k in first place it was only a tryout, i also have an UHD TV and i can see a little bit more crispynees but i just was curious how 4k was handeled by the YT-algo as i have the souce and the processed YT to do a 1:1 comparisson..it´s noticable if you are about half a meter close to the UHD screen....but who does whatch stuff this close to a 42inch screen, anyway...
Trully interesting! But, for those of us who hate arduino enviroment, what compiler and what programmer (SWD?) should be used?
I use Eclipse Sloeber but the new Arduino IDE is being built on Eclipse - out later this year.
Interesting chip. But not really for the speed, I’m much more interested in the 4.096v reference and the 12 bit ADC. Could you try out them in comparison to the standard atmega? If they are good enough this cheap board would make a good basis for any voltage measure project or even a self made lab power supply
Why not get a couple (at that price it is less than a cup of Kaffee) and try them out - then you can let us all know how they perform. I suspect your testing would be more rigorous than mine!
Ralph S Bacon They are already ordered Ralph. When I have tested them I will report back.
The smaller board without a USB connector is a clone of the Arduino Pro Mini (my favourite Arduino, comes in 8/16 MHZ and 3.3/5.0V versions)
Ah ha! That was my initial reaction (you may have noticed I did a sort of double-take in the video as I tried to remember exactly what the Pro Mini looked like). Cool. Good to know.
11:51 A little bit off topic, but I ported your code to the STM32F750, and it calculates 10,000 primes in 186 ms. You previously benchmarked the STM32F103 at 3 seconds. 😁
I had the STM32H750 running at 480MHz with L1 caches enabled.
That's impressive. And you are correct inasmuch that I did not tweak or optimise the STM32F103 at all, which would have probably helped.
Speed has never been the biggest issue with Arduino's running @16MHz. Flash memory size is. Try loading the Adafruit TFT libraries.
I have used Mega's and Atmega 644P too. STM32's are for future projects and ESP32 for IOT stuff.
Indeed, Ola. code bloat is definitely our enemy when it comes to flash size. But as my ATTiny13 challenge will / may show there is a lot to be gained by working around such large libraries.
A nice video Ralph, thank you. I think I've found some of the 1% that is not compatible with an ATmega328P, the EEPROM, or lack of it. I bought a cheap Nano compatible board and tried it with one of my projects that use the EEPROM for storing calibration and configuration values and it didn't work. Looking at the datasheet (page 19 of the Electrodragon translation) it says it uses the Flash as EEPROM, so if you want 2K EEPROM then you have to give up 4K of the flash (yes double), so you get "only" 28K flash left. Which is a shame as my project was using 30K Flash and all 2K of EEPROM. But everything else I've thrown at it works well. So overall probably an improvement, but with caveats.
Yes, indeed, Mike, there is a bit about 'shared program memory' but I didn't know you needed to give up _twice_ the memory for the same sized EEPROM space, I wonder why? Any ideas?
Good stuff!
I bought some of these without knowing they were "special" Arduinos. I tried one and couldn't get it to program. Last week I had an idea they might be without a bootstrap, so I tried programming that via an ISP - which also failed. Only later did I come across links to "WAVGAT" Arduinos and their differences. Since then, success. I even have the Adafruit ILI9341 display running across hardware SPI @ 32MHz.
One thing I've noticed, you have some LGT's with an onboard serial-USB. The ones I've seen on Aliexpress say they have Holtek Serial-USB chips. (I don't have one of these yet, on order). Those Holtek devices are programmable with different IDs and description fields .... if they are genuine parts.
Might be worth a tinker.
Interesting that these can be "reprogrammed" with a different Vendor USB IDs, Pete. I suppose it depends on whether you really want to use the USB port. I'm currently using one in a new project but it's the MiniEVB version (EValuation Board?) without USB anyway so I'll just use an FTDI USB-to-serial to flash it (or perhaps ICSP). It will be interesting to see how our respective projects turn out - keep tuned!
AVR AtXmega's run also at max 32MHz, they can be overclocked to 48Mhz or so I think.
Edit: Test the delay function in C lib, If the delay function is correct the core runs the instructions at 16Mhz like the compiler, if runs twice as fast the core runs at 32Mhz and compiler compiled the delay function at 16Mhz. They maybe just divided the clock intern, many uC can do that, but the original atmega328p not, but this clone may have some improvements so can use more variation of parts that are available or have more control over the clock speed.
Yes, checking the delay() function is a necessity to ensure the clock ticks are happening at the correct frequency.
Thank You! From Frisco, TX
You're welcome! So, not San Fran, then?
If the 328P had any issues at all it's the memory size. It's execution speed is generally more than good enough IMHO.
There's always the Mega2560, now available in a variety of compact formats with pretty much the same performance as the Mega328P but with umpteen more pins, several hardware UARTs and 256Kb Flash and 8K SRAM.
uk.banggood.com/RobotDyn-Mega-2560-PRO-(Embed)-CH340G-ATmega2560-16AU-Development-Module-Board-With-Pin-Headers-p-1397734.html?p=FQ040729393382015118&
the "old" ATmega328 is rated at a max clock speed of 20 MHz, 25% faster than the 16 MHz utilized on those Arduino-boards... yet still this chip by itself also would be interesting...
very interesting details in the datasheet - in the English texted pictures at least:
- they have stripped off some of the power supply pins to make place for some PORTE-pins even on the 32pin chip
- a 16 bit ALU promises faster calculations
- 16 bit load/store to the SRAM
- a variable size EEPROM memory which is partitioned from the Flash memory
Most functions are probably not supported by the gcc-compiler if it assumes it is compiling for a standard AVR chip though...
I was wondering about the last point too. How do you use the DAC if the standard Arduino core does not support it?
It might be answered here: wiki.wemos.cc/products:xi:lgt_nano (scroll to bottom, Arduino Core)
@@RalphBacon like you can do with every feature in the original Atmega328 which is not covered by Arduino. Just go into the hardware directly by using the C-primitives, like addressing the hardware registers directly. Since all functions in these types of microcontrollers are mapped into the memory, it should absolutely not be a problem. Next step would be to write your own library.
Hi Ralf: Great video and “first” review of this ATMega clone “LGT8F328P”. Along these “Pandemics months”, did you have a chance to check the ADC features?
That is because for me the most exciting feature would the 12bit ADC increased resolution, and possibly its speed too (at least if not compromised); although running general code twice as fast can be handy, sure.
In special, if the ADC is Not too noisy and somehow with good linearity - something the ESP(s) are not - then it would compete with the STM32, having the advantage of greater Arduino IDE compatibility through the USB port, with its bootloader working from the start.
This could be a great hardware tools for DIY Digital Voltmeters in homemade PowerSupplies, battery dataloggers, etc. before going to a dedicated IC for 16+ bits ADC.
A power consumption doubt: Did you have the chance to check the power consumption in running & sleep modes? Or at 32MHz they are power hungry? In other words, eventually bypassing the onboard Voltage regulator’s idle consumption, is the LGT8F328P “battery friendly”?
Thank you for sharing, Ralph!
I never progressed much with this chip, because the ESP32 took centre-stage, as it was faster, cheap and had Wi-Fi and BT all built in. And a huge amount of memory, meaning OTA updates were easy to do.
What I do remember about the LGT8F328P is that at 12-bit resolution the noise floor increased; someone mentioned that using the differential method (so, two inputs) worked better, but I never really tried it out.
Power-wise, I believe the lowest power is 1μA, higher than the 0.2μA achieved (by me) with a fully dormant ATMega328P but there's more to power saving than putting the chip to sleep; even a potential divider in the circuit can draw much more current than that. These days, my dormant power state is usually an Si4599 dual MOSFET chip that leaks picoAmps when OFF and can be switched on by a number of external triggers (one pin to GND). And it powers the _entire_ circuit not just the chip, of course!
Fantastic Ralph! I'm a real 328p fanboy and gonna get one of these right away, 32 Mhz @1.28v brill!
will it work with Atmel Studio 7 (my prefered IDE at moment) I wanna check out deep sleep specs and 12 bit operation......good work Sir!
Yes, check it out, Andy, so far I've plugged it into various places and it all works as expected. I still wonder what the unidentified 1% non-compatibility is (perhaps some stress related thing).
The thought crossed my mind - maybe the chip text is on the underside of the package? We need a bare chip to see if this is so.
I've always pronounced Gnu after the animal, as in the song by the late Charlie "Hello my darlins" Drake - I'm a Gnu ;)
As I understand it, it's actually a recursive acronym for "Gnu Not Unix"
12 bit ADC's are a bonus as is the DAC - though no mention of the bit precision of the DAC.
On a final note, it is perfectly possible to clock a Uno (or a Nano etc.) at 20MHz with a change to the crystal and some tweaks here and there.
Oh, I was wrong, another final note, an English datasheet -
www.electrodragon.com/w/images/b/b6/LGT8F88P_LGT8F168P_LGT8F328P_translated.pdf
Edit: reference to that datasheet tells me the DAC is 8 bit. Nice.
Oh (he he) and another final thought occurred to me, how nice would a 28 pin DIP version of this be? I'd be perfectly content to sacrifice one channel of ADC for the DAC pin. Sadly that would prevent its being a drop-in replacement but we real "hackers" are happy to modify PCB tracks if needs be.
Hopefully done with fresh thoughts now.
The datasheet in your link is a little hard to read, but the position of the DAC is clear. The QFP32 mega package has dual VCC and GND pins on the left, while the QFP32 version of the LGT8F328P dispenses with two of these, making way for PE4 and PE5. The ADC is on PE4. Looks like they simplified some of the power in on the right as well, making room to pin out some mysterious E and F registers. Yes, it would be a an interesting hack to mount the QFP chip above a little 28-pin DIP, so it could be dropped into an Uno. You are probably aware the mega's C6 and C7 pins can be used for AIN, but not output ... looks like LGT has additional functions on these. And since no crystal is necessary, the XTAL pins B6 and B7 are freed for GPIO at high speed. At a glance, it, looks like there are are a whopping 6+ useful GPIO pins to play with on the LGT QFP32 package.
That's great, Nick, I'll put a copy of that pdf on my GitHub with a link too, in case they ever get around to putting back all the lines and blocks, to make it easier to read!
Now, if you 'overclock' the Nano to 20Mhz it breaks all the timing routines for the delay and Serial clocks doesn't it (albeit reasonably easily rewritten)?
electronics.stackexchange.com/questions/33166/why-do-arduinos-ship-w-16mhz-crystal-instead-of-20mhz
Frankly, I think the answer is to use on of these chips from now on!
@@RalphBacon That is always assuming you are programming the chip via the Arduino IDE and not using a different method to compile and upload your code. ;-)
Hint: I do have a nice shiny AVRISP MkII programmer.
@@RalphBacon Finally got my order ... of all 5 small ones labeled "BAITE BTE17-13" and "LGT8F328P-SSOP20". No markings on the chip whatsoever! BAITE's store has a picture showing the board selected through Arduino IDE in Chinese, but no docs or downloads. Sadly, the Larduino core does not support these chips. Serial.print() does not work. I read the github discussion. Found that the Wemos XI core *DOES* support it though, as an "LGT Pico." Your QFP32 based boards are more like WAVGAT Pro Mini types. Also found that regular SPI ISP does not work on these. Takes a special program, or perhaps an AVR ICE. Not going to be so simple as planned, replacing the bootloader, or making it default to 32mhz. Gotta put this project away for a sleep cycle. Am rather aGNostic about how to pronounce Gnu[whatever].
Looks like the nano/promini-like variants are gone from BG, and price for the EVB has gone up. Need to go on aliexpress for the small ones.
Yes, they are still available from AliExpress. The EVBs are coming back to Banggood mid August 2019 but at a higher price, apparently. We shall see.
Works with my PXSTAL project but only with detecting the region of game and switching clock mode accordingly (V1.00B) on SI5351 clock board. SPI is broken, it kills my in game reset coding. Not sure why. I haven't had any luck with any of these. I can't even us the 128P nano clone for my modchip (uberchip) but works for PSXTAL. 328P clone works for PSXTAL and Uberchip. I can't be bothered finding out why all these clones have issues. I tried other clones as well that were even worse. I run these @ 16Mhz (onboard xtal)
I've heard on the grapevine that not all LGT7F328Ps are created equal - there are several versions out there (clones of clones, perhaps?). OK for simple stuff, but if SPI doesn't work, well, that a non-starter.
Thanks Ralph. I purchased several of these too about 2 weeks ago but still haven't received them. I think it was that same AliEx seller too. They must have rowed the boat past you first.
I tried to find somewhere selling Logic Green inventory but nowhere I buy from, foreign or domestic, carries them. I was really bummed LCSC didn't have them. I want to get my hands on that LQFP-48.
1.) Did you try the analogue stuff yet? I'm really curious if the Arduino core was updated for the DAC and how they incorporated it with the PWM "digitalWrite" stuff. I'm also curious why they skipped the standard 6 pin ICSP header, and how the new debug features work.
I noticed the logic green website shows they have a few PIC clones too, but I didn't see those floating around for sale either.
BTW, if you happen to pick up some of the newer nano compatibles with the CH340E chip (the tiny MSSOP-10 version that doesn't require a crystal) they work well. They just use the "old nano bootloader" setting in the IDE, if you use the default Nano setting they don't work.
I just started learning Flash Forth 5 using one of these Nano boards. I'm currently building a little PIC18 prototype so I can compare FF5 with a PIC and AVR. Plus I have a detailed whitepaper tutorial for the PIC18 that is easier to follow. I like the idea of playing with a modern PIC without MPLabX's XC8 -subscription- _extortion_ nonsense.
This is my first adventure into Forth. 2.) Have you ever tried the Forth language before?
Thanks for the upload.
-Jake
Check out 0033mer youtube channel. He does all his coding in 4th. Pretty interesting stuff.
@@noweare1 yeah I've been talking to him quite a bit over the last couple of days. That's how I got the PIC18 paper. He has given me a few different references in reply to my foolish questions. He's a cool dude and a lot of help :-)
I have no idea how AliExpress got them to me so quickly - as the video shows I was totally unprepared for their arrival! I'm obviously a VIP!!!
Yes, more testing required on the DAC and just about everything else really, now that the fundamentals of SPI and I2C
have been done.
@@UpcycleElectronics He knows his hardware really well. He probably never used a library in his life. Definitely old school. Not all engineers are created equal. He's top shelf.
Logic Green has links for the QFP-48 (item.taobao.com/item.htm?id=549915535039 ) and the 32 pin. The SSOP-20 link is grayed out. At the current exchange rate the chips are less than 3 cents each. I couldn't get taobao website to work so that is as far as I got.
Interesting. Bare chips would make it interesting in being able to use our own PCBs.
Hi Ralph. I bought a few of these LGT boards. Followed your (as usual) excellent instructions and the modified simple blinking program compiled and loaded fine. Excellent I thought. I have a 128x160 1.8inch TFT SPI display working perfectly with a Nano on one of my projects. Based on the manufacturers testimony that the LGT is 99% compatible with the trusty Nano, I swapped the LGT into my project board. (Thank goodness for sockets). Well I think I have found one of the non compatible 1%s. I added the #include line to my working Nano project. Compiled and loaded successfully to the LGT. Output is a blank screen. Very disappointing. I am certainly not blaming you as I'd seen these 32MHz clones a few months ago and wondered how good they might be. Well my experience hasn't been at all good. I've shelved the LGTs and moved on. They would have been a nice to have but my new and future projects are using ESP32 variants. 240MHz - awesome. Driving a 2.8 SPI TFT with great results now. All the best. Paul
In my demo I did have both I2C and SPI running successfully (simultaneously) so I just wonder, Paul, what it was in your case that caused this. I mean, the protocols either work or they don't, so SPi should work with a screen, SD card or whatever. Hmm, I'll park that idea and dig it out when I next get this LGT board out in the near future.
Edit: thanks for not blaming me!
@@RalphBacon Hi Ralph, I often doubt my skills (with justification ) as at 68 I am prone to the odd mistake when wiring or coding. In this case though, I have a working project with a nano. Added the avr\power.h library line to the working code for the LGT. Compiled and loaded without error or warning. Just wouldn't work the display. I cannot figure out why it doesn't work, quite strange. I recompiled the same sketch (including the avr\power.h library call) for the nano, loaded it up and it worked perfectly with the nano. Sods law at work perhaps.
It's probably something else, Paul. So the screen you're using is just a standard, no-name TFT running on the SPI bus? I have several screens so might be able to try this over the next few weeks (I'm off to Germany soon for a week to see my Mum and things grind to a halt at that point).
@@RalphBacon Yes, Ralph. Written on the back of the tft is Driver: ST7735 and below this, NOMEN_TEC V2.0. Works well with Nano. FYI, I'm using 5v as 3.3 was clearly not enough. SCL/SCK on pin 13, SDA/MOSI on pin 11, DC/AO on pin 8, CS on pin 10 and RES on pin 9. I'm using these libraries #include
, #include , #include , #include , #include . Enjoy your trip to Germany. Used to go monthly to Duisberg on business before I retired three years ago. All the best
I just got a few of these and got one working via the dbuezas board url method (the nano clone version). The pin for Slave Out Master In (pin 12 on an uno) has a led to ground on it - it's what's blinking out of the box. This led (blue in the case of my wemos board) limits the high voltage value to less than what might be needed as an input logic level, even with the uP driving it, no telling about some probably-weaker device...I'd guess that any SPI that needed any input from the slave would have issues due to that. You might try unsoldering the led?
all the secrecy, may be all because they want to avoid copyright issues.
I very much doubt that is concern for Chinese fabs!
it´s more like...."we don´t give a damn" about these EU/Overseas customers....as they already have a huge marked in their own country (140million people in china alone;)
Good job, I love this mcu clones! I am really interested to know how much current draw on deep sleep!
Yes, someone else mentioned this, Luiz, I shall have to do a few tests and find out.
Any result for deep sleep power consumption?
Very interesting Ralph. A couple of questions if I may...
1) Do these clone boards come with the bootloader already installed (I assume so given that you didn't make any mention of having to install it)?
2) How much RAM do they have?
Yes, the Optiboot bootloader is already installed, Mike. Good question and I didn't really take notice, I just assumed it would have something preloaded to ensure we could upload code via the USB. RAM is the same as the Nano, 2K. I bought three of each type and will be thinking of (simple) projects to use them in soon.
Ralph, there was (or IS) Wemos XI ages ago. I made an article about these boards in a magazine here. Not sure I can find it anymore. So many things I get meanwhile.
Yes, I'm pretty sure the Wemos XI was based on an LGT8F328P, so you are correct.
Hellp Ralph Thanks for your excellent explanation about so many things. I learn a lot. Maybe if you search for a topic it's nice to explain when to use a resistor and calculate the Ohm you needed? Also why to use a capacitor? I read sometime's to prevent wrong reads pullup a register with a resistor and to prevent changes on the port use a capaciter that's why I ask this. Nevertheless I'am looking forward to a topic of your choice. Finally I want to ask you which beeper with push button you are using? Have a nice day and thanks again.
And I was indeed thinking of doing a back-to-basics video, after all this channel is for the novice Arduinite. Thanks for the suggestion, GL.
@@RalphBacon Hello Ralph, Your welcome ;) Can you please answer also my qty about the beeper you are using into the video? Greetings from The Netherlands and have a nice day. Bye bye
to be honest though they could've done 40 MHz to exactly double the speed of the orginal chip.
since the 328p can run at 20 MHz, but all arduino boards only run it at 16 MHz for some reason
The reason is all historical, the original ATMega8 only ran at 16Mhz and they kept it like that to ensure it was compatible. Allegedly.
@@RalphBacon aww, yet again does legacy support hinder progress!
seriously though the chip itself could still support 40 MHz but just use a 32 MHz Crystal on the board, so like with Arduino if you really want to you could run the chip itself at faster speeds
Probably. But if it's speed (as in its ability to do work) you want then an STM32 or ESP32 is a better choice!
Great video, tho if I needed a MCU to run at 32mhz I would probably go with a ESP, your right about the cost! That's crazy cheap, if I ever find time with no projects on the go then I will probably order these. Thanks
ESP32 or ESP8266 can just be overkill/wasteful for some things, Gordon; these can be viewed as a humble Nano on speed!
This looks like a great board to play around with. I just love the STM32, but these might make some projects a little easier. Any idea how the ram/rom counts compare to the Arduinos?
It's the same as the Arduino Nano, Edwad, 32Kb Flash, 2K SRAM but the EEPROM is shared with the 32Kb Flash (and is configurable, so if you only need 1K then that's all you steal from the FLASH).
I had to check back here, seems i must have watched this video a few weeks back and got all excited about these boards, since I love the Uno and it's clones, I must have ordered one of the multi pin ones because I found it in my order list at Banggood. Now I don't remember clicking the order so perhaps I had it in my basket when I ordered something else, but I found it there today, and clicked the location button, the thing is in Chicago, right now, about 900 miles from my home so I may have it in a few days, before Christmas and Impeachment anyhow. Must watch the rest of your video so I can figure out what the hell I ordered it for, I get particular hell from my old lady now if I order crap from China. Funny isn't it, I bring home the paycheck but can't even get a damn allowance like I did when I was a kid. Ah well 50 years with the same gal, we must be doing something right. Just caught hell over Octobers 30 bucks from Paypal!
You need a secret drop off point like you local post office so you can go and collect the items quietly! And joint accounts are never a good idea! But this LGT device is just very quick and almost 100% UNO compatible too. Have fun when it arrives!
@@RalphBacon Ah yes, the board has arrived, and I am back here trying to figure out how to make it work. I had spent the majority of the morning trying to program an ESP-8266 but was having a ton of troubles with it. So the postman drops off the package (Wife left at 5:30 AM to drive our daughter to the City for a doctors appointment so they will be gone all day) So I plug in the new board, and NOTHING! Man I was about to have kittens, which would really piss off our cats, as they think the house is overcrowded with 2 of them! So I look for the driver, but no avail, this with a new USB cable I just unpacked, not the one that came with it though, Then the thought hits me, perhaps this is a charge only cable! Indeed, that was the problem, I hooked her up with the cable that came with the new board, and windows sang her song of love and acceptance, the board is now found and happily playing along as I watch your video once more to figure out how to put her in overdrive. This did, of course solve my ESP problems as well, that damn power only cable is getting decapitated and rebuilt into something else so I don't repeat my error! Next, figuring out what to build with this board, I am always seeking more power, more speed from my little devices. I think the 76 cent deal may well be a must order for building my little jukeboxes.
@@RalphBacon Have been trying to set the unit at 16 MHZ and run a i2c oled. Can't get it to show anything on the screen, it was driving me nuts, till I decided to go with the 32 MHZ and include those little jewels, works wonderfully, every thing I have tried on the OLED has worked just fine if I paste in your two commands, it is a blast, I can see all sorts of possibilities with these! Love it, thanks so much for the Christmas Gift of this video!
Thanks again for fresh info !Can this board use all the libraries UNO has?
Yes, absolutely, unless the libraries do some very low level ATMega328P-specific register updates in which case it probably won't work. For everyday use, however, I've not had any issues.
Ralph, Thank you for this video! Were you able to determine if this chip has 128K of flash?
No, this has 32K Flash just like the Arduino (as in PROGRAM CODE memory) but has no EEPROM memory (it you need it, it will share the 32K Flash Memory).
Have a good day sir
You too, Yogesh, nice to hear from you.
EVB is probably evaluation board.
Yes, agreed, I did say that once in the video but it was a guess.
Cool topic. Didn't know this existed.
Nor did many others (me included) but now lots of people know!
Hey.. what you didn't mention is that the chip doesn't have a real EEProm like the Adruino Nano. if you need EEProm space you have to emulate flash memory, but this is not as long writable as a real EEProm memory. if you write something every few seconds, the cip is worn out in a couple of days.
Good point. Although writing something every few seconds to _any_ EEPROM is not the best design I can think of.
Ideally use an external flash memory chip or a proper filestore system, whether that is an old fashioned SD card or the newer LittleFS (now standard on the ESP32s, replaces SPIFFS).
@@RalphBacon Well i find Out .. that Atmel only fools the light with the alleged EEProm Funktion which is specified with a maximum of 100,000 writable cycles, which is actually the same as a flash memory .. A real EEProm can be written up to 1 million times.
Unfortunately, the LGT8F328P also needs more flash memory for its temporary variables than the 328P because it has a higher resolution on the analog inputs/outputs.. I had to switch back to the 328P in order to to use the couple of Kbytes i needend . In the end I don't see any other way, i have to switch over to the STM3F103T8 or F401 . but I don't know anything about it and just Start learn by doing.
Thank you for informing users with videos. you helped me out many times.
Well, let's do some maths!
We'll assume that "every few seconds" in your scenario is every 5 seconds, that you are writing to flash memory (EEPROM).
So in one day (86,400 seconds) you are writing 17,280 times. If the flash memory is good for 1,000,000 (one million) writes that means you can write at the 17,280 rate for just 57 days before it gives up.
Not very long is it? And this all assumes that the flash memory can actually be written to a million times without giving errors or storing the wrong value.
OK, we're assuming we're writing to the same memory location, and not having any kind of wear levelling, but, as I said, still not the best way to log data!
But if you're happy with this, then carry on, there's no definitive right or wrong way to do it in a hobbyist environment.
@@RalphBacon Well, describing it with the EEProm didn't grow on my idea, I only have a program for an FPV station which I have to rewrite so that I can use 4 RX5808 receivers with the additional setup of an RSSI antenna tracking and I noticed that the EEProm function plays a very central role such as Calibrations so far.
That's why I had to delve into the matter to see what is possible and what is inappropriate.. I was only disturbed by the fact that the 329P is said to have an EEProm Ram that neither the "LGT8F328P" nor the "STM32" series has.
That's why I bought the board "AT24C256 24C256 I2C interface" because I find the function itself very practical if you don't want to deal with a huge number of variables.
The core of my problem is just... with this program, the emulated EEProm is written with the line, for example with
"EEPROM.write(EEPROM_ADR_RSSI_MIN_A_L,(rssi_min_a & 0xff));"
while with an external EEProm the expression is used like:
"Wire.beginTransmission(i2c_address);"
"Wire.write((int)(address >> 16)); // MSB"
" Wire.write((int)(address & 0xFF)); // LSB"
Here I would have to adjust the EEProm.h include file so that I don't have to change all the entries in the existing program.
At around 5 ms, the access times are also longer than if you were to write to the internal flash memory of the MCU.
I'm not that experienced in programming, but I'm getting better and better not least because I keep watching your videos, i also download various files from you on GitHub.
Whatever.. I'm no longer a fan of the 329P or the LGT8F328P (but the clone is super successful). I need space at the top for programming, I don't know where my programs will end up.,
At the very beginning of my project I wanted to use an Adruino for the divesity and another 328P for the RSSI tracking, but the program for the diversity already occupies 99% of the 328P after including the two additional receivers and it still needs to get more variables.
That's why I'm going to switch to the STM32 series.
I wish you a great new year
Werner
Thank you Ralph for thice informative video.
One question, please. LGT8F328P. Using I get the message
"fatal error: Wire.h: No such file or directory"
#include
The same sketch with Arduino Nano runs w/o issues.
If you are using the Arduino framework you must tell the compiler this, so include the following statement at the top of your sketch:
#include "Arduino.h"
and see if that solves the issue. The Arduino boards all have this as standard so you don't have to do it.
@@RalphBacon Thank you very much! I'll try it and report.
Hi Ralph, do you think there's any point in the LGT8F328P-LQFP48 which gives some additional GPIO compared to the 32-pin chip? It looks like there might be the same amount of GPIO pins as the STM32 blue pill (which I never got to grips with but maybe I should try again instead of messing with the LGT8F since it has so much more speed/memory).
There is better support for the Blue Pill. The LGT8F328P is fine for simpler stuff but there are some reported anomalies (not surprisingly for a reverse engineered design).
I have heard it said that the asian chips have the markings on the underside. Perhaps try desoldering and having a look - you can only lose £1.41.
then the lettering will probably survive a cascade event
meaning you can desolder a blown chip and get the replacement numbers...useful
very useful
Yes, I might just do that, you never know.
Hi Ralph. Great video as usual :) I have the WavGat Uno R3 which is not really an uno clone (it only looks the same) since it has a different mcu. Wavgat calls it AVGA328P but I have read that is the same as an LGT8F328P. Uno shields don't work and the pins are 3.3 volt. They look to be of good quality. Anyway I tried to do an analog read with it's 12 bit ADC and never got to 4095 (or 993 when using 10bit) and it turned out these LGT8F328P "loose" some accuracy at the max voltage? so They only go to 4064 at 3.3 volt. Anyway. Before I discovered that i tried the arduino internal 1.1 reference trick using the wel known readVcc function but on my wavgat I just got useless ramdom numbers. Do you think these boards would still need this trick or do they allready have internal fixes for this? I ordered some 16 bit adc breakout boards from Ali but that will take a long time before they arrive. So I thought to get more accurate reading using the Wavgat Uno r3 board but if the boards power source affects the measurements I just get more acucurate false readings.
If your chip really is an LGT8F328P, Hans, (no markings on mine, might be underneath) then the analog precision does start to tail off, just as you say. Try running the battery monitoring sketch in my video #160 to see what results you get (in conjunction with a multimeter). Don't forget the 100nF cap on the AREF pin. Of course, you might just get "...more accurate, false readings" - love that phrase!
It would be useful if you posted your results back here for others (including me!) should you decide to do this.
Hi Ralph, I tried ReadInternalBatteryVoltage.ino on the WavGat uno R3 and tried to read the voltage on the AREF pin but all I got was 0.15 volts. I double checked with an other wavgat board that never had the sketch and it also read 0.15 volt Tried the sketch there too and still got 0.15. Runnning the sketch on a real clone I got 1.07 volt which is more like it. So ignoring these results I ran ReadBatteryVoltage.ino on the wavgat and that just returns The value 2226.18. I changed from usb power to a mains adapter and the value did not change at at all. I guess the registers or something are different. I did get my ADS1115´s (video #104) last week and those are amazing. They use i2c so no voltage fluctuations at all using the ACS712 current sensor. So I am going to use those to track mAh in and out to measure battery capacity. I did test the voltage on +5 ad +3.3 volt pins and they were spot on. (my multimeter agreed with the pins 5.01 and 3.30). So maybe those LGT8F328P do get calibrated in the factory and analog reads are accurate as long as you stay below say 3.3 volts?
Great info -thank you
Now er "just" need a 16 bit ADC and a faster bus :)
Ha ha! There's just no pleasing some people, Flemming. At least it's a big step for Arduinokind in the right direction.
THANK YOU FOR SHARING. PWM Pins on Uno, Nano, Mini is 3, 5, 6, 9, 10, 11 ) . 490 Hz (Only pins 5 and 6 (980 Hz))
WHAT ABOUT LGT8F328P..
Actually, you can have _any_ frequency PWM you want on the Arduino. Essential for controlling fans, otherwise you can _hear_ the buzzing of the PWM! I might have covered this in my videos #14 / #15 ruclips.net/video/e2CPnmLmSws/видео.html
Ralph..... old one but have a question you may know the answer to....... are the proceedures herein for the AVR hardware text still applicable to the current day Arduino IDE or does the LININO ONE board type currently in the board selections take care of this.??
I'm pretty sure they still work as they always have done, Jorgo. No major changes.
Ralph,. You briefly mention the small SOP20 boards. Have you tried to use them? I picked up a few and haven't had any luck getting them to program. There is a swd/swc pair on it which I assume is for debugging. I wonder what protocol it uses? Does anyone know? Thanks for the great videos. Glad to see your eye has recovered!
The small version of this clone (the SOP20) needs the SPI route to program using ICSP. I haven't used the tiny board (yet) but others have. Kind of you to mention my eye but recovered it has not, I'm afraid. I'm seeing the cataract surgeon in two weeks' time to talk about all this. Then it may be all plain sailing if I get a new plastic lens! We shall see (pun intended).
@@RalphBacon Thank you for taking the time to reply to me. I have spent a day or so beating my fists against the keyboard to only come to the same conclusion. I have yet to find a way to do it by that method. If you have any recommendations, I would appreciate hearing them. One of my friends had a lens replacement for the same reason and come out with better vision than they had had for decades. So, there is something to look forward to. ;) I wish you the best and thank you for the videos.
If you are talking about the green SOP20 boards which are somewhat similar to the pro minis: mine came with a bootloader preinstalled, it uploads like a pro mini through tx/rx except that the pinout is a bit different.
Be sure to select the right board from the menu though.
Note: my board matches the second board from the bottom here (ehem ehem shameless plug): github.com/dbuezas/lgt8fx
@@RalphBacon Hello Ralf, First Thank you for your amazing videos. The SSOP20 version can be programmed via Rx/TX and Arduino IDE. The best results come with WEMOS XI board but.. Serial.print() not working on the 3 modules I bought ! Debug is possible via SoftwareSerial and I2c displays. Hoping the best for you. Regards. JC
@@dbuezas What wiring is necessary to use the SSOP20 boards? I currently have one hooked up with a PL2303 USBSerial adapter that has TX, RX, and DTR--exactly like I use with the AVR Pro Mini boards. I'm getting timeouts from avrdude. "Programmer is not responding." "not in sync: resp=0x00", etc. The board came with a blink sketch on it and *I assume* a bootloader. I'm starting to think that assumption is false and I may need to flash them.
Unmarked chips could be factory rejects ? Failed during some test maybe? Remember addon memory for ZX Spectrum back in 1984 ?
I had a Spectrum around then and my memory expansion pack was faulty! WH Smith replaced it though!
Good video at approx 11:46 you hint at telling us about GUID. Were you going to say something about it?
It's all in the GitHub, Michael, but you have to look hard!
Have you tried a simple program and measure how hot the chip gets?
Also with the higher clock speed, what sort of current draw is there?
I haven't done that, Mark, but the question I'd ask is: What would you do if you found getting somewhat warm? I'd stick a Raspberry Pi type heatsink on it for pennies and assume it would survive! I believe the DataSheet (the translated one on my Github) has details of current consumption. Great to hear from you, thanks for posting.
Did you try to use SPI interface?
you add definitions just after the #include group
like: #define PIN_SPI_MOSI 11
ecc..
or add some lines at Pins_Arduino_h
thank you very much
TBH I can't remember what I tested out. If it's not in the demo video then I guess I did not, but I know lots of others have expanded on what I did. Try a search on GitHub for that chip name to see what you get.
Great video!
Can you tell if the USB-Serial chip is more a FTDI or a CH340 type?
And, more important, the clock_prescale_set() looks pretty generic so the code might also work correctly on a standard UNO?
I haven't got one to hand but I'd be (pleasantly) surprised if it were an FTDI chip; the CH340 is much cheaper so I bet it's that one. Or a clone of the FTDI chip, of course!
CH9340 in my lgt8f328P Purple type c from aliexpress
@@RalphBacon AFAIK there are no real working FTDI clones since they manage their copyright pretty well, the same as MAX.
Great video. Is the oscillator quartz, ceramic or internal RC?
It's internal, Beamer, which keeps the cost and size of the board down too. So why couldn't Atmel do this with the ATMega328P, they must have much larger resources than a Chinese fab? The Xtal is usually the biggest thing on Nano-type boards, it looks well out of place. But this one looks neat. BTW it _can_ take an external Xtal too, though why you would want to I don't know.
@@RalphBacon The Atmegas DO have an internal oscillator, but it's not considered precise enough and for timing-sensitive applications it's best to use a crystal. Don't know about the precision of the Green's one, but they might have been able to do better since... well, the design of the atmel one is what, 15+ years old now?
thanks for technical info. what is working voltage level 3.3v or 5v essepically for serial communications? i didnt hear
It's a 5v board, same as the Nano. There's a whole bunch of information by David Buezas now at: github.com/dbuezas/lgt8fx
Hello SIr... hope you read this.
I 'm going to use one of those LGT8F328P to replace the Arduino nano in a Arduino cnc. I'm wondering which files i need to change in the grbl files in order to use this clone Arduino nano. Would be kind and give me some idea/direction please.
I hope is something doable,... looking forward to hear from you. Best regards.
I'm pretty sure all the information you need to use this board is in the video and my GitHub, the link will be in the video description. And what are grbl files?
@@RalphBacon I got a chuckle with ur question... I assumed you would know that well enough,.. but if not. This is the definition: grbl (Software)
Software description: an open source, embedded, high performance g-code-parser and CNC milling controller written in optimized C that will run on a straight Arduino.
That's the reason of my question...I wouldn't know which files to modify in the grbl files in order to take advantage of the LGT8328P mcu faster clock rate.
Anyway, in case you find out.
Could you please let me know.
Thanks for your attention... I enjoy your videos, very good indeed.
I don't have a CNC machine, Juan. Sigh. I don't even have a 3D printer. Double sigh. I certainly don't know what grbl files are! Well, I do now!
@@RalphBacon :)Thanks for your time anyway... Take care
I have not been working GRBL files lately but, GRBL are commands for the CNC machine (interpreted by the Arduino or something else and are used to control the CNC machine, not the Arduino its self). There should be no need to parse those files because you use another processor.
But you do need to change the Arduino software (and/or library) and (re)upload it to the Arduino, Wich means you need the source code for the GBRL-interpreter that you are using. Or get an other GRBL-interpreter and make the required changes in that.
Interesting that I can't seem to find the bare ICs in SOP or LQFP from the usual suppliers (Aliexpress, LCSC, ebay) I can find tons of modules, but there doesn't seem to be a source for the chips themselves
FWIW I found a source for them on taobao (chinese):
item.taobao.com/item.htm?spm=a312a.7700824.w4004-2729707598.25.bf1d374cKGeTlP&id=537735990461
Double Update: Man these are not easy to find, but I found a single seller that will sell them to westerners easily:
www.aliexpress.com/item/32821636647.html (not an affiliate link)
Me neither, Mike. I even queried this with my sponsor LCSC.com and they said it wasn't one of the products they stocked. I suspect this chip is prevalent in the Chinese home market and has now been made available via modules to us in the West. Whether we will ever get the bare chips is somewhat doubtful. I suppose it would be feasible to buy the cheapest board (the SSOP20 version can be had for $0.74, or the LQFP32 for $1.29) and just desolder the chips. Or use the modules as plug in devices for a bigger PCB.
Watched your LGT8F328P vids the first time around. Just be reading through the dbuezas github and the functions such as fastio and the PMW are quite interesting. The extra analogReference voltages also very handy.
Think I'll order one and see how it goes.
Maybe something worth revisiting? Or too old now? I know I'm too old for all this extra learning LOL!!
Cheers.
Matt.
These are good boards as a replacement for a Nano (same size, better performance). However, there a couple of compatibility issues that most user won't encounter, like differential analog inputs when it behaves a bit differently. Oh, and we are _never_ too old to learn something new. I'm the living proof!
@@RalphBacon Thanks Ralph. I've ordered one so will have a play. A tad cheaper than a Nano but that really makes little difference. Cheers!
@@TYGAMatt I bought some recently too but both came without a bootloader, I am at my wits end on how to flash them
@@afkafkafk I've seen reference to bootloaders for this chip but haven't looked into it. Hopefully I won't have to but the info is probably out there.
@@afkafkafk well, the postie delivered my LGT8F328P board today so I'll have a bit of a play with it later.