Hello.
i'm doing a usb to jtag interface with FT2232h usb serial converter and Microsoft Visual C++ 2010 Express but i have some doubts about making the code, i just want to enable the four pins for the jtag communication (TCK,TDI,TDO,TMS) and not send data by de GPIO's. i'm using the FTCJTAG.dll. the code doesn't have errors (i think so) but at the moment i check the signals with an oscilloscope, these don't appear.
This is what I have done until now:
1.i created a new console aplication for win32.
2.I copied the FTCJTAG.dll library to c:\windows\system32
3.i added the FTCJTAG.lib to c:\programfiles\microsoftsdks\windows\v7.0a\lib. back to visual c++ in menu project->project properties->linker->input->Additional Dependencies i typed FTCJTAG.lib.
4.the program, wrong program by the way ja. i compiled with visual c++ 2010 express.
my system setup is:
Windows 7 ultimate
Visual Studio 2010 Express
//Comunicación JTAG utilizando el chip FT2232H con comandos JATG.
#include "stdafx.h"
#include <Windows.h>
#include <conio.h> //Archivo de cabecera para comando getch();
#include <stdio.h> //Archivo de cabecera para comando getchar (); leer caracter
#include "FTCJTAG.h"
int main()
{
FTC_STATUS ftStatus;
FTC_HANDLE ftHandle;
byte lpTimerValue;
BOOL bLoopBackState=false;
BOOL bInstructionTestData=true;
char DeviceNameBufferSize[100];
char ChannelBufferSize[5];
DWORD dwNumHiSpeedDevices; // Número de dispositivos
DWORD dwDeviceNameIndex=0;
DWORD dwLocationID = 0;
DWORD dwHiSpeedDeviceType = 0;
DWORD dwClockDivisor=0;
DWORD dwClockFrequencyHz = 0;
int c,i,n;
//---------------------------------------------
//| Verificar existencia de dispositivos FTDI |
//---------------------------------------------
buscar:
system("cls");
printf("-Buscado dispositivos FTDI...\n");
ftStatus = JTAG_GetNumHiSpeedDevices(&dwNumHiSpeedDevices);
//Error obteniendo el número de dispositivos
if (ftStatus != FTC_SUCCESS)
{
printf("\n-Error obteniendo el numero de dispositivos.\n");
}
//Dispositivos no conectados
if (dwNumHiSpeedDevices<1)
{
printf("\n-No hay dispositivos FTDI conectados al sistema.\n-Conecte un dispositivo FTDI.");
Sleep(1000);
goto buscar;
}
//Dispositivos conectados
printf("\n-El numero de dispositivos FTDI conectados es %d.\n La cuenta incluye los canales del chip.\n",dwNumHiSpeedDevices);
printf("\nIntroduzca R para reiniciar la busqueda o C para continuar: ");
do
{
c=getchar();
if (c == 'R')
{goto buscar;}
if (c== 'C')
{goto identificar;}
}while(c != 'R');
/*Identificación del dispositivo*/
identificar:
system("cls");
printf("\n-Identificando dispositivos...\n");
if (dwNumHiSpeedDevices>0)
{
for(i=0;i<dwNumHiSpeedDevices;i++)
{
ftStatus = JTAG_GetHiSpeedDeviceNameLocIDChannel(dwDeviceNameIndex, DeviceNameBufferSize, 100, &dwLocationID, ChannelBufferSize, 5, &dwHiSpeedDeviceType); //Obtención de datos del dispositivo
if(ftStatus==FTC_SUCCESS)
dwDeviceNameIndex = dwDeviceNameIndex + 1;
{
if(dwHiSpeedDeviceType==1) printf("\n-Dispositivo FT2232H.\n");
if(dwHiSpeedDeviceType==2) printf("\n-Dispositivo FT4232H.\n");
printf("-Canal = %s\n-LocID = 0x%x\n",ChannelBufferSize,dwLocationID);
/*Apertura del dispositivo*/
ftStatus = JTAG_OpenHiSpeedDevice(DeviceNameBufferSize, dwLocationID, ChannelBufferSize, &ftHandle); //Apertura del dispositivo
if(ftStatus==FTC_SUCCESS)
{
printf("-Canal %s abierto.\n handle 0x%x\n",ChannelBufferSize,ftHandle);
}
/*Inicialización del dispositivo*/
printf("\nInicializacion del dispositivo...\n");
if(ftStatus==FTC_SUCCESS)
ftStatus = JTAG_TurnOffAdaptiveClockingHiSpeedDevice(ftHandle); //Deshabilita la adaptación de reloj (Necesaria en procesadores ARM)
ftStatus = JTAG_TurnOffDivideByFiveClockingHiSpeedDevice(ftHandle); //Deshabilitación de reloj dividido por 5
if(ftStatus==FTC_SUCCESS)
{
printf("\n-Reloj dividido por 5 deshabilitado.\n-Adaptacion de reloj deshabilitada.");
}
if(ftStatus==FTC_SUCCESS)
ftStatus = JTAG_GetDeviceLatencyTimer(ftHandle,&lpTimerValue); //Lee el temporizador de latencya del dispositivo
//if(ftStatus==FTC_SUCCESS)
//{
//printf("\n-Tiempo de latencia leido = %dms.\n",lpTimerValue);
//}
if(ftStatus==FTC_SUCCESS)
ftStatus = JTAG_SetDeviceLatencyTimer(ftHandle,2); //Establece el temporizador de latencia del dispositivo
if(ftStatus==FTC_SUCCESS)
{
printf("\n-El tiempo de latencia establecido es 2ms.");
}
if(ftStatus==FTC_SUCCESS)
ftStatus = JTAG_GetHiSpeedDeviceClock(dwClockDivisor,&dwClockFrequencyHz); //Obtener la frecuencia de registro de los datos
if(ftStatus==FTC_SUCCESS)
ftStatus = JTAG_SetClock(ftHandle,dwClockDivisor,&dwClockFrequencyHz);
if(ftStatus==FTC_SUCCESS) printf("\n-La frecuencia de trabajo es %dHz.",dwClockFrequencyHz); //Estableces la frecuencia de registro de datos
if(ftStatus==FTC_SUCCESS)
ftStatus = JTAG_SetLoopback(ftHandle,bLoopBackState); //Deshabilitar LoopBack
if(ftStatus==FTC_SUCCESS) printf("\n-LoopBack deshabilitado.\n");
}
}
}
/*Salir del programa*/
printf("\n\n-Presione E para cerrar el dispositivo: ");
do
{
c=getchar();
if (c == 'E') goto cerrar;
}
while(c!='E');
cerrar:
ftStatus = JTAG_Close(ftHandle); //Cerrar dispositivo
if(ftStatus==FTC_SUCCESS) printf("\n-Dispositivo cerrado correctamente.");
printf("\n\n-Presiones ENTER para salir.");
getch ();
}
problems with FT2232H usb serial convertesr
Are you developing tools to extend the LiveCode environment? This is the place to talk about the nuts and bolts of extending our nuts and bolts. If you want to use a LiveCode or third party Environment extension, visit the Using Evironment Extensions forum.
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
-
- Posts: 1
- Joined: Wed Feb 01, 2012 11:08 pm
Return to “Making IDE Plugins”
Jump to
- LiveCode Community
- ↳ Announcements
- ↳ Developer Services Marketplace
- ↳ User Groups and Events
- ↳ SoCal LiveCode Group
- ↳ Greater Toronto Area LiveCode Users Group
- ↳ Off-Topic
- ↳ Made With LiveCode
- Getting Started With LiveCode
- ↳ Getting Started with LiveCode - Complete Beginners
- ↳ Getting Started with LiveCode - Experienced Developers
- ↳ Converting to LiveCode
- ↳ App Building Course
- ↳ Simple Messages
- ↳ Calculator
- ↳ Notes
- ↳ Clock
- ↳ Web Browser
- ↳ Weather
- ↳ Compass
- ↳ Photos
- Developing With LiveCode
- ↳ Talking LiveCode
- ↳ Databases
- ↳ Games
- ↳ Internet
- ↳ Multimedia
- ↳ Software Engineering
- ↳ Version Control
- ↳ Feature Proposals
- ↳ Bug Triage
- ↳ Legacy Project: MetaCard
- Extending LiveCode
- ↳ Using Plugins for Customizing the LiveCode IDE
- ↳ Using Externals
- ↳ Making IDE Plugins
- ↳ Building Externals
- ↳ LiveCode Builder
- Platform Specific
- ↳ Windows
- ↳ Mac OS
- ↳ Linux
- ↳ iOS Deployment
- ↳ Android Deployment
- ↳ CGIs and the Server
- ↳ HTML5
- ↳ Raspberry Pi
- Academic Endeavors
- ↳ Teaching with LiveCode
- ↳ Research and Post Secondary
- ↳ LiveCode University
- ↳ Educational Outreach
- Livecode Open Source Archived Forum- closed to posting
- ↳ Engine Contributors
- ↳ IDE Contributors
- ↳ Documentation and Tutorials
- ↳ Brainstorms
- ↳ Community Projects
- ↳ rIDE
- Third Party Extension Support
- ↳ Marketing Your Products
- ↳ Animation Engine
- ↳ chartsEngine
- ↳ MobGUI
- ↳ lcTaskList
- ↳ SQL Yoga
- ↳ MergEXT
- ↳ Data Grid Helper
- ↳ idea2app and Coding School
- ↳ Admin Archive
- LiveCode Hosting
- Forum Archives
- ↳ Archived: Third Party Extension Support
- ↳ rTree
- ↳ rGrid
- ↳ Data Tree
- ↳ Archived: LiveCode Open Source
- ↳ LiveCode Global Jam
- ↳ Testing Support
- ↳ Archived: Academic Endeavors
- ↳ September Academy
- ↳ Summer School 2013
- ↳ Archived: Project Specific
- ↳ Business and Kiosks
- ↳ Digital Art and Portfolios