Home

G80 SoC User Manual

image

Contents

1. NETMF focuses on the specific requirements of resource constrained embedded systems Development debugging and deployment is conveniently performed using Microsoft s powerful Visual Studio tools all through standard USB cable Programming is done in C or Visual Basic This includes libraries to cover sockets for networking modern memory management with garbage collector and multitasking services In addition to supporting standard NET features NETMF has embedded extensions supporting General Purpose IO GPIO with interrupt handling Analog input output Standard buses such 12C SPI USB Serial UART PWM Networking File System Display graphics supporting images fonts and controls Rev 0 01 Page 5 of 51 www GHlElectronics com GHI Electronics _LLC G80 SoC User Manual Introduction 1 4 GHI Electronics and NETMF For years GHI Electronics has been the lead Microsoft partner on NET Micro Framework NETMF The core NETMF was also extended with new exclusive libraries for an additional functionality such as USB Host One of the important extensions by GHI Electronics is Runtime Loadable Procedures RLP allowing native code Assembly C to be compiled and loaded right from withing managed code C Visual Basic to handle time critical and processor intensive tasks IT can also be used to add new native extensions to the system As for networking WiFi and PPP libraries are added by GHI Electronics to the NETMF core
2. NETMF has its own time keeping that is independent from the real time clock If actual time is need the software should read the RTC and set the system s time using System using GHI Processor using Microsoft SPOT public class Program public static void Main DateTime DT try DT RealTimeClock GetDateTime Debug Print Current Real time Clock DT ToString catch If the time is not good due to powerloss an exception will be thrown and a new time will need to be set Debug Print The date was bad and caused a bad time This will set a time for the Real time Clock clock to 1 01 01 on 1 1 2012 DT new DateTime 2012 1 1 1 1 1 RealTimeClock SetDateTime DT if DT Year lt 2011 Debug Print Time is not resonable Debug Print Current Real time Clock RealTimeClock GetDateTime ToString This will set the clock to 9 30 00 on 9 15 2011 DT new DateTime 2 11 9 15 7 30 RealTimeClock SetDateTime DT Debug Print New Real time Clock RealTimeClock GetDateTime ToString Tip The system time can also be set using time services through the internet Rev 0 01 Page 45 of 51 www GHlElectronics com GHI Electronics _LLC G80 SoC User Manual The G80 Dev Board 8 19 Watchdog Watchdog is used to reset the system if it enters an erroneous state The error can be due to internal fault or the user s managed code When the Watchdog is enabled with a sp
3. using System Threading using Microsoft SPOT using Microsoft SPOT Hardware using GHI Pins using GHI I0 public class Program public static void Main uint signal new uint 100 SignalCapture pin new SignalCapture GHI Pins G80 Gpio PE Port ResistorMode Disabled pin Read false signal Thread Sleep Timeout Infinite This is available through the GHI Hardware assembly Rev 0 01 Page 29 of 51 www GHIElectronics com GHI Electronics _LLC G80 SoC User Manual The G80 Dev Board 8 6 Serial Port UART One of the oldest and most common protocols is UART or USART G80 hardware exposes four UART ports Serial Port G80 SoC UART Hardware Handshaking COM1 UARTO Not Supported COM2 UART 1 Supported COM3 UART2 Not Supported COM4 UART3 Not Supported Important Note Serial port pins have 3 3V TTL levels where the PC uses RS232 levels For proper communication with RS232 serial ports PC serial port an RS232 level converter is required One common converter is MAX232 Note If the serial port is connected between two TTL circuits no level converter is needed but they should be connected as a null modem Null modem means RX on one circuit is connected to TX on the other circuit and vice versa using System using System 10 Ports using System Threading using Microsoft SPOT public class Program public static void Main SerialPort C
4. Combined with Ethernet and the other managed services it is a complete toolbox for the internet of things All the mentioned features are loaded and tested on the G80 SoC GHI Electronics continuously maintains upgrades and solves any of the issues on the G80 SoC firmware to provide regular and free releases Users can simply load the new software on the G80 SoC using USB or Serial and even use the in field update feature This feature allows the upgrade to be done through any of the available interface including file system and networking Rev 0 01 Page 6 of 51 www GHlElectronics com GHI Electronics _LLC G80 SoC User Manual The Hardware 2 The Hardware The G80 SoC core components includes the processor 1MB flash and 256KB RAM The small 38 1 x 26 7 x 3 55 mm only 1 x 1 5 inches module contains everything needed to run a complex embedded system in a cost effective and flexible solution All that is needed is a 3 3V power source and some connections to take advantage of the G80 SoC s long list of available features 2 1 Microcontroller The microcontroller is the heart of G80 SoC Running at 180Mhz 32Bit Cortex M4 and includes a long list of available peripherals The NETMF core libraries combined with the GHI Electronics extensions provide a long list of methods to access the available peripherals Rev 0 01 Page 7 of 51 www GHlElectronics com GHI Electronics LLC G80 SoC User Manual Pin Out Description 3
5. This class is used for manipulating the processor registers directly To be completed var EMCCLKSEL new GHI Processor Register x400FC1 EMCCLKSEL ClearBits 1 lt lt OVERDRIVE EMCCLKSEL SetBits 1 lt lt NORMAL 9 2 AddressSpace Allows applications to read and write memory directly This code reads a byte from address 0xA0000000 GHI Processor AddressSpace Read xAQ0000G0 9 3 Battery RAM To be added 9 4 EEPROM To be added 9 5 Runtime Loadable Procedure To be determined Rev 0 01 Page 49 of 51 www GHlElectronics com GHI Electronics _LLC G80 SoC User Manual design Consideration 10 Design Consideration To be added Rev 0 01 Page 50 of 51 www GHlElectronics com GHI Electronics _LLC G80 SoC User Manual Legal Notice Legal Notice Licensing The G80 SoC with all its built in software components is licensed for commercial and non commercial use No additional fee or licensing is required Disclaimer IN NO EVENT SHALL GHI ELECTRONICS LLC OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT INDIRECT INCIDENTAL SPECIAL EXEMPLARY OR CONSEQUENTIAL DAMAGES INCLUDING BUT NOT LIMITED TO PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES LOSS OF USE DATA OR PROFITS OR BUSINESS INTERRUPTION HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY WHETHER IN CONTRACT STRICT LIABILITY OR TORT INCLUDING NEGLIGENCE OR OTHERWISE ARISING IN ANY WAY OUT OF THE USE
6. 4 Targeting Different Versions of the Framework There are times when it may be useful to compile and deploy applications for an older version of the SDK For example if there is a module with older firmware and there is an older application that needs to be deployed GHI Electronics and Microsoft makes this easy by shipping the previous version of the framework as part of the current package Under Project Properties use the Application panel to target the desired version Rev 0 01 Page 17 of 51 www GHIElectronics com GHI Electronics _LLC G80 SoC User Manual NETMF TinyCLR firmware res MFConsoleApplication1 Microsoft Visual Studio Express 2012 for Windows Des FILE EDIT VIEW PROJECT BUILD DEBUG TEAM TOOLS TEST WINDOW HELP 50 5 B amp W 9 PD Stat Debug AnyCPU a t 3 ad Object Browser Program cs g Application Configuration N A ig Build Build Events Platform N A Resources MFConsoleApplication1 MFCon Ref Paths Seb Target framework NET Micro Framework E E TE NET Micro Framework 3 0 NET Micro Framework 4 0 NET Micro Framework 4 1 NET Micro Framework 4 2 NET Micro Framework 4 3 Install other frameworks ify how application resources will be managed Rev 0 01 Page 18 of 51 www GHIElectronics com GHI Electronics _LLC G80 SoC User Manual The Libraries 7 The Libraries Similar to the full desktop NET NETMF includes many services to help in modern applicati
7. Outputs ZO INtSFFUPE PINS vscsseescscasove w26 8 2 Analog Inputs Outputs ince SiO PVM ccsa era 8 4 Signal Generator 28 8 5 Signal Capture nee 8 6 Setial Port VART J iirrainn 30 Table of Contents B WO ONE WITE siraan a eE E EEES 34 8 11 Graphics Fonts 8 12 USB HOSE sisscrasensonipesncecensiaciens 8 13 Accessing Files and Folders ise SDB MOMO inr EE 40 USB Mass SOJE ini NNE 40 8 14 Networking TCP IP 40 The Extensions 40 8 17 Extended Weak References EWR 8 18 Real TIMES COCK mirimiria 44 8 19 Watchdog 46 o 20 Per Ont siie S 46 9 Advanced use of the Microcontroller ccccccccecccceeeeeeeeeeeeeee 49 DN FRE GIST OM ces cncsntactegrecesbacdbisaecegsaetteacwrassunsatineacveinursseasadeomced 49 OZ AGCiGSS SPACGy ranie aS 49 93 BANEN RAM oe a a aE A 49 94 EEPROM srcane 49 9 5 Runtime Loadable Procedure 49 10 design Consideration 200 Legal Notita iiris enenda Re EEA 51 ee E r AE E E AE E TET TT 51 ISCAS isso ccsvasseszeciseaecesieespacecess oracansiveceneeessassesteazensseyareareess 54 G80 SoC Page 3 of 51 www ghielectronics com GHI Electronics _LLC G80 SoC User Manual Introduction 1 Introduction The G80 SoC is a powerful yet low cost surface mount System on Chip SoC running the NET Micro Framework software which enables the SoC to be programmed from Microsoft s Visual Studio through a USB cable Prog
8. Pin Out Description Many signals on the G80 SoC are multiplexed to offer multiple functions on a single pin Developers can decide on the pin functionality through the provided libraries These are some important facts pertaining to the available pins Advanced details on all pins can be found in the STM32F427 datasheet 3 1 Pin out Table 1 PE2 2 PES LDRO 3 PE4 LDR1 4 PES 5 PE6 6 VBAT 7 PC13 8 PC14 32 KHz IN RTC Crystal 9 PC15 32 kHz OUT 10 GND 11 3 3V 12 PHO 12MHz IN Main Crystal 13 PH1 12MHz OUT 14 RESET Active low not 5V tolerant 15 PCO ADC10 16 PC1 ADC11 17 PC2 ADC12 SPI2 MISO 18 PC3 ADC13 SPI2 MOSI 19 3 3V 20 GND Rev 0 01 Page 8 of 51 www GHlElectronics com GHI Electronics _LLC G80 SoC User Manual Pin Out Description 21 VREF 3 3V 22 3 3V This power source is for the internal analog circuitry 23 PAO ADCO COM4 TX 24 PA ADC1 COM4 RX 25 PA2 ADC2 PWM20 26 PA3 ADC3 PWM21 27 GND 28 3 3V 29 PA4 ADC4 DAC1 Not 5V tolerant 30 PA5 ADC5 DAC2 Not 5V tolerant 31 PA6 ADC6 PWM24 32 PA7 ADC7 PWM25 33 PC4 ADC14 34 PC5 ADC15 35 PBO ADC8 PWM10 36 PB1 ADC9 PWM11 37 PB2 38 PE7 39 PE8 40 PEQ PWMO 41 PE10 42 PE11 PWM1 43 PE12 44 PE13 PWM2 45 PE14 PWM3 46 PETS M
9. e NewPosition xX e NewPosition Y This is available through the GHI Usb and GHI Hardware assemblies Rev 0 01 Page 37 of 51 www GHIElectronics com GHI Electronics _LLC G80 SoC User Manual The G80 Dev Board 8 13 Accessing Files and Folders The File System feature in NETMF is near very similar to the full NET and can be tested from within the Microsoft NETMF emulator with minor changes Changes include removing any of the GHI library dependencies There are no limits on file sizes and counts beside the limits of the FAT file system itself NETMF supports FAT16 and FAT32 Files are made accessible on SD cards and on USB memory devices through the USB Host library Most online examples on how to use NET to access files on PCs can be used to read and write files on the G80 Module The GHI Electronics online documentation has further examples as well The only difference from a the full NET on the PC would be in the need to mount the media and also in the media names The easiest way to know and handle the media names is by obtaining the root directly name and dynamically using that name This is available through the GHI Hardware assembly for SD or USB media also required assemblies for the file system functions System IO and Microsoft SPOT IO Rev 0 01 Page 38 of 51 www GHIElectronics com GHI Electronics _LLC G80 SoC User Manual The G80 Dev Board using System using System IO usi
10. own MAC through software byte newMAC new byte x x1A OxF1 x 1 0x42 OxDD var enc new GHI Networking EthernetENC28J60 SPI SPI_module SPI1 G8 P1_17 chip select G8 P2_21 external interrupt Rev 0 01 Page 40 of 51 www GHlElectronics com GHI Electronics _LLC G80 SoC User Manual The G80 Dev Board G8 P1_14 reset 3 change to target design enc PhysicalAddress newMAC This is available through the GHI Networking assembly There is no need to set the MAC address when using WiFi as the system obtains the MAC from the WiFi module itself Tip Some MAC addresses are not legal The internet includes MAC address generators that can be used in testing IP address DHCP or static DHCP dynamic IP and Static IP are both supported If using dynamic IP the G80 will not obtain an IP lease at power up DHCP can only be enabled from software FEZ Config has a DHCP enable option but it has no effect on getting the IP lease on start up var enc new GHI Networking EthernetENC28J60 SPI SPI_module SPI1 G8 P1_17 chip select G8 P2_21 external interrupt G8 P1_14 reset change to target design enc EnableDhcp enc EnableDynamicDns This is available through the GHI Networking assembly Rev 0 01 Page 41 of 51 www GHlElectronics com GHI Electronics _LLC G80 SoC User Manual The G80 Dev Board Ethernet The support for Ethernet is available t
11. stated Rev 0 01 Page 11 of 51 www GHlElectronics com GHI Electronics _LLC G80 SoC User Manual G80 SoC on boot up 4 G80 SoC On Boot Up To be added Rev 0 01 Page 12 of 51 www GHIElectronics com GHI Electronics _LLC G80 SoC User Manual The GHI Boot Loader 5 The GHI Boot Loader The GHI Boot Loader software is pre loaded and locked on the G80 SoC It is used to update the firmware and can be used to do a complete erase all flash memory The GHI boot loader is rarely needed but it is recommended to keep access available in all project designs The GHI boot loader accepts simple commands sent with the help of a terminal service software such as TeraTerm or Hyper Terminal Acommand character is sent and the boot loader performs an action results are returned in a human friendly format followed by a BL indicating that the boot loader is ready for the next command All commands and responses use ASCII encoded characters The G80 SoC on boot up section provides the required information on how to choose the access interface and how to access the GHI boot loader 5 1 The Commands Command Description Notes V Returns the GHI Loader Format X XX version number e g 1 06 E Erases the Flash memory Confirm erase by sending Y or any other character to abort This command erases TinyBooter the G80 firmware and the user s application X Loads the new Error Reference source not found section explains th
12. G80 SoC User Manual Rev 0 01 May 5 2015 User Manual G80 System on Chip Document Information Information Description Abstract This document covers information about the G80 SoC specifications tutorials and references GHI Electronics _LLC G80 SoC User Manual Revision History Rev No Date Modification Preliminary version kkk This is a preliminary version Rev 0 01 Page 2 of 51 www GHIElectronics com GHI Electronics _LLC G80 SoC User Manual Table of Contents E arole SHOR sa EN ETT T HERE 1 1 G80 SoC Key Features 1 2 Example Applications 1 3 The NET Micro Framework 1 4 GHI Electronics and NETMF 2 MG FAN OWANG piirissa ZU IGROCOMUNONOE sci E teed yap Cure eae 2P Out DESRMOUGIM cis ivi cesrecinstsnapeciealpstiwainereals A 3 1 Pin out Table 4 G80 SoC on boot up free 5 The GH Boat LOAdOh asc cicsssccvesisnvseasyescewepnacateenvesearenpsnds 5 1 The Commands 6 NETMF TinyCLR firmware 6 1 Assemblies Version Matching nk 6 2 Deploying tothe Emulators cccccsscceosanesserersccsecaseaesscncnecesees 6 3 Deploying to the G80 SOC sscsssesscvsseivcascssecsacssccascvancreceacses 6 4 Targeting Different Versions of the Framework tis FNS Librae Sisenna esn eae 7 1 Finding NETMF Library Documentation 20 2 loading ASSO MONGS sssini eaii 20 8 The G80 Dev Board 22 8 1 Digital Inputs
13. I Pins G80 Gpio PEO false Port ResistorMode PullUp while true if Button Read true LED Write true Thread Sleep 500 LED Write false Thread Sleep 5 Rev 0 01 Page 25 of 51 www GHIElectronics com GHI Electronics _LLC G80 SoC User Manual The G80 Dev Board Interrupt Pins The beauty of modern and managed language shines with the use of events and threading This example will set a pin high when a button is pressed It should be noted here that the system in this example spends most its time a in a lower power state Note Only pins on port 0 and port 2 are interrupt capable using System using System Threading using Microsoft SPOT using Microsoft SPOT Hardware using GHI Pins public class Program public static OutputPort LED new OutputPort GHI Pins G8 Gpio PE14 true public static void Main InterruptPort Button new InterruptPort GHI Pins G80 Gpio PE true Port ResistorMode PullUp Port InterruptMode InterruptEdgeBoth Button OnInterrupt Button_OnInterrupt The system can do anything here even sleep Thread Sleep Timeout Infinite static void Button_OnInterrupt uint port uint state DateTime time LED Write state gt Q Rev 0 01 Page 26 of 51 www GHlElectronics com GHI Electronics _LLC G80 SoC User Manual The G80 Dev Board 8 2 Analog Inputs Outputs Analog inputs can read voltages from OV to 3 3
14. ODE debug interface High USB Low COM1 47 PB10 PWM6 SPI2 SCK 48 PB11 PWM7 Rev 0 01 Page 9 of 51 www GHIElectronics com GHI Electronics _LLC G80 SoC User Manual Pin Out Description 49 VCAP1 Connect to a 2 2uF capacitor 50 3 3V 51 PB12 CAN2 RD 52 PB13 CAN2 TD 53 PB14 USB Host D 54 PB15 USB Host D 55 PD8 COM3 TX 56 PD9 COM3 RX 57 PD10 58 PD11 COM3 CTS 59 PD12 COM3 RTS 60 PD13 PWM13 61 PD14 PWM14 62 PD15 PWM15 63 PC6 PWM16 64 PC7 PWM17 65 PC8 PWM18 SD DO 66 PC9 PWM19 SD D1 67 PA8 MCO 68 PAQ COM1 TX 69 PA10 COM1 RX 70 PA11 USB Device D 71 PA12 USB Device D 72 PA13 73 VCAP2 Connect to a 2 2uF capacitor 74 GND 75 13 3V Rev 0 01 Page 10 of 51 www GHIElectronics com GHI Electronics _LLC G80 SoC User Manual Pin Out Description 76 PA14 77 PA15 PWM4 78 PC10 SD D2 79 PC11 SD D3 80 PC12 SD CLK 81 PDO CAN1 RD 82 PD1 CAN1 TD 83 PD2 SD CMD 84 PD3 COM2 CTS 85 PD4 COM2 RTS 86 PD5 COM2 TX 87 PD6 COM2 RX 88 PD7 89 PB3 PWM5 SPI1 SCK 90 PB4 PWMB SPI1 MISO 91 PB5 PWwMg SPI1 MOSI 92 PB6 IC SCL 93 PB7 C SDA 94 Reserved 95 PB8 PWM22 96 PB9 PWM23 97 PEO 98 PE1 99 GND 100 3 3V All pins are 5V tolerant if not otherwise is
15. OF THIS PRODUCT EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE SPECIFICATIONS ARE SUBJECT TO CHANGE WITHOUT ANY NOTICE GHI ELECTRONICS LLC LINE OF PRODUCTS ARE NOT DESIGNED FOR LIFE SUPPORT APPLICATIONS G80 is a Trademark of GHI Electronics LLC NET Micro Framework Visual Studio MFDeploy and Windows are registered or unregistered trademarks of Microsoft Corporation Other Trademarks and Registered Trademarks are Owned by their Respective Companies Rev 0 01 Page 51 of 51 www GHlElectronics com
16. OM1 new SerialPort COM1 int c COM1 ReadByte LD wwe This is available through the Microsoft SPOT Hardware SerialPort assembly Rev 0 01 Page 30 of 51 www GHlElectronics com GHI Electronics _LC G80 SoC User Manual The G80 Dev Board 8 7 SPI G80 supports three SPI interfaces SP11 SPI2 and SPI3 SPI Bus is designed to interface with multiple SPI slave devices the active slave is selected by asserting the Chip Select line on the relative slave device Important note SPI2 is shared internally with the flash memory G80 uses Using a chip select is required with devices connected using SPI2 Improper use of SPI2 will cause G80 to not boot or not work properly The use of SPI1 is recommended using System Threading using Microsoft SPOT Hardware public class Program public static void Main SPI Configuration MyConfig new SPI Configuration Cpu Pin GPIO Pini false false true 1000 SPI SPI_module SPI1 SPI MySPI new SPI MyConfig byte tx_data new byte 10 byte rx_data new byte 10 MySPI WriteRead tx_data rx_data Thread Sleep Timeout Infinite This is available through the Microsoft SPOT Hardware assembly Rev 0 01 Page 31 of 51 www GHlElectronics com GHI Electronics _LLC G80 SoC User Manual The G80 Dev Board 8 8 12C I2C is a two wire addressable serial interface The G80 supports one master I2C port Refer to the Pin Out Description
17. V with a 10 Bit resolution Similarly the analog output can set the pin voltage from OV to 3 3V VCC to be exact with 10 Bit resolution These built in analog circuitry are not designed to be very accurate For high accuracy an external ADC can be added using the SPI bus perhaps using System using Microsoft SPOT using Microsoft SPOT Hardware public class Program public static void Main AnalogInput ain new AnalogInput GHI Pins G8 AnalogInput PB Debug Print Analog Pin ain Read This is available through the Microsoft SPOT Hardware assembly 8 3 PWM The available PWM pins have a built in hardware to control the ration of the pin being high vs low duty cycle A pin with duty cycle 0 5 will be high half the time and low the other half This is used to control how much energy is transferred out from a pin An example would be to dim an LED With output pins the LED can be on or off but with PWM it can be set to 0 1 duty cycle to give the LED only 10 of the energy using System using Microsoft SPOT using Microsoft SPOT Hardware public class Program public static void Main PWM LED new PWM GHI Pins G8 PwmOutput PE14 10000 10 false LED Start Rev 0 01 Page 27 of 51 www GHIElectronics com GHI Electronics _LLC G80 SoC User Manual The G80 Dev Board This is available through the the Microsoft SPOT Hardware PWM assembly Another use of PWM is to
18. chapter for more information about I2C signals assignments to G80 hardware pins Setup the I2C bus I2CDevice Configuration con new I2CDevice Configuration x38 400 I2CDevice MyI2C new I2CDevice con Start a transaction I2CDevice I2CTransaction xActions new I2CDevice 1I2CTransaction 2 byte RegisterNum new byte 1 2 xActions I2CDevice CreateWriteTransaction RegisterNum This is available through the Microsoft SPOT Hardware assembly Rev 0 01 Page 32 of 51 www GHlElectronics com GHI Electronics _LLC G80 SoC User Manual The G80 Dev Board 8 9 CAN Controller Area Network is a common interface in industrial control and automotive CAN is remarkably robust and works well in noisy environments All error checking and recovery methods are done automatically on the hardware TD Transmit Data and RD Receive Data are the only pins needed These pins carry out the digital signals that need to be converted to analog before it can be used There are different CAN transceivers The most common one is dual wire high speed transceivers capable of transferring data up to 1MBit second using System Threading using Microsoft SPOT Hardware using GHI IO public class Program public static void Main ControllerAreaNetwork Message msg new ControllerAreaNetwork Message msg ArbitrationId 0x123 msg Data 1 msg Length 1 msg IsExtendedId false GHI 10 ControllerAreaNe
19. documentation library on the GHI website Also the main support page for NETMF includes links to the library reference documentation NETMF APIs Because NETMF is a subset of the full NET platform services such as file input output and Networking are very close sometimes identical between the full NET Framework and the smaller NET Micro Framework The internet is a great source of NET examples code that often can be used in a NETMF program with no changes 7 2 Loading Assemblies In an earlier example the threading libraries were used This was done by identifying the namespace Via the statement using System Threading The compiled code for classes in the Threading library are part of the mscorlib assembly DLL Rev 0 01 Page 20 of 51 www GHlElectronics com G80 SoC User Manual GHI Electronics _LLC The Libraries To use other libraries the proper assembly file DLL must be added to the project Such as in adding the Microsoft SPOT Hardware to use a GPIO pin Assembly files used by a project are managed as References in Visual Studio Solution Explorer o a am 2 Search Solution Explorer Ctrl 41 Solution MFConsoleApplication1 1 project a amp MFConsoleApplication1 b Properties 4a tal References Microsoft SPOT Native a m mscorlib b c Program cs b D Resources resx Important note The emulator will only work with the Microsoft assemblies GHI Elect
20. e LED Write true Thread Sleep 5 LED Write false Thread Sleep 5 This is available through the Microsoft SPOT Hardware assembly Rev 0 01 Page 23 of 51 www GHlElectronics com GHI Electronics _LLC G80 SoC User Manual The G80 Dev Board While it is clear that the earlier example blinks an LED every one second on for 500ms and off for another 500ms it is not clear what pin on G80 will be controlled Instead of using the generic GPIO_PinO name the actual G80 name can be found in the GHI Pins assembly This example now uses the actual G80 pin name using the GHI Pins assembly using System using System Threading using Microsoft SPOT using Microsoft SPOT Hardware using GHI Pins public class Program public static void Main OutputPort LED new OutputPort GHI Pins G80 Gpio PE14 true while true LED Write true Thread Sleep 5 0 LED Write false Thread Sleep 5 Rev 0 01 Page 24 of 51 www GHIElectronics com GHI Electronics _LLC G80 SoC User Manual The G80 Dev Board Reading Input pins is as simple This example will blink an LED only when the button is pressed using System using System Threading using Microsoft SPOT using Microsoft SPOT Hardware using GHI Pins public class Program public static void Main OutputPort LED new OutputPort GHI Pins G80 Gpio PE14 true InputPort Button new InputPort GH
21. ecified timeout the user must keep resetting the Watchdog counter within this timeout interval or otherwise the system will reset Enable with 10 second timeout GHI Processor Watchdog Enable 10 1000 while true Do some work GHI Processor Watchdog ResetCounter 8 20 Power Control Embedded devices often must limit power usage as much as possible Devices may lower their power consumption in many ways 1 Reduce the processor clock 2 Shutdown the processor when system is idle keep peripherals and interrupts running 3 Shutdown specific peripherals 4 Hibernate the system A common way to wake a device is using the RTC alarm Whenever the alarm goes off it will wake the device These examples require the GHI Hardware and Microsoft SPOT Hardware assemblies Rev 0 01 Page 46 of 51 www GHlElectronics com GHI Electronics _LLC G80 SoC User Manual The G80 Dev Board Use Microsoft SPOT Hardware HardwareEvent OEMReserved2 for RTC alarm When the program starts it will set an RTC alarm for 30 seconds in the future and then hibernate until then using GHI Processor using Microsoft SPOT Hardware using System public class Program public static void Main RealTimeClock SetAlarm DateTime Now AddSeconds 3 PowerState Sleep SleepLevel DeepSleep HardwareEvent OEMReserved2 Continue on with your program here The device will awaken whenever an interrupt port is trigge
22. ed with the latest TinyBooter and NETMF TinyCLR using Visual Studio to load debug C and Visual Basic application is very easy If not installed yet the latest SDK should be downloaded and installed on the development machine The following link points to a page on the GHI Electronics website that shows what software components are necessary to install along with the latest SDK www ghielectronics com support netmf When done Visual Studio can be started to create a new Micro Framework project Console Application b Recent 4 Installed 4 Templates b Visual Basic 4 Visual C Windows Gadgeteer Micro Framework Test Sort by Default g Class Library E l Console Application T Device Emulator gi Window Application Visual C Visual C Visual C Visual C Search Installed Templates Ctrl E P Type Visual C A project for creating a NET Micro Framework application without a user interface b Visual C Visual Studio Solutions Samples gt Online Name MFConsoleApplication1 Location C Users GHI Developer Desktop jefftemp bf Browse Create directory for solution L OK Cancel Solution name MFConsoleApplication1 C is selected in this example but Visual Basic will be very similar Run the code as is by pressing F5 or clicking the start button This should open up the emulator and run the program This program prints Hello World on the output window not on
23. ev Board This is available through the GHI Networking assembly Wireless LAN WiFi To be added 8 15 PPP Point to Point PPP protocol is essential for devices needing to connect to mobile networks While typical embedded devices use the mobile modem s built in and very limited TCP IP stack systems with the G80 SoC will enjoy the use of these modems through PPP and the internal NETMF TCP IP stack The PPP feature is not currently available but is being ported to the G80 SoC 8 16 USB Client Device To be added Rev 0 01 Page 43 of 51 www GHIElectronics com GHI Electronics _LLC G80 SoC User Manual The G80 Dev Board 8 17 Extended Weak References EWR EWR is a way for managed applications to store data on non volatile memory This is meant to be used as a configuration holder that does not change frequently The NETMF documentation includes further details A good example is included with the Microsoft NET Micro Framework SDK See also the Error Reference source not found section 8 18 Real Time Clock The processor includes a real time clock RTC that can operate while the processor is off through a backup battery or a super capacitor An appropriate 32 768KHz crystal must also be added to the system All details about power and required crystal can be found in the STM32F427 datasheet and user manual Rev 0 01 Page 44 of 51 www GHlElectronics com GHI Electronics _LLC G80 SoC User Manual The G80 Dev Board
24. ge USB mass storage devices such as USB hard drives or memory sticks are directly supported on G80 through the USB Host library 8 14 Networking TCP IP Networking is a crucial part of today s embedded devices and the internet of things IoT NETMEF includes a full TCP IP stack with socket support and high level protocols such as HTTP The G80 SoC networking implementation over Ethernet WiFi and PPP The Extensions The way networking works on NETMF is very similar to the full desktop NET Also the networking libraries work on the Microsoft NETMF emulator This allows for testing and developing right on the desktop through the emulator However GHI Electronics adds few important extensions to the system to initialize the networking interfaces For example applications that do not use networking can still use the G80 SoC as it defaults with networking services disabled Programmatically developers can choose to add Ethernet for example These additions are typically only needed in the initialization and setup stage and these can t be used on the emulator If using the emulator is desired the few initialization lines can be commented out MAC address setting All G80 SoCs ship with the same default MAC address This is good for testing a single device on internal networks If using multiple devices or reaching the internet a proper MAC address must be set To set the MAC address FEZ Config can be used Also the G80 SoC can set its
25. generate tones In this case the duty cycle is typically set to 0 5 but then the frequency will be changed as desired In the case of servo motor control or when there is a need to generate a pulse at a very specific timing PWM provides a way to set the high and low pulse with 8 4 Signal Generator Using Signal Generator developers can produce different waveforms This is available on any digital output pin using System using System Threading using Microsoft SPOT using GHI Pins using GHI IO public class Program public static void Main uint signal new uint 4 1000 2000 3000 4000 SignalGenerator pin new SignalGenerator GHI Pins G8 Gpio PE14 false pin Set false signal Thread Sleep Timeout Infinite While handeled in software the SignalGenerator runs through internal interrupts in the background and so is not blocking to the system Another Blocking methd is also provided for higher accuracy For example the blocking method can generate acarrier frequency This is very useful for infrared remote control applications This is available through the GHI Hardware assembly 8 5 Signal Capture Signal Capture monitors a pin and records any changes of the pin into an array The recorded values are the times taken between each signal change using System Rev 0 01 Page 28 of 51 www GHlElectronics com GHI Electronics _LLC G80 SoC User Manual The G80 Dev Board
26. hrough the ENC28J60 SPl ethernet chip using System using Microsoft SPOT Hardware using Microsoft SPOT using Microsoft SPOT Net using Microsoft SPOT Net NetworkInformation using GHI Pins using GHI Networking public class Program static EthernetENC28J60 enc static bool hasAddress false static bool available false public static void Main NetworkChange NetworkAvailabilityChanged NetworkChange NetworkAvailabilityChanged NetworkChange NetworkAddressChanged NetworkChange_NetworkAddressChanged var enc new GHI Networking EthernetENC28J60 SPI SPI_module SPI1 G8 P1_17 chip select G8 P2_21 external interrupt G80 P1_14 reset change to target design enc Open enc EnableStaticIP 192 168 1 100 255 255 255 0 192 168 1 0 enc EnableStaticDns new string 192 168 1 0 while hasAddress available Debug Print Initializing System Threading Thread Sleep 10 Network ready now static void NetworkChange NetworkAvailabilityChanged object sender NetworkAvailabilityEventArgs e Debug Print Network available e IsAvailable ToString available e IsAvailable static void NetworkChange NetworkAddressChanged object sender EventArgs e Debug Print The network address has changed hasAddress enc IPAddress 0 0 0 0 Rev 0 01 Page 42 of 51 www GHlElectronics com GHI Electronics _LLC G80 SoC User Manual The G80 D
27. is command TinyBooter file process in more detail R Runs firmware Exits the GHI boot loader mode and runs TinyBooter B Changes the baud rate to User needs to change the baud rate on the terminal service 921600 accordingly Available on serial access interface only Notes e Commands are not followed by pressing the ENTER key The single command letter is sent to the G80 SoC which immediately begins executing the command e The Boot loader commands are case sensitive TO be completed Rev 0 01 Page 13 of 51 www GHlElectronics com GHI Electronics _LLC G80 SoC User Manual NETMF TinyCLR firmware 6 NETMF TinyCLR firmware The Firmware is the main piece of embedded software running on the G80 SoC It is what interprets and runs the user s managed application and it is what Microsoft s Visual Studio use to deploy hook into and debug the managed application As explained in Error Reference source not found section hardware interfaces between TinyCLR and the host development system is either USB or Serial In this chapter the examples use the USB interface If necessary the module s firmware can be updated as described in the Error Reference source not found chapter 6 1 Assemblies Version Matching The firmware includes extensions added by GHI Electronics These extensions are often improved and further extended If the managed application C or Visual Basic uses any of the GHI specific extension
28. ng Microsoft SPOT using Microsoft SPOT IO using GHI IO Storage class Program public static void Main II wes SD Card is inserted Create a new storage device SD sdPS new SDCard Mount the file system sdPS Mount Assume one storage device is available access it through NETMF and display the available files and folders Debug Print Getting files and folders if VolumeInfo GetVolumes IsFormatted string rootDirectory VolumeInfo GetVolumes RootDirectory string files Directory GetFiles rootDirectory string folders Directory GetDirectories rootDirectory Debug Print Files available on rootDirectory for int i 0 i lt files Length i Debug Print files i Debug Print Folders available on rootDirectory for int i 0 i lt folders Length i Debug Print folders i else Debug Print Storage is not formatted Format on PC with FAT32 FAT16 first Unmount when done sdPS Unmount Rev 0 01 Page 39 of 51 www GHlElectronics com GHI Electronics _LLC G80 SoC User Manual The G80 Dev Board SD MMC Memory SD and MMC memory cards have similar interfaces G80 supports both cards and also supports SDHC SDXC cards The interface runs through a true 4 bit SD interface SD cards are available in different sizes but they are all of an identical function making them all supported on the G80 SoC USB Mass Stora
29. on development One example would be threading This is typically very difficult to deal with on embedded systems but thanks to NETMF this is very easy and works as well as it does ona desktop application using System using System Threading using Microsoft SPOT public class Program We will print a counter every 1 second static int Count 0 static void CounterThread while true Infinite loop Thread Sleep 1000 Wait for 1 second Count Increment the count Debug Print Count Count Print the count FKK K K K K K K K OK K K K K K FK K OK K K K K K FK OK OK K K OK K K K K K K OK K OK OK OK K OK OK K K static void Main Create a second thread main is automatically a thread Thread EasyThread new Thread CounterThread EasyThread Start Run the Counter Thread We can now do anything we like We will print Hi once every 2 seconds while true Infinite loop Debug Print Hi Thread Sleep 200 The output from the earlier program will look similar to this Hi Count 1 Hi Rev 0 01 Page 19 of 51 www GHlElectronics com GHI Electronics _LLC G80 SoC User Manual The Libraries Count Count Hi Count Count Count 6 7 1 Finding NETMF Library Documentation While this user manual is not meant to be a tutorial on the use of NETMF a lot of details are provided to aid newcomers to NETMF For further details see the
30. pe font files to the TinyFNT format used on NETMF The end results will look professionally stunning Glide GHI Electronics has developed a high speed lightweight full featured graphics GUI framework called Glide The open source code is available with the Apache 2 license This allows for a commercial and non commercial use For convenience the compiled libraries are included with GHI s SDK Rev 0 01 Page 36 of 51 www GHIElectronics com GHI Electronics _LLC G80 SoC User Manual The G80 Dev Board 8 12 USB Host The USB Host allows the use of USB Hubs USB storage devices joysticks keyboards mice printers and more Additionally for USB devices that do not have a standard class low level raw USB access is provided for bulk transfers using System Threading using GHI Usb Host using GHI Usb using Microsoft SPOT public class Program static Mouse mouse public static void Main Subscribe to USBH event Controller DeviceConnected Controller_DeviceConnected Sleep forever Thread Sleep Timeout Infinite static void Controller_DeviceConnected object sender Controller DeviceConnectedEventArgs e if e Device Type Device DeviceType Mouse Debug Print Mouse Connected mouse new Mouse e Device mouse CursorMoved mouse_CursorMoved mouse ButtonChanged mouse_ButtonChanged static void mouse_CursorMoved Mouse sender Mouse CursorMovedEventArgs e Debug Print x y
31. ramming in a modern managed language such as C and Visual Basic allows developers to accomplish much more work in less time by taking advantage of the extensive built in libraries for networking file systems graphical interfaces and many peripherals A simple two layer circuit with just power and some connectors can utilize the G80 SoC to bring the latest technologies to any products There are no additional licensing or fees and all the development tools and SDKs are freely available 1 1 G80 SoC Key Features NET Micro Framework e TCP IP Stack NET sockets 168 MHz ARM Cortex M4 processor e PPP 256 KB RAM e USB Host 1 MB FLASH e Graphics image font and controls Embedded LCD controller e File System SD and USB Sticks 78 GPIO Pins 78 Interrupt Inputs 2 SPI I2C 4 UART 2 CAN Channels 16 12 Bit Analog Input 2 12 Bit Analog Output 4Bit SD MMC Memory card interface 26 PWM 112 mA max 25 C 1 5 mA Hibernate Mode 40 C to 105 C Operational RoHS Lead Free Dimensions 16 7 mm x 16 7 mm N Example Applications e Measurement tools and testers Rev 0 01 Page 4 of 51 www GHIElectronics com GHI Electronics _LLC G80 SoC User Manual Introduction Networked sensors Robotics Central alarm system Smart appliances Industrial automation devices 1 3 The NET Micro Framework Inspired by its full NET Framework Microsoft developed a lightweight version called NET Micro Framework NETMF
32. red Some devices can use interrupts internally that can cause spurious wakeups if not disabled Use Microsoft SPOT Hardware HardwareEvent OEMReserved1 for interrupts NETMF s interrupt ports only function when their glitch filter is enabled or they have an event handler subscribed using Microsoft SPOT Hardware using System public class Program public static void Main var interrupt new InterruptPort Cpu Pin GPIO Pin true Port ResistorMode PullUp Port InterruptMode InterruptEdgeHigh interrupt OnInterrupt interrupt_OnInterrupt PowerState Sleep SleepLevel DeepSleep HardwareEvent OEMReserved1 Continue on with your program here private static void interrupt_OnInterrupt uint data1 uint data2 DateTime time Interrupted Rev 0 01 Page 47 of 51 www GHIElectronics com GHI Electronics _LLC G80 SoC User Manual The G80 Dev Board Rev 0 01 Page 48 of 51 www GHIElectronics com GHI Electronics _LLC G80 SoC User Manual Advanced use of the Microcontroller 9 Advanced Use Of The Microcontroller The G80 SoC is based on the microcontroller There are times when direct programming is needed GHI has extended NETMF to allow assembly level access from managed code to the This chapter describes those features Important All examples in this chapter use the GHI Hardware assembly add it to References in Visual Studio see the Loading Assemblies section 9 1 Register
33. ronics libraries will not run on the emulator Rev 0 01 Page 21 of 51 www GHIElectronics com GHI Electronics _LLC G80 SoC User Manual The G80 Dev Board 8 The G80 Dev Board The G80 Dev Board is the easiest and fastest way to evaluate the G80 SoC It is also an excellent place to start developing applications It offers all of the G80 SoC features right on the board or it exposes the pins on a clearly labeled header Finally it is also a reference design for the G80 SoC The examples provide in this manual take advantage on the G80 Dev Board allowing for a quick copy paste of the code examples Rev 0 01 Page 22 of 51 www GHElectronics com GHI Electronics _LLC G80 SoC User Manual The G80 Dev Board 8 1 Digital Inputs Outputs GPIO General Purpose Input Output are used to set a specific pin high or low states when the pin is used as an output On the other hand when the pin is an input the pin can be used to detect a high or low state on the pin High means there is voltage on the pin which is referred to as true in programming Low means there is no voltage on the pin which is referred to as false Pins can also be enabled with an internal weak pull up or pull down resistor Here is a blink LED example using System using System Threading using Microsoft SPOT Hardware public class Program public static void Main OutputPort LED new OutputPort Cpu Pin GPIO_Pin true while tru
34. s care must be taken when a new SDK is installed This is due to the fact that the existing Visual Studio projects will include a local copy of the assemblies supplied by the old SDK during compilation of the application the extensions may not match what is found Additionally the assemblies themselves are compiled for use with specific SDK versions For example where an application was previously compiled with 4 2 then the 4 3 SDK is installed even if a successful compilation occurs no extension conflicts were found then the deployment process will begin to load 4 2 assemblies this will cause loading errors when compiling for 4 3 This will not harm the G80 SoC Visual Studio s Output panel will contain something like CIEE Object Browser v Show output from Build Et 1 gt Build started Project MFConsoleApplicationl Configuration Debug Any CPU a 1 gt C Program Files x86 MSBuild Microsoft NET Micro Framework v4 3 Device targets 561 5 warning Could not read state file obj Debug TinyResGen cache Unable to find assembly Microsoft SPOT Tasks Version 4 2 Culture neutral PublicKeyToken 267 f5421e7 4192 there is further discussions of assemblies in the Loading Assemblies section of chapter 7 Rev 0 01 Page 14 of 51 www GHIElectronics com G80 SoC User Manual NETMF TinyCLR firmware GHI Electronics _LLC 6 2 Deploying to the Emulator Once the latest SDK is installed and the G80 SoC is load
35. the screen If the output window is not visible it can be opened from the VIEW top menu When running the emulator has a pre developed device that appears The program closes when done causing the emulator device to close The output window of Visual Studio should be full of messages from loading assemblies libraries on power up to loading the application to the actual Hello Rev 0 01 Page 15 of 51 www GHlElectronics com GHI Electronics _LLC World G80 SoC User Manual NETMF TinyCLR firmware Now view open the program that was created automatically Program cs VIEW PROJECT BUILD DEBUG TEAM TOOLS TEST WINDOW HELP lt gt Code Ctrl Alt 0 Any CPU Bs Start Page fa Solution Explorer Ctrl W S i Team Explorer Ctrl Ctrl M amp Call Hierarchy Ctrl Alt K E Object Browser Ctri W J 3 Class View Ctrl W C g Error List Ctrl W E Ke Output Alt 2 g Task List Ctrl W T Ba Ranbmark Windows Ctrl R Change the program to the following Solution Explorer o aTa Search Solution Explorer Ctrl R Solution MFConsoleApplication2 4 E MFConsoleApplication2 b amp Properties b i References b Program cs b D Resources resx using System using Microsoft SPOT public class Program public static void Main Debug Print Amazing Press the F5 key The output window will now show something similar to the following image 100 Show outp
36. twork can new ControllerAreaNetwork ControllerAreaNetwork Channel One ControllerAreaNetwork Speed Kbps5 can SendMessage msg ea This is available through the GHI Hardware assembly There are two CAN channels on the G80 SoC Rev 0 01 Page 33 of 51 www GHIElectronics com GHI Electronics _LLC G80 SoC User Manual The G80 Dev Board 8 10 One wire Through one wire a master can communicate with multiple slaves using a single digital pin One wire can be activated on any Digital I O on G80 using System Threading using Microsoft SPOT using Microsoft SPOT Hardware public class Program public static void Main Change this to correct GPI pin for the onewire used in the project OutputPort myPin new OutputPort GHI Pins G8 Gpio PE7 false OneWire ow new OneWire myPin while true if ow TouchReset gt Debug Print Device is detected else Debug Print Device is not detected Thread Sleep 100e This is available through the Microsoft SPOT Hardware OneWire 8 11 Graphics The G80 SoC supports graphics on SPl based displays The only limitation on graphics is in the available memory While using SPI bus this GHI Electronics extension to NETMF allows G80 SoC to write directly from the internal memory to the SPI bus naively With the G80 graphics support users can leverage the NETMF graphics features such as e Windows Presentation Fo
37. undation WPF Rev 0 01 Page 34 of 51 www GHlElectronics com GHI Electronics _LLC G80 SoC User Manual The G80 Dev Board e BMP GIF still and JPEG image files e Fonts e Simple Shapes This simple example will run on the emulator and on the G80 SoC similarly It requires the Microsoft SPOT Graphics and Microsoft SPOT TinyCore using System Threading using Microsoft SPOT using Microsoft SPOT Hardware using Microsoft SPOT Presentation using Microsoft SPOT Presentation Media using GHI Processor using GHI Pins public class Program public static void Main Display Populate Display GHIDisplay DisplayN18 Display ControlPin G8 Gpio PE10 Display BacklightPin G80 Gpio PC7 Display ResetPin G8 Gpio PE12 Display ChipSelectPin G80 Gpio PD10 Display SpiModule G8 SpiBus Spi2 Display Bpp GHI Utilities Bitmaps BitsPerPixel BPP16_RGB_BE Display CurrentRotation Display Rotation CounterClockwise9 Display Save Bitmap LCD new Bitmap SystemMetrics ScreenWidth SystemMetrics ScreenHeight byte red int x while true for x 30 x lt SystemMetrics ScreenWidth 30 x 10 LCD DrawEllipse ColorUtility ColorFromRGB red 10 10 x 100 30 40 LCD Flush red 3 Thread Sleep 10 Rev 0 01 Page 35 of 51 www GHlElectronics com GHI Electronics _LLC G80 SoC User Manual The G80 Dev Board Fonts Thanks to NETMF developers can convert TrueTy
38. ut from Debug The thread lt No Name gt 0x2 has exited with code 0x0 Amazing 6 3 Deploying to the G80 SoC This section relies on the work done in the previous section as loading to the actual hardware device is exactly the same as loading to the emulator The only difference is in selecting the Rev 0 01 Page 16 of 51 www GHIElectronics com GHI Electronics _LC G80 SoC User Manual NETMF TinyCLR firmware device instead of the emulator This is done by going to the project properties In this example the G80 SoC is connected to the PC using the USB interface see Error Reference source not found section To deploy the application to the module select USB for Transport Running the application F5 key will load the exact same program on the G80 SoC and then run it The output window of Visual Studio will still show very similar messages but they are EDIT VIEW PROJECT BUILD DEBUG TEAM TOOLS TEST WINDOW HELI iP a WY gt Start Debug AnyCPU SLE y Application z x Configuration Active Debug gt Build pete Platform Active Any CPU 7 Debug Deployment Sa Resources a Transport s Reference Paths NET Micro Framework Emulator Seria TCP IP now coming from the G80 SoC directly If necessary the deployed program can use the full power of the Visual Studio debugger including stepping through lines inspecting variables setting breakpoints etc 6

Download Pdf Manuals

image

Related Search

Related Contents

Memorex MPD8819 User's Manual  MX-2300N/2700N/3500N/3501N/4500N/4501N Operation  saisir les sciences  PROJET D`AMENAGEMENT ET DE DEVELOPPEMENT DURABLE  Cox Advanced TV  

Copyright © All rights reserved.
Failed to retrieve file