Tuesday 3 July 2012

Program NOR Flash using Jtag Connector

To program nor flash of Mini TQ2440 follow simple steps depicted below.  connect serial port and j-tag connector to device and run program that came with Device CD named H-Tag.


Now as shown Device is not detected yet. if this is the case then we might need to change setup like in snapshot depicted below.



Now if Device is connected properly and power is rightly supplied it should be recognized as in snap shot given below:


Now Click on Flash Program button which is highlighted in picture given above this will lead you to select nor script file brows option to choose file then you will choose nor files that came with you Device. In my case this file named TQ2440_nor_eon.hfc
How to select file when clicked of Flash button is depicted in pics given below:













Now your Device is ready.

Thursday 30 June 2011

How to Disable Windows CE .NET from Stealing COM1

Disable Debug Messages on COM Port:

In order to disable WinCE Debug Messages on COM Port just modify this file in the BSP From installation Folder Src\Inc\bsp_cfg.h and Set BSP_UARTn to BSP_nouse_UART then you will use com1 as normal one. Now Create Image by Compiling it again using Sysgen. if you are unaware of how to create new WinCE image then go to my post for how to create Image.

Monday 11 April 2011

Download Image in WinCE Device/ Install Image on SBC or TQ2440

Pre Reqs:
Connect SBC TQ2440 which you could buy from www.mtsonweb.com. by using Serial port and USB port.
Install USBDownloadDriver provided with the Device and Run DNW.exe to Install Image.

Install:
Now Open HyperTerminal using (Start->All Programs->Accessories->Communications->HyperTerminal)
Give a Name to Connection:
Select Com Port

Select Baud Rate 115200 like
Now Press OK and Main Window Will Appear, Now Power ON Device and press Space Bar immediately Boot loader will be selected as given below.
Now Press 9 for "Format Boot Media for BinFS" then after completion Press B for "Mark Bad Block at Reserved Block", then Press U and Screen will show USB Connected remember to install USB Driver Before this, here are the snaps how it works.



Now Go to DNW.exe and Goto Transmit and Select image file to download.




Now you have Downloaded the Image to WinCE Device for More Queries feel free to ask by Leaving Comments.

Tuesday 29 March 2011

How to Upload File in WinCE

Introduction

This Application is designed for WinCE. It includes Web, Desktop both side applications. Its client WinCE Application Code Function Upload(string Path, String FileName) takes File Path and File Name as Input and Post it to webpage, and on the other hand website application on its page FileUpload.ashx read posted file and Save it to Defined Folder which is Later Available to download.
Here is a code to upload file:

Client Side:

#region Upload
public bool Upload(string FilePath, string FileName)
{
string Url = "HTTP://test.mtsonweb.com/fileupload.ashx"; //  Change it to your page name
string BytesConfirmedReceived = "";
int BytesSent = 0;
bool Ret = false;
ASCIIEncoding encoding = new ASCIIEncoding();
try
{

if (File.Exists(FilePath +"\\"+ FileName) == false) { return true; }

//FileInfo oInfo = new FileInfo(FilePath + "\\" + FileName);
//BytesSent = Convert.ToInt32(oInfo.Length.ToString());

Url += "?myfile=" + FileName.Trim();

FileStream fr = new FileStream(FilePath + "\\" + FileName, FileMode.Open);

BinaryReader r = new BinaryReader(fr);
byte[] FileContents = r.ReadBytes((int)fr.Length);
BytesSent = FileContents.Length;

r.Close();
fr.Close();

WebRequest oRequest = WebRequest.Create(Url);

oRequest.Method = "POST";

oRequest.Timeout = 15000;

oRequest.ContentLength = FileContents.Length;

Stream oStream = oRequest.GetRequestStream();

BinaryWriter oWriter = new BinaryWriter(oStream);

oWriter.Write(FileContents);

oWriter.Close();

oStream.Close();

WebResponse oResponse = oRequest.GetResponse();
BytesConfirmedReceived = new StreamReader(oResponse.GetResponseStream(),
Encoding.Default).ReadToEnd();

oResponse.Close();

if (BytesSent.ToString() == BytesConfirmedReceived.Trim())
{
Ret = true;
}

}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
return Ret;

}
#endregion

Website Page:

<%@ WebHandler Language="C#" Class="FileUpload" %>
using System;
using System.Xml;
using System.Data;
using System.Web;
using System.IO;
using System.Text;
using System.Runtime.InteropServices;
using System.Drawing;

public class FileUpload : IHttpHandler
{
public void ProcessRequest(HttpContext oContext)
{

int BytesSent = 0;
//string LocalPath = @"C:\Inetpub\wwwroot\";

string MyFile = "";

MyFile);

try
{

MyFile = oContext.Request["myfile"].ToString().Trim();
MyFile = HttpContext.Current.Server.MapPath("~/Demo/Files/" +

ASCIIEncoding encoding = new ASCIIEncoding();

BytesSent = oContext.Request.TotalBytes;

Class1 obj = Class1.GetInstance();

obj.FileName = MyFile;
obj.FileLength = BytesSent;

byte[] InComingBinaryArray =
oContext.Request.BinaryRead(oContext.Request.TotalBytes);
obj.Data = InComingBinaryArray;

if (File.Exists(MyFile) == true)
{
File.Delete(MyFile);
}

FileStream fs = new FileStream(MyFile, FileMode.CreateNew);
BinaryWriter w = new BinaryWriter(fs);
w.Write(InComingBinaryArray);
w.Close();
fs.Close();

FileInfo oInfo = new FileInfo(MyFile);
long a = (long)BytesSent;

oContext.Response.Write(oInfo.Length.ToString());

}
catch (Exception err) { oContext.Response.Write(err.Message); }

}

public bool IsReusable { get { return true; } }

}

