Click here to Skip to main content
13,198,322 members (54,187 online)
Click here to Skip to main content
Add your own
alternative version

Tagged as

Stats

7.6K views
2 bookmarked
Posted 16 Dec 2015

Intel® Quark™ D1000 – PushButton ISR Example

, 16 Dec 2015
This guide covers using Intel® Quark™ D1000 Microcontroller, and s how how to use Eclipse* IDE to modify the simple example which is already implemented inside of firmware.

Editorial Note

This article is in the Product Showcase section for our sponsors at CodeProject. These articles are intended to provide you with information on products and services that we consider useful and of value to developers.

Get access to the new Intel® IoT Developer Kit, a complete hardware and software solution that allows developers to create exciting new solutions with the Intel® Galileo and Intel® Edison boards. Visit the Intel® Developer Zone for IoT.

Introduction

This guide covers using Intel® Quark™ D1000 Microcontroller, and s how how to use Eclipse* IDE to modify the simple example which is already implemented inside of firmware. This guide also show how to check the JTAG connection to D1000 CRB using OpenOCD to flash created image and do the source line debugging using it.

Programming Environment

Overview

Intel® Quark™ D 1 000 is supported by Intel System Studio for Microcontrolle rs (ISSM) which consists of C/C++ LLVM - based compiler (including assembler, linker, and C/C++ run - time libraries), GDB debugger, and OpenOCD on - chip debugger. It also includes plugins for Eclipse IDE integration, but also can be used as a standalone toolchain. Open the FW project in ISSM

Before create a project for Intel® Quark™ D1000 , you shall install all required SW packages such as Eclipse IDE for C /C++ Developers, ISSM, Putty and Zadig and please follow the installation guide in detail which can be found in "docs" folder under your ISSM installation. This guide assumes also that you already finished evaluation of "Hello World" and "FW" example s of Eclipse IDE. If not, please follow the "Using the Eclipse* IDE" section in user guide under "docs" of ISSM installation.

Now, launch the Eclipse* IDE using batch script(‘runEclipse.bat’) with your Eclipse* IDE installation path as argument then you can select the firmware project, in this guide the "FW - D1000" is the name of this firmware project", and make sure there is no build error.

When you successfully build the firmware, you can check the output of "FW - D1000.elf" under B inaries folder in your project which will be similar contents of following screen capture. If you cannot see the each image section with symbol info, you need to check if you install the "objdump" utility in your host. Otherwise, you would refer the secti on of the "Viewing GNU* Elf and Map Files" in user guide to install "objdump" and configure host’s path.

Figure 1 Object dump screen of FW - D1000 Programming Example – Send character string at ISR of HW event

After checking compilation of "FW - D1000", you can modify the example application according to your own response. In this example, we modify log string in "PushButton" application in "FW - D1000". Go the Applications folder in your "FW - D1000" project which has 10 example applications for Intel® Quark™ D1000 and check out the "AppConfig.h" file to see if which application ("PUSH_BUTTON_TEST") was enabled to be integrated in this project. Here is the macro definition to enable "PushButton" application in "AppConfig.h" file.

//#define MAN_DECODING
//#define POWER_MANAGEMENT_TEST
#define
PUSH_BUTTON_TEST
//#define ADC2SPI_TEST
//#define ADC2GPIO_TEST
//#define DDS_TEST
//#define OSCILLATOR_RE_TRIM
//#define PWM_TESTING
//#define MOTOR_CTRL
//#define UART_WAKE

Next, go the application entry file ("PushButton.c") of PushButton application under Applications folder and make a simple modification to see if you code change would actually work on real HW platform. In this example, we touched the string of "rtc_interrupt_msg" which was triggered by RTC at every second.

//////////////////////////////////////////////////////////////////////////////// 
// this is the real time clock callback function 
//////////////////////////////////////////////////////////////////////////////// 
char rtc_interrupt_msg[] = " \ r \ nSean RTC interrupt!" ; 
void rtc_callback_function_PB ( void ) 
{ 
    PUSH_UART(rtc_interrupt_msg, sizeof (rtc_interrupt_msg),0,0); 
    rtc_callback(rtc_ca llback_function_PB); // re - register callback 
}

Finally, you make sure all change was saved and ready to compile it. Compile and flash image to D1000

To flash the compiled binary to D1000 CRB, you need JTAG connection to the CRB which was described in detail in the section of "Starting Debugging Session" in User and Reference guide. When you try to launch OpenOCD perspective in Eclipse* IDE, please make sure the OpenOCD successfully read the target CPU’s "IdCode" and it would be same value of "Expected" IdCode.

