LG8F328P mini EVB 5V Arduino Nano replacement development board (HCDVBD0038)

Post Reply
admin
Site Admin
Posts: 865
Joined: Sun Aug 05, 2012 4:02 pm

LG8F328P mini EVB 5V Arduino Nano replacement development board (HCDVBD0038)

Post by admin » Fri Jul 16, 2021 9:27 am

Image



The LG8F328P mini EV development board is a drop-in replacement Arduino R3 Nano pin compatible board. Instead of using the Nanos ATMega328p, it instead features the LG8F328P microcontroller. This microntroller was not only designed to be a low cost replacement for the ATMega328 but it also significantly improves on the 328s features. Most significant of which, the LG8F328P is capable of running sketches at over twice the speed of the Nano and includes other improvements such as higher resolution ADCs, a DAC, high current output pins and built in unique serial number (GUID).


Image


Features:
Model: LG8F328P Mini EV HCDVBD0038
Supply voltage: 5V via microUSB / 6.5 to 12V via Vin pin / 5V via 5V pin
Supply current: ~32mA
Clock speed 32MHz
Flash 32K
SRAM 2K
DIO: 12 / max 22
ADC: 8 (12 bit)
DAC: 1 (8 bit)
Comparator 1 (8 bit)
PWM Max 9
High current 80mA pins: 4
Dimensions (ex header pins): 45mm x 18mm x 4mm



Arduino IDE Setup Guide:

Note: This setup guide assumes that you have already downloaded and installed the Arduino IDE. If not please download and install it from the Arduino website here: https://www.arduino.cc/en/software

Adding support for the LGT8F328P development board is as easy as adding support for most other types of Arduino boards thanks to a set of board manager files created by David Buezas. To add board support to your Arduino IDE simply follow these steps:

1) Open up your Arduino IDE and click on the 'File' menu then select 'Preferences'


2) In the window that opens up locate the text box labelled 'Additional Boards Manager URLs:' then click on the open window button to the right of the text box:


Image


3) In the window that opens up cut and paste the following on a new line:

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


Image


4) Once pasted in, close the window and the Preferences window by clicking the OK buttons.


5) Next, in the main Arduino IDE window click the 'Tools' menu then go to the 'Board:' option and select 'Boards Manager' from the sub-menu.


6) In the Boards manager window that opens up locate the board files titled 'LGT8fx Boards' and then click on it's install button.

Image


7) The Arduino IDE will now install the board files required to support the LG8F328P board:


Image



Now plug the LGT8F328P development board into your computer via its USB port using a microUSB cable. Note that this board uses CH340 IC as a USB interface. Most operating systems including Windows 10 and above now support this device by default and so you shouldn't need to install any drivers. However, if for some reason Windows fails to install a driver you can download the CH340 driver from our github page here:

https://github.com/HobbyComponents/CH340-Drivers


Open the Arduino IDE and click on the 'Tools' menu then under the 'Boards' menu you should find a few new board options for various LGTF328 based boards. Select the board named 'LGTF328'

Once selected set the other settings as follows:

Clock Source: "Internal"
Clock: "32 MHz"
Variant: "328P-LQFP32 (e.g. MiniEVB nano-style and WAVGAT"
Port: The COM port assigned to your development board

You are now ready to upload a sketch to your board. To check that everything is set up correctly try uploading the following blink sketch:


  1. void setup()
  2. {
  3.   pinMode(13, OUTPUT);
  4. }
  5.  
  6. void loop()
  7. {
  8.   digitalWrite(13, HIGH);  
  9.   delay(1000);            
  10.   digitalWrite(13, LOW);
  11.   delay(1000);                
  12. }

If everything was setup correctly the sketch should upload to your board and when complete its built-in LED should be blinking slowly


FAQ:

How do I use the DAC?

The DAC is available on pin D4. You can use it via the Arduinos analogWrite() function except rather than outputting a PWM signal it will instead output an 8 bit resolution analogue voltage. See example sketch:

  1. // Output a sawtooth waveform as fast as possible. (c) HobbyComponents.com
  2.  
  3. byte level = 0;
  4.  
  5. void setup()
  6. {
  7.   analogReference(DEFAULT);
  8.  
  9.   pinMode(DAC0, ANALOG); //DAC0 is pin D4
  10. }
  11.  
  12. void loop()
  13. {
  14.   analogWrite(DAC0, level);
  15.   level++;
  16. }


How do I access the built-in serial number?

The 32 bit serial number is accessed via 8 bit registers GUID0, GUID1, GUID2, & GUID3. You can access these as one 32 bit number like this:

  1. // Access the devices unique serial number (c) HobbyComponents.com
  2. void setup()
  3. {
  4.   Serial.begin(9600);
  5.  
  6.   // Assign a 32 bit pointer to the start of the serial number
  7.   uint32_t *guid = (uint32_t) &GUID0;
  8.  
  9.   // Output the serial number to the UART
  10.   Serial.println(*guid, HEX);
  11. }
  12.  
  13.  
  14. void loop()
  15. {
  16. }


Libraries, example code, and diagrams are provided as an additional free service by Hobby Components and are not sold as part of this product. We do no provide any guarantees or warranties as to their accuracy or fitness for purpose.

Descriptions and diagrams on this page are copyright Hobby Components Ltd and may not be reproduced without permission.

RetroBoy
Posts: 73
Joined: Sat Feb 26, 2022 11:29 am
Location: U.K.

Re: LG8F328P mini EVB 5V Arduino Nano replacement development board (HCDVBD0038)

Post by RetroBoy » Tue Aug 30, 2022 1:41 pm

Good Afternoon,