Thursday 24 March 2011

Configure Runtime Version


You can force an application built with an older version of the .NET Compact Framework version to run on a device installed with a newer version of the .NET Compact Framework, such as version 2.0 or 3.5. The feature is identical to the mechanism for forcing applications in the full .NET Framework to run on the newer version. The .NET Compact Framework provides two settings:
  • <supportedRuntime>
  • Specifies the runtime version of the .NET Compact Framework for the application to use.
  • <compatibilityversion>
Specifies the compatibility mode for a specified version. Note that you should only use this setting for diagnostic purposes.
 
You can also programmatically use Environment to determine the version.

To determine the currently installed version
  • On the Pocket PC, use File Explorer to navigate to the \Windows directory and tap the cgacutil file.
  • A message box appears with the version of the .NET Compact Framework installed on the device.
To set an application to run on version 3.5
  • Determine the version number of the .NET Compact Framework running on the device. The version number used in this configuration does not include the last period and trailing zeros in the number. For example, "Version 3.5.7121.0" as returned from cgacutil should be "v3.5.7121" in the configuration.
  • Create a text file with a file name that has ".exe.config" appended to the name of the application, for example, "appname.exe.config".
  • Add the XML node as shown here to the file with the correct version number for version 3.5:
    • <configuration>
    •   <startup>
    •     <supportedRuntime version="v3.5.7121"/>
    •   </startup>
    • </configuration>
  • Save the file to the folder that contains the application.
  • Run the application.

To set an application to run on version 3.5 with compatibility for version 2
  • Create a text file with a file name that has ".exe.config" appended to the name of the application, for example, "appname.exe.config".
  • Add the XML node as shown here to the file with the correct version number for version 3.5:
    • <configuration>
    •   <runtime>
    •     <compatibilityversion major="2" minor="0"/>
    •   </runtime>  <startup>
    •     <supportedRuntime version="v3.5.7000"/>
    •    </startup>
    • </configuration>
  • Save the file to the folder that contains the application.
  • Run the application.

.NET Compact Framework (Windows Embedded Compact 7)

The Microsoft .NET Compact Framework is a hardware-independent program execution environment for applications that are designed for resource-constrained computing devices.
Windows Embedded Compact 7 includes the .NET Compact Framework 3.5, Windows Embedded CE 6.0 includes the .NET Compact Framework version 3.5 and version 2.0, SP1; and Windows CE 5.0 includes the .NET Compact Framework 1.0, SP2.
The majority of applications that are based on earlier versions of the .NET Compact Framework are usually compatible with .NET Compact Framework 3.5.
The .NET Compact Framework 3.5 includes support for Windows Communication Foundation (WCF). WCF provides an application model and class library that you can use to build service-oriented applications that interoperate with both client and service applications that run on remote devices or servers. For more information, see Windows Communication Foundation (WCF) Development and the .NET Compact Framework on MSDN.
To force an application that was built with an earlier version of the .NET Compact Framework to run on a device that has .NET Compact Framework 3.5, see: Configure Runtime Version

Board Support Package (BSP) (Windows Embedded Compact 7)

A board support package (BSP) is a set of software components that allows the OS to run on a specific hardware platform. The BSP consists of the following components:
  • The kernel independent transport layer (KITL), which is the communication link between your development computer and the Windows Embedded Compact powered device.
  • The OEM adaptation layer (OAL), which is the interface between the kernel and the hardware.
  • The boot loader, which initializes the hardware, loads the OS run-time image into memory, and jumps to the OS startup routine.
  • Device drivers
  • Configuration files, which control how the OS run-time image is built
Creating a BSP is one of the first steps in developing a Windows Embedded Compact powered device.
Microsoft Platform Builder for Windows Embedded Compact 7 provides board support packages (BSPs) for software development boards or hardware platforms that are readily available for purchase.
These BSPs cover the full range of supported microprocessors in Windows Embedded Compact 7 and enable you to quickly evaluate various OS features on your hardware platform and reduce your time to market.

Third-party BSPs are also available for different versions of Windows Embedded Compact.

Sample code for each of the supported BSPs is available at:
 
%_WINCEROOT%\Platform\<Hardware Platform Name>.
Source code for the OEM adaptation layer (OAL) common library is available at %_WINCEROOT%\Platform\Common.
OAL programming elements specific to CPU architecture are available at %_WINCEROOT%\Platform\Common\Src\<CPU Architecture>.
Programming elements that are not hardware-specific are available at %_WINCEROOT%\Platform\Common\Src\Common.