In this example, we launch the OpenOCD connection first before run the Eclipse* IDE to establish JTAG connection to D1000 CRB. Sometimes, it cannot read IdCode and shows all zero value then, press the reset button then try again to see if the Open OCD can read the IdCode correctly. Now, it’s ready to flash your modified firmware to D1000 CRB when you see the following IdCode result as like below:

Figure 2 OpenOCD console of D1000 CRB

When you successfully establish JTAG connection to D1000 CRB, then go to the "FW - D1000" project in Eclipse* IDE to build the project. If there is no compilation error, you can see the "FW - D1000.elf" under Binaries folder and you can flash the built image to D1000 CRB by selecting debug perspective which was configured to use gdb over OpenOCD. See the below configuration for debug perspective:

Figure 3 Debugger configuration for D1000 CRB with OpenOCD

When the debugger successfully flashes the image to D1000 CRB, you can see the finish message on OpenOCD console. See the Figure 2. In this example, the debugger would halt the process at the "main" function to check step by step exe cution. And the following Figure 4 show how to set the breakpoint at the entry point of "main" then debugger would finish the image flashing & loading and stop the processor at the beginning of "main" function and ready to start. See the Figure 4.

Figure 4 Set the breakpoint at "main" function

In this example, we need to open serial console with Putty to check UART message so that it send out character string over UART when D1000 receive the HW event of ‘RTC’ or ‘ButtonPress’. When, we connect the D1000 CRB, there are two USB devices are configured, one is Dual RS232 HS which was used for OpenOCD JTAG connection and the other one is USB to serial Port. Before the free run the "PushButton" application, we need to open serial port using Putty with configurations: Baudrate - 19200, Flow Control - XON/XOFF.

Debugging the code – Step by Step debug scenario

When debugger finish the flashing and it show the beginning procedure at the very beginning of "main" function as below, in this example we enable the "PushButton" example then debugger is waiting before the call of "PushButton" function which is the main function of the application. And you can check high level source line along with ‘Disassembly windows which show the each instruction of current IP. Now you can try to step over, step into, resume.

Figure 5 Debugger stop the processor at "main"

Here, we executed the "step into" then see the high level source line of "PushButton" entry function and debugger open "PushButton.c" to pointing the next executable function. See the below Figure 6.

Figure 6 Example of Step into from main

Run the example on D1000

In the long run, we can resume the processor to execute in free run mode then you can see the booting log from D1000 CRB and there are modified logs when D1000 receives RTC interrupt. See the below Figure 7.

Figure 7 Log output from D1000 CRB

Hardware Reference

The CRB V2 in tegrates Intel® Quark™ D1000 Microcontroller, accelerometer, SPI Flash memory, Bluetooth® LE Radio, Serial - to - WiFi module, USB to Serial and JTAG converter, and power supply and battery charging circuit. A short description of the programmable components is given below.

Intel® Quark™ D1000 Microcontroller

The controller includes 24 GPIO pins, many of which have multiple functions (see D1000 pin connections table below). CRB v2 connects all these pins to the Arduino - like (but not fully Arduino compatible) headers. It should be noted that several pins are also connected to the on board peripherals, and in some cases cannot be used as GPIOs. Such pins are noted in the description of the peripherals below including D1000 pin names, Arduino pin names, and CRB v 2 pin names. Note that SPI interface to communicate to all onboard peripherals using pins MST_M2SC (SPI clock, Ard uino - D13, CRB v2 – XPB5), MST_M2SD (SPI MOSI, Arduino – D11, CRB v2 – XPB3), MST_S2MD (SPI MISO , Arduino – D12, CRB v2 – XPB4).

Other Hardware Components

The CRB v2 includes several other components that are not programmable from D1000 side. This includes:

  • FTDI FT2232H dual USB - to - Serial and JTAG converter IC. It is used to provide UART/console access to D1000 and to program and debug D1000 using JTAG interface. LEDs D6 (yellow) and D7 (green) are connected to FTDI FT2232H and blink then it sends or receives the data.
  • Linear Technologies LTC4414, Texas Instruments BQ24080, and Maxim Integrated MAX8869 are used for power supply and battery charging circuit. LEDs D10 and D11 are connected to BQ24080 and show battery charge status.

Intel® Quark™ D1000 pins connections on CRB v2

