update
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,10 +1,14 @@
|
|||||||
{
|
{
|
||||||
"Version": 1,
|
"Version": 1,
|
||||||
"WorkspaceRootPath": "C:\\Work\\3_Src\\0_Tool\\PMIC_Tool\\",
|
"WorkspaceRootPath": "C:\\Work\\Src\\0_Tool\\PMIC_Tool\\",
|
||||||
"Documents": [
|
"Documents": [
|
||||||
{
|
{
|
||||||
"AbsoluteMoniker": "D:0:0:{C5541CC8-518C-4E1A-A6A8-CB37F56E9558}|PMIC_Cmd_Tool\\PMIC_Cmd_Tool.vcxproj|C:\\Work\\3_Src\\0_Tool\\PMIC_Tool\\PMIC_Cmd_Tool\\PMIC_Cmd_Tool.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}",
|
"AbsoluteMoniker": "D:0:0:{C5541CC8-518C-4E1A-A6A8-CB37F56E9558}|PMIC_Cmd_Tool\\PMIC_Cmd_Tool.vcxproj|C:\\WORK\\SRC\\0_TOOL\\PMIC_TOOL\\PMIC_CMD_TOOL\\EXTERNAL\\FT4222\\INCLUDE\\FTD2XX.H||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}",
|
||||||
"RelativeMoniker": "D:0:0:{C5541CC8-518C-4E1A-A6A8-CB37F56E9558}|PMIC_Cmd_Tool\\PMIC_Cmd_Tool.vcxproj|solutionrelative:PMIC_Cmd_Tool\\PMIC_Cmd_Tool.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}"
|
"RelativeMoniker": "D:0:0:{C5541CC8-518C-4E1A-A6A8-CB37F56E9558}|PMIC_Cmd_Tool\\PMIC_Cmd_Tool.vcxproj|solutionrelative:PMIC_CMD_TOOL\\EXTERNAL\\FT4222\\INCLUDE\\FTD2XX.H||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"AbsoluteMoniker": "D:0:0:{C5541CC8-518C-4E1A-A6A8-CB37F56E9558}|PMIC_Cmd_Tool\\PMIC_Cmd_Tool.vcxproj|C:\\Work\\Src\\0_Tool\\PMIC_Tool\\PMIC_Cmd_Tool\\src\\PMIC_Cmd_Tool.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}",
|
||||||
|
"RelativeMoniker": "D:0:0:{C5541CC8-518C-4E1A-A6A8-CB37F56E9558}|PMIC_Cmd_Tool\\PMIC_Cmd_Tool.vcxproj|solutionrelative:PMIC_Cmd_Tool\\src\\PMIC_Cmd_Tool.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"DocumentGroupContainers": [
|
"DocumentGroupContainers": [
|
||||||
@@ -19,19 +23,28 @@
|
|||||||
{
|
{
|
||||||
"$type": "Document",
|
"$type": "Document",
|
||||||
"DocumentIndex": 0,
|
"DocumentIndex": 0,
|
||||||
"Title": "PMIC_Cmd_Tool.cpp",
|
"Title": "ftd2xx.h",
|
||||||
"DocumentMoniker": "C:\\Work\\3_Src\\0_Tool\\PMIC_Tool\\PMIC_Cmd_Tool\\PMIC_Cmd_Tool.cpp",
|
"DocumentMoniker": "C:\\Work\\Src\\0_Tool\\PMIC_Tool\\PMIC_Cmd_Tool\\external\\FT4222\\include\\ftd2xx.h",
|
||||||
"RelativeDocumentMoniker": "PMIC_Cmd_Tool\\PMIC_Cmd_Tool.cpp",
|
"RelativeDocumentMoniker": "PMIC_Cmd_Tool\\external\\FT4222\\include\\ftd2xx.h",
|
||||||
"ToolTip": "C:\\Work\\3_Src\\0_Tool\\PMIC_Tool\\PMIC_Cmd_Tool\\PMIC_Cmd_Tool.cpp",
|
"ToolTip": "C:\\Work\\Src\\0_Tool\\PMIC_Tool\\PMIC_Cmd_Tool\\external\\FT4222\\include\\ftd2xx.h",
|
||||||
"RelativeToolTip": "PMIC_Cmd_Tool\\PMIC_Cmd_Tool.cpp",
|
"RelativeToolTip": "PMIC_Cmd_Tool\\external\\FT4222\\include\\ftd2xx.h",
|
||||||
"ViewState": "AgIAAK4AAAAAAAAAAAAAALQAAAAKAAAAAAAAAA==",
|
"ViewState": "AgIAACoAAAAAAAAAAAAAAHQBAAAdAAAAAAAAAA==",
|
||||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000677|",
|
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000680|",
|
||||||
"WhenOpened": "2025-12-19T05:26:16.228Z",
|
"WhenOpened": "2026-01-16T02:48:28.794Z",
|
||||||
"EditorCaption": ""
|
"EditorCaption": ""
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"$type": "Bookmark",
|
"$type": "Document",
|
||||||
"Name": "ST:0:0:{cce594b6-0c39-4442-ba28-10c64ac7e89f}"
|
"DocumentIndex": 1,
|
||||||
|
"Title": "PMIC_Cmd_Tool.cpp",
|
||||||
|
"DocumentMoniker": "C:\\Work\\Src\\0_Tool\\PMIC_Tool\\PMIC_Cmd_Tool\\src\\PMIC_Cmd_Tool.cpp",
|
||||||
|
"RelativeDocumentMoniker": "PMIC_Cmd_Tool\\src\\PMIC_Cmd_Tool.cpp",
|
||||||
|
"ToolTip": "C:\\Work\\Src\\0_Tool\\PMIC_Tool\\PMIC_Cmd_Tool\\src\\PMIC_Cmd_Tool.cpp",
|
||||||
|
"RelativeToolTip": "PMIC_Cmd_Tool\\src\\PMIC_Cmd_Tool.cpp",
|
||||||
|
"ViewState": "AgIAAAwAAAAAAAAAAAAhwCEAAAAGAAAAAAAAAA==",
|
||||||
|
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000677|",
|
||||||
|
"WhenOpened": "2026-01-16T02:11:14.724Z",
|
||||||
|
"EditorCaption": ""
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -116,21 +116,26 @@
|
|||||||
<SDLCheck>true</SDLCheck>
|
<SDLCheck>true</SDLCheck>
|
||||||
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<ConformanceMode>true</ConformanceMode>
|
<ConformanceMode>true</ConformanceMode>
|
||||||
<AdditionalIncludeDirectories>.\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>$(ProjectDir)include;$(ProjectDir)external\FT4222\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<SubSystem>Console</SubSystem>
|
<SubSystem>Console</SubSystem>
|
||||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
<AdditionalLibraryDirectories>.\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
<AdditionalLibraryDirectories>$(ProjectDir)external\FT4222\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||||
<AdditionalDependencies>$(CoreLibraryDependencies);%(AdditionalDependencies);ftd2xx.lib;LibFT4222-64.lib</AdditionalDependencies>
|
<AdditionalDependencies>$(CoreLibraryDependencies);%(AdditionalDependencies);LibFT4222-64.lib;ftd2xx.lib</AdditionalDependencies>
|
||||||
|
<DelayLoadDLLs>LibFT4222-64.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
|
||||||
</Link>
|
</Link>
|
||||||
<PostBuildEvent>
|
<PostBuildEvent>
|
||||||
<Command>copy "$(ProjectDir)dll\ftd2xx.dll" "$(OutDir)"
|
<Command>if not exist "$(OutDir)dll" mkdir "$(OutDir)dll"
|
||||||
copy "$(ProjectDir)dll\LibFT4222-64.dll" "$(OutDir)"</Command>
|
xcopy /y "$(ProjectDir)external\FT4222\dll\*.dll" "$(OutDir)dll\"
|
||||||
|
</Command>
|
||||||
</PostBuildEvent>
|
</PostBuildEvent>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="PMIC_Cmd_Tool.cpp" />
|
<ClInclude Include="include\PMIC_Reg_Map.h" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClCompile Include="src\PMIC_Cmd_Tool.cpp" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||||
<ImportGroup Label="ExtensionTargets">
|
<ImportGroup Label="ExtensionTargets">
|
||||||
|
|||||||
@@ -15,7 +15,12 @@
|
|||||||
</Filter>
|
</Filter>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="PMIC_Cmd_Tool.cpp">
|
<ClInclude Include="include\PMIC_Reg_Map.h">
|
||||||
|
<Filter>헤더 파일</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClCompile Include="src\PMIC_Cmd_Tool.cpp">
|
||||||
<Filter>소스 파일</Filter>
|
<Filter>소스 파일</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|||||||
@@ -20,6 +20,7 @@
|
|||||||
#include "PMIC_Reg_Map.h"
|
#include "PMIC_Reg_Map.h"
|
||||||
|
|
||||||
// Function Prototypes
|
// Function Prototypes
|
||||||
|
FT_HANDLE InitializeFT4222();
|
||||||
void currentTime(char* buf, size_t len);
|
void currentTime(char* buf, size_t len);
|
||||||
void logPacket(const char* dir, uint8_t* data, int size, int hasCrc);
|
void logPacket(const char* dir, uint8_t* data, int size, int hasCrc);
|
||||||
uint8_t calcCRC8(uint8_t addrWithRw, uint8_t* data, int len);
|
uint8_t calcCRC8(uint8_t addrWithRw, uint8_t* data, int len);
|
||||||
@@ -29,16 +30,8 @@ void PMIC_I2C_Read(FT_HANDLE ftHandle, uint8_t slaveAddr, uint8_t regAddr);
|
|||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
// 1. DLL 탐색 경로에 하위 폴더 'dll' 추가
|
FT4222_STATUS ft4222Status;
|
||||||
// 이 설정은 이 함수 호출 이후에 로드되는 모든 DLL에 적용됩니다.
|
//char addrInput[16];
|
||||||
if (!SetDllDirectoryA("./dll")) {
|
|
||||||
printf("DLL 경로 설정 실패 (에러 코드: %lu)\n", GetLastError());
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
printf("PMIC I2C Packet Logger with FT4222\n \n");
|
|
||||||
|
|
||||||
char addrInput[16];
|
|
||||||
unsigned int tempAddr = 0;
|
unsigned int tempAddr = 0;
|
||||||
uint8_t I2C_SLAVE_ADDR = 0;
|
uint8_t I2C_SLAVE_ADDR = 0;
|
||||||
unsigned long log_counter = 0;
|
unsigned long log_counter = 0;
|
||||||
@@ -49,6 +42,20 @@ int main()
|
|||||||
|
|
||||||
//printf("현재 시간: %s\n", timeStr);
|
//printf("현재 시간: %s\n", timeStr);
|
||||||
|
|
||||||
|
// 1. DLL 탐색 경로에 하위 폴더 'dll' 추가
|
||||||
|
// 이 설정은 이 함수 호출 이후에 로드되는 모든 DLL에 적용됩니다.
|
||||||
|
if (!SetDllDirectoryA("./dll")) {
|
||||||
|
printf("DLL 경로 설정 실패 (에러 코드: %lu)\n", GetLastError());
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 2. FT4222 장치 연결 및 초기화
|
||||||
|
FT_HANDLE ftHandle = InitializeFT4222();
|
||||||
|
if (!ftHandle) {
|
||||||
|
return -1; // 초기화 실패 시 프로그램 종료
|
||||||
|
}
|
||||||
|
|
||||||
|
printf("PMIC I2C Packet Logger with FT4222\n \n");
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
printf("I2C Address\n Regulation Register is 0x54\n Protection Register is 0x55\n \nEnter 7-bit I2C Slave Address (hex): ");
|
printf("I2C Address\n Regulation Register is 0x54\n Protection Register is 0x55\n \nEnter 7-bit I2C Slave Address (hex): ");
|
||||||
@@ -73,6 +80,7 @@ int main()
|
|||||||
|
|
||||||
printf("Read Regulation 0x54, Page 0x02, Address 0x23 : 0x66 이면 OK\n ");
|
printf("Read Regulation 0x54, Page 0x02, Address 0x23 : 0x66 이면 OK\n ");
|
||||||
|
|
||||||
|
#if 0
|
||||||
FT_HANDLE ftHandle = NULL;
|
FT_HANDLE ftHandle = NULL;
|
||||||
FT_STATUS ftStatus;
|
FT_STATUS ftStatus;
|
||||||
DWORD numDevs = 0;
|
DWORD numDevs = 0;
|
||||||
@@ -95,6 +103,7 @@ int main()
|
|||||||
FT_Close(ftHandle);
|
FT_Close(ftHandle);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Fault register data: Protection Register, Address 0x010 ~0x014, 0x019 ~0x021
|
/* Fault register data: Protection Register, Address 0x010 ~0x014, 0x019 ~0x021
|
||||||
0x010 - FUSA_STATUS_1
|
0x010 - FUSA_STATUS_1
|
||||||
@@ -156,7 +165,7 @@ int main()
|
|||||||
//Sleep(30);
|
//Sleep(30);
|
||||||
|
|
||||||
printf("실행하려면 Enter 키를 누르세요...\n");
|
printf("실행하려면 Enter 키를 누르세요...\n");
|
||||||
getchar();
|
(void)getchar();
|
||||||
|
|
||||||
//Regulation Register
|
//Regulation Register
|
||||||
// Page00
|
// Page00
|
||||||
@@ -398,6 +407,31 @@ int main()
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FT_HANDLE InitializeFT4222() {
|
||||||
|
FT_HANDLE handle = NULL;
|
||||||
|
DWORD numDevs = 0;
|
||||||
|
|
||||||
|
// 연결된 장치 리스트 확인
|
||||||
|
if (FT_CreateDeviceInfoList(&numDevs) != FT_OK || numDevs == 0) {
|
||||||
|
printf("오류: 연결된 FT4222 장치를 찾을 수 없습니다.\n");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 0번 인덱스 장치 열기
|
||||||
|
if (FT_Open(0, &handle) != FT_OK) {
|
||||||
|
printf("오류: 장치를 열 수 없습니다.\n");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
// I2C 마스터 모드 초기화 (400kHz 주파수 설정)
|
||||||
|
if (FT4222_I2CMaster_Init(handle, 400) != FT4222_OK) {
|
||||||
|
printf("오류: I2C 마스터 초기화 실패.\n");
|
||||||
|
FT_Close(handle);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
return handle;
|
||||||
|
}
|
||||||
|
|
||||||
// 현재 시간을 "HH:MM:SS" 형식으로 buf에 저장
|
// 현재 시간을 "HH:MM:SS" 형식으로 buf에 저장
|
||||||
void currentTime(char* buf, size_t len)
|
void currentTime(char* buf, size_t len)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user