LGT8F328P Replacement for ATMEGA328Pat 32MHz

Electronic or otherwise, we love our gadgets!
User avatar
F2B
Posts: 200
Joined: 16 Feb 2018, 11:23
Location: 20 m NE of Amsterdam

Re: LGT8F328P Replacement for ATMEGA328Pat 32MHz

Post by F2B »

Martin wrote: 09 Aug 2019, 22:41 The Pro Mini is pretty much a Nano without the USB socket and the USB interface chip. It also lacks the 6-pin ICSP pads though, which makes using a USBASP for programming slightly more hassle.
RON wrote: 09 Aug 2019, 22:59 Thanks martin,
Yes I’ve used those before. Slightly weird off set pins on the middle. A bit awkward to wire up for programming and they don’t fit in vero either.
My thoughts exactly, but I've found these to my liking:
Image
https://www.ebay.com/itm/1-2-5-10PCS-go ... 0012.m1985
All (to me) useful pins are on the outside AND at a 0.1" grid.
I satisfactorily (is that English? :? :lol: )used some already, including in my Little Black Box:
Image
Image
F2B or not to be....
User avatar
Mike_K
Posts: 669
Joined: 16 Feb 2018, 06:35
Location: Hertfordshire

Re: LGT8F328P Replacement for ATMEGA328Pat 32MHz

Post by Mike_K »

Just a slight word of caution. The above aren't really arduino pro minis at all, as they haven't got the normal AVR ATMega 328P (like a Uno, Pro Mini or Nano), but a Logic Green LGT8F328P clone processor. They work quite well, but there are a number of differences, some good, such as 32MHz clock speed at 3.3V, 12 bit ADC and a lot cheaper, but some not so good, such as many libraries not working without modification, not as many I/O (in this version), inferior support and documentation and you need a different Arduino board core to get them to work. Selecting pro mini from the boards menu won't work!

Mike
Martin
Posts: 744
Joined: 16 Feb 2018, 14:11
Location: Warwickshire

Re: LGT8F328P Replacement for ATMEGA328Pat 32MHz

Post by Martin »

That link's not working for me at the moment.

I already have a few of the "Nano" ones, but I'd not used them for anything until now. I fired one up a few days ago, and using the information provided on Ralph Bacon's Github page, soon had one working nicely at 32MHz.

Out of the box they run at 16MHz, making them more compatible with a standard Arduino. Ralph explains how you have to add a couple of extra lines to your sketches to switch them up to 32MHz. Once you do that, they still seem to run fine, with correct baud rates on the serial port, and the millis() and micros() timers working accurately and the I2C and SPI interfaces operating normally.

They're supposed to run at 32MHz with the voltage at 5V, 3.3V or even down to 1.8V, and they have a more accurate Analogue to Digital with twice the resolution and more voltage references, so definitely useful.

I've ordered a bunch of the smaller ones with the surface mount dual-in-line chip, rather than the square chip used on the "Nano" from Ali Express - they're even smaller than a pro mini and don't have a USB port. Cost is just 58p. I ordered ten, so including shipping they cost me 86p each. I don't know how easy they'll be to program with a USBASP yet. I'll let you know, if and when they arrive.

Image

https://www.aliexpress.com/item/4000375 ... 4c4dYM5oOM
Martin
Posts: 744
Joined: 16 Feb 2018, 14:11
Location: Warwickshire

Re: LGT8F328P Replacement for ATMEGA328Pat 32MHz

Post by Martin »

Phil_G wrote: 16 Jun 2020, 15:09 Only an RC clock though, no crystal or resonator....
True, but the data sheet (english version here: https://github.com/watterott/LGT8F328P- ... nglish.pdf) says that the internal oscillator is calibrated accurate to 1% across the working temperature range - so should be good enough for most applications.
User avatar
Mike_K
Posts: 669
Joined: 16 Feb 2018, 06:35
Location: Hertfordshire

Re: LGT8F328P Replacement for ATMEGA328Pat 32MHz

Post by Mike_K »

Hi Martin

I never did get Ralph Bacons board installation instructions to work, but used this in the preferences "additional Boards Manager URLs:" and it has worked with every "clone" I've tried.

https://raw.githubusercontent.com/dbuez ... index.json

In general, I've found they work fairly well and where speed is needed, they are far better, with three exceptions:- Where accurate timing is needed, some libraries won't work without modification and the EEPROM (or lack of it).

I'm not certain that the internal oscillator is actually 1%, though serial has always worked OK, so must be within 2%. When I've tried a ppm meter, some read identical to Nano with an xtal, some over 1% faster and some a bit slower, so 1500uS is timed as 1522uS and another as 1490uS whereas a Nano with an xtal will always read 1500uS +/-1uS. But it seems fairly well temperature compensated and doesn't seem to vary much with temperature.

Some badly written Arduino libraries won't run without a bit of tweaking. Some check if 8MHz and if not assume 16MHz, so are easily fixed, other libraries cause obtuse error messages that I can't trace and usually find it quicker to find a different library that works OK.

The other minor issue is the EEPROM is emulated in program flash, a bit like you can do with the Opti bootloader. If you want 1K of EEPROM, it reserves 2K of flash and splits this into two banks of 1K. If you do an EEPROM write, it copies the "active" 1K bank with the saved values to the other 1K bank and then makes that page active. Next EEPROM save and it swaps 1K banks again. EEPROM writes are normally relatively slow, but this is way slower. The bootloader is 1K, so you get 31K useable and if you use 1K "emulated EEPROM" then only 29K is left, which for most isn't a problem.

I didn't try programming with an ICSP as the Opti bootloader is fairly fast and I've lived with that.

It'll be interesting to hear what you think of them.

Mike
Post Reply