// remove the below code from VbusHandler(void) function.
//don't understand why need to make 5000ms and reconnect again.
#if 0
Sleep(5000);
if(IsVbusOn())
SetInterruptEvent(SYSINTR_VBUS);
else
SetVbusInterrupt(FALSE);
#endif
Monday, June 2, 2008
TT750 SD card multithread problem
/* Add the retry scheme to solve the SD card multithread problem */
// This bug looks like Freescale SD module or DMA module bug.
/*---------------------------------------------------------------------------*/
// Read multiple block from MMC card.
BOOL MMCSD_ReadMultipleBlock(TMMCSD_CardInformationStructure *pCIS, DWORD dwAddress, void *pBuffer, DWORD dwLength)
{
TMMCSD_Reg *pMMCSD;
int ii;
//hf++ 20060503
volatile int dwTimeout=0;
BYTE * pbtDataBuffer = (BYTE*)pBuffer;
int retry=0;
int blRetValue = 0;
//hf-- 20060503
RETAILMSG(MMCSD_DEBUG_MSG, (TEXT("MMCSD_ReadMultipleBlock+, Address:0x%x, Size:0x%x\r\n"), dwAddress, dwLength));
RETAILMSG(MMCSD_DEBUG_MSG, (TEXT("Size:0x%x\r\n"), dwLength));
for (retry = 0; retry<3;retry++)
{
if (retry !=0)
RETAILMSG(1, (TEXT("MMCSD_ReadMultipleBlock retry=0x%x\r\n"), retry));
if (blRetValue!=0)
{
RETAILMSG(1, (TEXT("MMCSD_ReadMultipleBlock retry reason=0x%x\r\n"), blRetValue));
}
blRetValue = 0;
pMMCSD = gpMMCSD;
pbtDataBuffer = (BYTE*)pBuffer;
#if 0
// Activate card.
if (pCIS->CardType == MMCSD_CardMMC) {
if (!MMCSD_MMC_SelectCard(pMMCSD, pCIS->dwRCA)) {
return FALSE;
}
}
else if (pCIS->CardType == MMCSD_CardSD) {
if (!MMCSD_SD_SelectCard(pMMCSD, pCIS->dwRCA)) {
return FALSE;
}
}
else {
return FALSE;
}
#endif
//hf++ 20060503 add timeout
// Make sure card is ready to transfer
dwTimeout = 0;
while ((!MMCSD_IsReady(pMMCSD, pCIS))&&(dwTimeout Sleep(0);
dwTimeout++;
}
if (dwTimeout>=MMC_SD_TIMEOUT)
{
RETAILMSG(MMCSD_ERROR_MSG, (TEXT("MMCSD_ReadMultipleBlock: IsReady Timeout1\r\n")));
blRetValue = 1;
continue;
}
//hf-- 20060503
// Set hardware transfer dwLength register.
MMCSD_SetTransferLength(pMMCSD, MMCSD_DATA_BLOCK_LENGTH);
// Set block dwLength for transaction.
if (!MMCSD_SendCMD16(pMMCSD, MMCSD_DATA_BLOCK_LENGTH)) {
RETAILMSG(MMCSD_ERROR_MSG, (TEXT("MMCSD_ReadMultipleBlock: MMCSD_SendCMD16 Failed!\r\n")));
blRetValue = 2;
continue;
}
//hf++ 20060503 add timeout
// Make sure card is ready to transfer
dwTimeout = 0;
while ((!MMCSD_IsReady(pMMCSD, pCIS))&&(dwTimeout Sleep(0);
dwTimeout++;
}
if (dwTimeout>=MMC_SD_TIMEOUT)
{
RETAILMSG(MMCSD_ERROR_MSG, (TEXT("MMCSD_ReadMultipleBlock: IsReady Timeout2\r\n")));
blRetValue = 3;
continue;
}
//hf-- 20060503
if (pCIS->CardType == MMCSD_CardSD) {
MMCSD_SD_SetBusWidth(pMMCSD, pCIS->dwRCA, MMCSD_BusWidth4Bit);
}
else {
MMCSD_MMC_SetBusWidth(pMMCSD);
}
MMCSD_SetBlockNumber(pMMCSD, dwLength/MMCSD_DATA_BLOCK_LENGTH, MMCSD_DatModeDataReceiveStart);
// Send read multiple block command.
if (!MMCSD_SendCMD18(pMMCSD, dwAddress)) {
RETAILMSG(MMCSD_ERROR_MSG, (TEXT("MMCSD_ReadMultipleBlock: MMCSD_SendCMD18 Failed!\r\n")));
blRetValue = 4;
continue;
}
//MMCSD_SetClock(pMMCSD, MMCSD_ClockStart);
//pMMCSD->STR_STP_CLK = 0x06;
// Copy data from card.
for (ii=dwLength/MMCSD_DATA_BLOCK_LENGTH; ii>0; ii--) {
if (!MMCSD_ReceiveSingleBlock(pMMCSD, (BYTE*)pbtDataBuffer, MMCSD_DATA_BLOCK_LENGTH)) {
RETAILMSG(MMCSD_ERROR_MSG, (TEXT("MMCSD_ReadMultipleBlock: MMCSD_ReceiveSingleBlock Failed!\r\n")));
blRetValue = 5;
continue;
}
pbtDataBuffer = (BYTE*)((DWORD)pbtDataBuffer + MMCSD_DATA_BLOCK_LENGTH);
}
// Send stop transmission command.
if (!MMCSD_SendCMD12(pMMCSD)) {
RETAILMSG(MMCSD_ERROR_MSG, (TEXT("MMCSD_ReadMultipleBlock: MMCSD_SendCMD12 Failed!\r\n")));
blRetValue = 6;
continue;
}
// Wait for transaction to complete.
// while (!MMCSD_IsDataTransferDone(pMMCSD)) {
// Sleep(0);
// }
// MMCSD_SetClock(pMMCSD, MMCSD_ClockStop);
#if 0
// Deactivate card.
MMCSD_DeselectCard(pMMCSD);
#endif
if (blRetValue == 0)
break;
//RETAILMSG(MMCSD_DEBUG_MSG, (TEXT("MMCSD_ReadMultipleBlock-\r\n")));
}
if ((retry!=0)&&(retry!=3))
RETAILMSG(MMCSD_ERROR_MSG, (TEXT("MMCSD_ReadMultipleBlock: recover by retry=%x\r\n"), retry));
if (retry == 3)
{
RETAILMSG(MMCSD_ERROR_MSG, (TEXT("MMCSD_ReadMultipleBlock: can't recover\r\n")));
return FALSE;
}
return TRUE;
}
// This bug looks like Freescale SD module or DMA module bug.
/*---------------------------------------------------------------------------*/
// Read multiple block from MMC card.
BOOL MMCSD_ReadMultipleBlock(TMMCSD_CardInformationStructure *pCIS, DWORD dwAddress, void *pBuffer, DWORD dwLength)
{
TMMCSD_Reg *pMMCSD;
int ii;
//hf++ 20060503
volatile int dwTimeout=0;
BYTE * pbtDataBuffer = (BYTE*)pBuffer;
int retry=0;
int blRetValue = 0;
//hf-- 20060503
RETAILMSG(MMCSD_DEBUG_MSG, (TEXT("MMCSD_ReadMultipleBlock+, Address:0x%x, Size:0x%x\r\n"), dwAddress, dwLength));
RETAILMSG(MMCSD_DEBUG_MSG, (TEXT("Size:0x%x\r\n"), dwLength));
for (retry = 0; retry<3;retry++)
{
if (retry !=0)
RETAILMSG(1, (TEXT("MMCSD_ReadMultipleBlock retry=0x%x\r\n"), retry));
if (blRetValue!=0)
{
RETAILMSG(1, (TEXT("MMCSD_ReadMultipleBlock retry reason=0x%x\r\n"), blRetValue));
}
blRetValue = 0;
pMMCSD = gpMMCSD;
pbtDataBuffer = (BYTE*)pBuffer;
#if 0
// Activate card.
if (pCIS->CardType == MMCSD_CardMMC) {
if (!MMCSD_MMC_SelectCard(pMMCSD, pCIS->dwRCA)) {
return FALSE;
}
}
else if (pCIS->CardType == MMCSD_CardSD) {
if (!MMCSD_SD_SelectCard(pMMCSD, pCIS->dwRCA)) {
return FALSE;
}
}
else {
return FALSE;
}
#endif
//hf++ 20060503 add timeout
// Make sure card is ready to transfer
dwTimeout = 0;
while ((!MMCSD_IsReady(pMMCSD, pCIS))&&(dwTimeout
dwTimeout++;
}
if (dwTimeout>=MMC_SD_TIMEOUT)
{
RETAILMSG(MMCSD_ERROR_MSG, (TEXT("MMCSD_ReadMultipleBlock: IsReady Timeout1\r\n")));
blRetValue = 1;
continue;
}
//hf-- 20060503
// Set hardware transfer dwLength register.
MMCSD_SetTransferLength(pMMCSD, MMCSD_DATA_BLOCK_LENGTH);
// Set block dwLength for transaction.
if (!MMCSD_SendCMD16(pMMCSD, MMCSD_DATA_BLOCK_LENGTH)) {
RETAILMSG(MMCSD_ERROR_MSG, (TEXT("MMCSD_ReadMultipleBlock: MMCSD_SendCMD16 Failed!\r\n")));
blRetValue = 2;
continue;
}
//hf++ 20060503 add timeout
// Make sure card is ready to transfer
dwTimeout = 0;
while ((!MMCSD_IsReady(pMMCSD, pCIS))&&(dwTimeout
dwTimeout++;
}
if (dwTimeout>=MMC_SD_TIMEOUT)
{
RETAILMSG(MMCSD_ERROR_MSG, (TEXT("MMCSD_ReadMultipleBlock: IsReady Timeout2\r\n")));
blRetValue = 3;
continue;
}
//hf-- 20060503
if (pCIS->CardType == MMCSD_CardSD) {
MMCSD_SD_SetBusWidth(pMMCSD, pCIS->dwRCA, MMCSD_BusWidth4Bit);
}
else {
MMCSD_MMC_SetBusWidth(pMMCSD);
}
MMCSD_SetBlockNumber(pMMCSD, dwLength/MMCSD_DATA_BLOCK_LENGTH, MMCSD_DatModeDataReceiveStart);
// Send read multiple block command.
if (!MMCSD_SendCMD18(pMMCSD, dwAddress)) {
RETAILMSG(MMCSD_ERROR_MSG, (TEXT("MMCSD_ReadMultipleBlock: MMCSD_SendCMD18 Failed!\r\n")));
blRetValue = 4;
continue;
}
//MMCSD_SetClock(pMMCSD, MMCSD_ClockStart);
//pMMCSD->STR_STP_CLK = 0x06;
// Copy data from card.
for (ii=dwLength/MMCSD_DATA_BLOCK_LENGTH; ii>0; ii--) {
if (!MMCSD_ReceiveSingleBlock(pMMCSD, (BYTE*)pbtDataBuffer, MMCSD_DATA_BLOCK_LENGTH)) {
RETAILMSG(MMCSD_ERROR_MSG, (TEXT("MMCSD_ReadMultipleBlock: MMCSD_ReceiveSingleBlock Failed!\r\n")));
blRetValue = 5;
continue;
}
pbtDataBuffer = (BYTE*)((DWORD)pbtDataBuffer + MMCSD_DATA_BLOCK_LENGTH);
}
// Send stop transmission command.
if (!MMCSD_SendCMD12(pMMCSD)) {
RETAILMSG(MMCSD_ERROR_MSG, (TEXT("MMCSD_ReadMultipleBlock: MMCSD_SendCMD12 Failed!\r\n")));
blRetValue = 6;
continue;
}
// Wait for transaction to complete.
// while (!MMCSD_IsDataTransferDone(pMMCSD)) {
// Sleep(0);
// }
// MMCSD_SetClock(pMMCSD, MMCSD_ClockStop);
#if 0
// Deactivate card.
MMCSD_DeselectCard(pMMCSD);
#endif
if (blRetValue == 0)
break;
//RETAILMSG(MMCSD_DEBUG_MSG, (TEXT("MMCSD_ReadMultipleBlock-\r\n")));
}
if ((retry!=0)&&(retry!=3))
RETAILMSG(MMCSD_ERROR_MSG, (TEXT("MMCSD_ReadMultipleBlock: recover by retry=%x\r\n"), retry));
if (retry == 3)
{
RETAILMSG(MMCSD_ERROR_MSG, (TEXT("MMCSD_ReadMultipleBlock: can't recover\r\n")));
return FALSE;
}
return TRUE;
}
SD card multi-thread problem
The guy have the similar problem. The bug doesn't solve when Do as he did.
http://www.tech-archive.net/Archive/WindowsCE/microsoft.public.windowsce.platbuilder/2007-07/msg00470.html
http://www.tech-archive.net/Archive/WindowsCE/microsoft.public.windowsce.platbuilder/2007-07/msg00470.html
TT750 battery calibration
Main Battery
4.2V 986
4.10V 960
4.05V 948
4.00V 937
3.95V 924
3.90V 912
3.85V 903
3.80V 887
3.75V 876
3.70V 864
3.67V 857
3.647V 851
3.62V 844
3.6V 839
3.5V 814
4.2V 986
4.10V 960
4.05V 948
4.00V 937
3.95V 924
3.90V 912
3.85V 903
3.80V 887
3.75V 876
3.70V 864
3.67V 857
3.647V 851
3.62V 844
3.6V 839
3.5V 814
The LCD backlight become consistent on PV1 and DV2
Backlight setting for DV2
feedback resistor is 7.5ohm
Level feedback voltage PMW value
0 19mV 0x1e
1 30mV 0x1d
2 41mV 0x1c
3 53mV 0x1b
4 64.6mV 0x1a
5 88mV 0x18
6 110mV 0x16
7 133mV 0x14
8 154mV 0x12
for PV1
The feedback resistor is 15ohm
0 37.9mV 0x2a
1 61.8mV 0x24
2 78.1mV 0x22
3 103mV 0x1F
4 127mV 0x1C
5 178mV 0x16
6 219mV 0x11
7 267mV 0x0B
8 290mV 0x07
feedback resistor is 7.5ohm
Level feedback voltage PMW value
0 19mV 0x1e
1 30mV 0x1d
2 41mV 0x1c
3 53mV 0x1b
4 64.6mV 0x1a
5 88mV 0x18
6 110mV 0x16
7 133mV 0x14
8 154mV 0x12
for PV1
The feedback resistor is 15ohm
0 37.9mV 0x2a
1 61.8mV 0x24
2 78.1mV 0x22
3 103mV 0x1F
4 127mV 0x1C
5 178mV 0x16
6 219mV 0x11
7 267mV 0x0B
8 290mV 0x07
Re-calibrate the battery ADC with the battery capacity.
For PV1 and DV2 main battery
4.2v 891 99%
4.10v 870 97%
4.05v 859 92%
4.00v 848 86%
3.95v 838 82%
3.90v 827 76%
3.85v 817 68%
3.80v 806 59%
3.75v 795 47%
3.70v 785 31%
3.67v 778 21%
3.647v 773 15%
3.62v 767 10%
3.60v 763 7% go to sleep
3.55v 753 5%
3.50v 742 4%
Secondary Battery
4.2v 880 100%
4.1v 861 99%
4.05v 851 98%
4.00v 840 96%
3.95v 830 88%
3.90v 819 84%
3.85v 806 79%
3.80v 798 71%
3.75v 786 63%
3.70v 774 54%
3.65v 765 37%
battery low at 781.
4.2v 891 99%
4.10v 870 97%
4.05v 859 92%
4.00v 848 86%
3.95v 838 82%
3.90v 827 76%
3.85v 817 68%
3.80v 806 59%
3.75v 795 47%
3.70v 785 31%
3.67v 778 21%
3.647v 773 15%
3.62v 767 10%
3.60v 763 7% go to sleep
3.55v 753 5%
3.50v 742 4%
Secondary Battery
4.2v 880 100%
4.1v 861 99%
4.05v 851 98%
4.00v 840 96%
3.95v 830 88%
3.90v 819 84%
3.85v 806 79%
3.80v 798 71%
3.75v 786 63%
3.70v 774 54%
3.65v 765 37%
battery low at 781.
The dialer of HyperTty doesn't work in the debug version
Just found that the dialer of HyperTty doesn't work properly in the debug version. Why? Debug port is com1 (driver is mx21serial.dll) and dialer use com3 (driver is com16550.dll).
How to change Dial default location from "work" to "home"
[HKEY_CURRENT_USER\ControlPanel\Dial]
; What is Location ID (value name) for the current location
"CurrentLoc"=dword:1 ;0-work 1-home
; What is Location ID (value name) for the current location
"CurrentLoc"=dword:1 ;0-work 1-home
Subscribe to:
Posts (Atom)