Q1: Does this have the same EEPROM capacity as the Nano?

Q2: If Q1 YES - Is it accessed the same way ( EEPROM.h )?

Thanks S.

andrew
Site Admin
Posts: 1374
Joined: Sun Aug 05, 2012 4:15 pm

Re: LG8F328P mini EVB 5V Arduino Nano replacement development board (HCDVBD0038)

Post by andrew » Tue Aug 30, 2022 3:31 pm

Q1: Does this have the same EEPROM capacity as the Nano?

EEPROM support on the LGT8F328P is a little bit more complicated as it doesn’t actually have EEPROM memory but instead uses flash memory with hardware emulation to emulate EEPROM memory. It is capable of emulating either 0K, 1K, 2K, 4K, or 8K or EEPROM (with caveats) but by default I believe it is set to emulate 1K of flash (the same as an ATMEGA328), although that said, the Arduino examples seem to contradict this stating that the EEPROM size is 512K. Also it is my understanding that emulating anything above 1K will overwrite the bootloader.


Q2: If Q1 YES - Is it accessed the same way ( EEPROM.h )?

Yes you can use the standard Arduino EEPROM library but I would suggest taking a look at the Arduino examples. To do this, if you haven’t already, add board support to your IDE by following the guide in the first post then go to File->examples->Examples for LGT8F328->E2PROM
Comments made by this poster do not necessarily reflect the views of Hobby Components Ltd.

RetroBoy
Posts: 73
Joined: Sat Feb 26, 2022 11:29 am
Location: U.K.

Re: LG8F328P mini EVB 5V Arduino Nano replacement development board (HCDVBD0038)

Post by RetroBoy » Tue Aug 30, 2022 7:14 pm

Good Evening Andrew,

Very quick response ... thanks.

I actually only need 256bytes, so that should be within the limits. I will also take a look at the E2PROM Page.

As an aside it is purely to store the last relay settings 'chosen to be saved' before Power Off. Using an SD Card is a definate Over-Kill for 256bytes. I know about 100k same address problem, but the EEPROM Address I'm using is not 'Hard Coded'. I'm sure you'll agree it's a little bit difficult to store an address telling you what the address is that you're trying to store.

Anyway, I'm off to the E2PROM page.

Thanks Again, S.

dqj999
Posts: 3
Joined: Mon Jun 01, 2020 5:20 pm

Re: LG8F328P mini EVB 5V Arduino Nano replacement development board (HCDVBD0038)

Post by dqj999 » Mon May 29, 2023 4:21 am

How fast is the DAC converter? Would it be capable of creating an audio tone in the 1KHz to 2Khz region if provided with samples quickly enough? Are there any examples of such code available please?

DJ

andrew
Site Admin
Posts: 1374
Joined: Sun Aug 05, 2012 4:15 pm

Re: LG8F328P mini EVB 5V Arduino Nano replacement development board (HCDVBD0038)

Post by andrew » Tue May 30, 2023 8:31 am

How fast is the DAC converter? Would it be capable of creating an audio tone in the 1KHz to 2Khz region if provided with samples quickly enough? Are there any examples of such code available please?
The documentation is a little sketchy on specs for the DAC but assuming you want to do this via the Arduino IDE then it is more than capable of outputting a waveform at that sample rate. The sketch below is a simple example of outputting an array (albeit of only two bytes) of data to the DAC with no delay which results in a square wave in excess of 500KHz...

  1. byte data[] = {0, 255};
  2.  
  3. void setup()
  4. {
  5.   analogReference(INTERNAL2V56);
  6.   pinMode(4, ANALOG);
  7.   noInterrupts();    // Removes jitter
  8. }
  9.  
  10. void loop()
  11. {
  12.   for(byte i = 0; i < sizeof(data); i++)
  13.     analogWrite(4, data[i]);
  14. }
Comments made by this poster do not necessarily reflect the views of Hobby Components Ltd.

dqj999
Posts: 3
Joined: Mon Jun 01, 2020 5:20 pm

Re: LG8F328P mini EVB 5V Arduino Nano replacement development board (HCDVBD0038)

Post by dqj999 » Fri Jul 07, 2023 11:45 am

I've been using one of these successfully for a while now, but I've just damaged the USB micro socket -it's actually detached itself from the board. Is there a way that I can continue to program it via the SWC,TST and SWD pins?

Is there one of your driver boards that would work with this and how would I choose the programmer in the IDE?

andrew
Site Admin
Posts: 1374
Joined: Sun Aug 05, 2012 4:15 pm

Re: LG8F328P mini EVB 5V Arduino Nano replacement development board (HCDVBD0038)

Post by andrew » Fri Jul 07, 2023 1:50 pm

Is there a way that I can continue to program it via the SWC,TST and SWD pins?

Is there one of your driver boards that would work with this and how would I choose the programmer in the IDE?
The simplest option is to connect a standard USB to serial adapter to its serial interface and program it via that...

USB Adapter.........LG8F328P
5V/VBUS.................5V
GND...........................GND
TX...............................RX
RX...............................TX

You can then program it via the Arduino IDE as normal, i.e. leave all the board settings the same but just select the USB adapter for the COM port. The only caveat is it doesn't have a DTR pin which means each time you upload a sketch you'll have to manually reset the board at the correct moment by pressing its reset button just at the point the Arduino IDE switches from saying it is 'compiling' the sketch to 'uploading'.

These would be suitable serial adapters:

https://hobbycomponents.com/usb-interfa ... rt-adapter
https://hobbycomponents.com/usb-interfa ... al-adaptor
Comments made by this poster do not necessarily reflect the views of Hobby Components Ltd.

Post Reply

Return to “Arduino Development Boards”