Pin Pin Name Pin Function Comment
D1000 CRB V2 Arduino Function 0 Function 1 Function 2 Function 3
1 AI9/GPIO9 XPC6   AI[9] GPIO[9] SLV_M2SD AI[9] BT/ REQN
2 AI10/GPIO10 XPC7   AI[10] GPIO[10] SLV_S2MD AI[10]
3 AI11/GPIO11 XPB7   AI[11] GPIO[11] SLV_M2SS AI[11]
4 AI12/GPIO12 XPD1 D1 AI[12] GPIO[12] TXD[1] AI[12] UART1
5 AI13/GPIO13 XPD0 D0 AI[13] GPIO[13] RXD[1] AI[13] UART1
6 AI14/GPIO14 XPD2 D2 AI[14] GPIO[14] RTS[1] AI[14]
7 AI15/GPIO15 XPB6   AI[15] GPIO[15] CTS[1] AI[15] WiFi/ DATARDY
8 AI16/GPIO16 XPB5 D13 AI[16] GPIO[16] MST_M2SC AI[16] SPI
9 AI17/GPIO17 XPB3 D11 AI[17] GPIO[17] MST_M2SD AI[17] SPI
10 AI18/GPIO18 XPB4 D12 AI[18] GPIO[18] MST_S2MD AI[18] SPI
11 GPIO19 XPD3 D3 - GPIO[19] TDO -  
12 GPIO20 XPD4 D4 TXD[0] GPIO[20] TRST_N -  
13 AR        
14 GPIO21 XPD5 D5 RXD[0] GPIO[21] TCK -  
15 GPIO22 XPD6 D6 RTS[0] GPIO[22] TMS -  
16 GPIO23 XPD7 D7 CTS[0] GPIO[23] TDI -  
17 DVDD        
18 SEC        
19 XTALI0        
20 XTALO0        
21 TAP_SEL        
22 XTALI1        
23 XTALO1        
24 RST_N        
25 GNDSENSE        
26 LX        
27 PVDD        
28 VSENSE        
29 VREN        
30 IO_VDD        
31 AI0/GPIO0 XPB2 D10 AI[0] GPIO[0] MST_M2SS[0] AI[0] WiFi/ SSN
32 AI1/GPIO1 XPB0 D8 AI[1]   GPIO[1] MST_M2SS[1] AI[1]
33 AI2/GPIO2 XPB1 D9 AI[2] GPIO[2] MST_M2SS[2] AI[2] Accelerometer
34 AI3/GPIO3 XPC0 A0 AI[3] GPIO[3] MST_M2SS[3] AI[3] SPI Flash
35 AI4/GPIO4 XPC1 A1 AI[4]   GPIO[4] - AI[4]
36 AI5/GPIO5 XPC2 A3 AI[5] GPIO[5] MST_S2M_SS AI[5] BT/ RDYN
37 AI6/GPIO6 XPC5 A5 AI[6] GPIO[6] SCL AI[6]  
38 AI7/GPIO7 XPC4 A4 AI[7] GPIO[7] SDA AI[7]  
39 AI8/GPIO8 XPC3 A3 AI[8] GPIO[8] SLV_M2SC AI[8]  
40 AVDD        
PAD VSS        

Intel® Quark™ D1000 CRB v2 Layout

Reference

  • Intel® System Studio for Microcontrollers Installation Guide Release Notes : Intel® System Studio for microcontrollers D1000 firmware
  • Intel® Quark™ D1000 Microcontroller User Guide:
    http://www.intel.com/content/dam/www/public/us/en/documents/guides/quark - d1000 - user - guide.pdf
  • Intel® Quark™ D1000 Microcontroller Datasheet:
    http://www.intel.com/content/dam/www/public/us/en/documents/datasheets/quark - d1000 - datasheet.pdf

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Intel Corporation
United States United States
You may know us for our processors. But we do so much more. Intel invents at the boundaries of technology to make amazing experiences possible for business and society, and for every person on Earth.

Harnessing the capability of the cloud, the ubiquity of the Internet of Things, the latest advances in memory and programmable solutions, and the promise of always-on 5G connectivity, Intel is disrupting industries and solving global challenges. Leading on policy, diversity, inclusion, education and sustainability, we create value for our stockholders, customers and society.
Group type: Organisation

44 members


You may also be interested in...

Comments and Discussions

 
-- There are no messages in this forum --
Permalink | Advertise | Privacy | Terms of Use | Mobile
Web03 | 2.8.171020.1 | Last Updated 16 Dec 2015
Article Copyright 2015 by Intel Corporation
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid