PDA

View Full Version : Rắc rối với CYWUSB6935 WirelessUSB LR


minh_luandt
23-03-2009, 04:43 PM
Em đang làm đồ án về con CYWUSB6935 WirelessUSB LR nhưng đang gặp vài vấn đề như sau:
1. Về nguồn VCC ,datasheet nói Vcc là 3,3v nhưng sao khi cắm module nó vào thì áp ko ổn định và thường chỉ đạt 2,2 -2,5v thôi???
2,Không biết có phải do áp như trên hay ko mà khi ghi và đọc các thanh ghi của module bằng SPI thì lúc được lúc ko

----------------------------------------------
void CYWM_WriteReg(unsigned int8 which,unsigned int8 data)
{
output_low(CYWM_nSS);
delay_ms(1);
SPI_write(REG_Write | which);// REG_Write =0x80
delay_ms(1);
SPI_write(data);
delay_ms(1);
output_high(CYWM_nSS);
}
unsigned int8 CYWM_ReadReg(unsigned int8 which)
{
output_low(CYWM_nSS);
delay_ms(1);
SPI_write(which);
delay_ms(1);
spi_write(which);
delay_ms(1);
output_high(CYWM_nSS);
return SSPBUF;
}

int main()
{
unsigned int8 n;
unsigned int8 test;
setup_adc_ports(NO_ANALOGS|VSS_VDD);
setup_adc(ADC_OFF);
setup_spi(SPI_MASTER|SPI_L_TO_H|SPI_CLK_DIV_16);
setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1);
setup_timer_1(T1_DISABLED);
setup_timer_2(T2_DISABLED,0,1);
setup_comparator(NC_NC_NC_NC);// This device COMP currently not supported by the PICWizard
//Setup_Oscillator parameter not selected from Intr Oscillator Config tab

// TODO: USER CODE!!
// Set initial pin states
output_high(CYWM_nPD);
delay_ms(50);
output_high(CYWM_nRESET);
delay_ms(50);
output_high(CYWM_nSS);
delay_ms(50);

for (n=0; n<1; n++)
{

output_high(LED_PIN);
delay_ms(500);
output_low(LED_PIN);
delay_ms(500);
}



// Setup radio
while(1)
{
delay_ms(500);

CYWM_WriteReg( REG_CLOCK_MANUAL, 0x41 );
test=CYWM_ReadReg(REG_CLOCK_MANUAL);
if (test==0x41)
{

output_high(LED_PIN);
delay_ms(50);
output_low(LED_PIN);
delay_ms(50);
}
else
{
output_low(LED_PIN);
delay_ms(50);
output_low(LED_PIN);
delay_ms(50);
}
}
}



Có ai đã làm rồi giúp em với nha