Discussion in "ARM Development" started by    Vito    May 14, 2009.
Thu May 14 2009, 07:33 pm
#11
so this means... data is not coming from slave side..

are you sure that it's being stuck there only? i mean how to make sure that this is the problem.

also are you giving some kind of delay? after reset or during reset?
Thu May 14 2009, 08:18 pm
#12
i'm doing delay at the beginning of the vUSBTask, and after some SPI Write... The source i gzipped and attached is how i modified the source of maxim: i didn't use its initialization -> init_PLL() and init_IO(), because i have that functions already working specifically for the microcontroller.
My most fear is that the code of the SPI isn't working, and i am not talking to the pin chip select of the usb that is the P1.20
Could you control that part in my source please ?
thank you
Thu May 14 2009, 08:47 pm
#13
damn... i have to go now... i hope we can talk tomorrow...
thank you
bye

Vito
Fri May 15 2009, 01:12 pm
#14
Hi,
i'd like to know if you think the SPI part is ok.
i know is a bad thing to ask.. but i don't have the necessary experience to know for sure about it.
thank you..
Fri May 15 2009, 01:43 pm
#15
i have to go through your code, but today some problem with server.. i seems to be busy with it..
Fri May 15 2009, 02:57 pm
#16
oh... np... don't worry about it... you just did a lot anyway
just for the update...
i discovered that the command that should issue the reset to the host by the SPI... well it doesn't work...
so .... i guess.. that my thought about the SPI is more and more toward truth
but i need to investigate more to be sure about that...
c u soon
Fri May 15 2009, 10:48 pm
#17
What is the state of reset pin of MAX3421? You won't get OSCOKIRQ if device is being held in reset and that what I think is happening. To check if SPI is functioning, try to read REVISION register. You should get 0x12 if your MAX3421 is relatively fresh.
Mon May 18 2009, 05:23 pm
#18
can you paste the terminal o/p of the following part of code:

printf("First 8 bytes of Device Descriptor ");
	HR = CTL_Read(Get_Descriptor_Device);  	// Get device descriptor into XfrData[]

	if(print_err(HR)) return;	// print_error() does nothing if HRSL=0, returns the 4-bit HRSL.

	printf("(%u/%u NAKS)\n\r",IN_nak_count,HS_nak_count);		// Show NAK count for data stage/status stage
	maxPacketSize = XfrData[7];
	for (ix=0; ix<last_transfer_size;ix++)
		printf("%02X ",(BYTE*)XfrData[ix]);
	printf("\n\r");
	printf("EP0 maxPacketSize is %02u bytes\n\r",maxPacketSize);

	// Issue another USB bus reset
	printf("Issuing USB bus reset\n\r");

coz after this your program gets halted right?
Tue May 19 2009, 12:56 pm
#19
hi all..
i was back just today on this damn usb... well
Rickey it''s not that part that locks, i can't get to run the program until the part you're showing.... the reset locks just in its function call, that is firstly called in the main function:
void Reset_Host(void)
{
Hwreg(rUSBCTL,bmCHIPRES);  // chip reset This stops the oscillator
Hwreg(rUSBCTL,0x00);       // remove the reset
while(!(Hrreg(rUSBIRQ) & bmOSCOKIRQ)) ;  // hang until the PLL stabilizes
}



the critical while, then is this:
while(!(Hrreg(rUSBIRQ) & bmOSCOKIRQ)) ;  // hang until the PLL stabilizes


@felis: tnx man, i'll try to issue this command to see if the SPI works, the maxim i have are just fresh, 'coz i got them just two weeks ago.
thanks to all of you for your precious help
Tue May 19 2009, 01:23 pm
#20
Ok Boys..... it is official.... i can't get the SPI working....

this is the source i use:
void  main_func(){

        wait_ms(1000);

	SPIInit();
	init_IO();

	unsigned char revision;
	char stringy[50];
  

	initialize_ARM_Interrupts();


	uart0Puts("setting full duplex etc etc....\n\r");
	Host_SPI_Write(rPINCTL,(bmFDUPSPI| bmHOST | bmPOSINT   )); // MAX3421E: Full duplex mode, INTLEVEL=0, POSINT=1 for pos edge interrupt pin

	uart0Puts("done\n\r");

    uart0Puts("trying to read revision number:\n\r");

    revision = Host_SPI_Read(rRevision);

	sprintf(stringy,"Revision Number: %x\n\r",revision);
	uart0Puts(stringy);

/**** the following function is where it locks..... but now we know that the SPI is not working ****/
    Reset_Host();	// Jan07_2008: Moved Reset_Host after MAX3421 is put in full duplex mode



	uart0Puts("done\n\r");
	Host_SPI_Write(rIOPINS1,0x00);		// seven-segs off
	uart0Puts("done\n\r");
	Host_SPI_Write(rIOPINS2,0x00);		// and Vbus OFF (in case something already plugged in)
	uart0Puts("done\n\r");


	uart0Puts("done\n\r");
	wait_ms(200);  // aspetta = waits


	VBUS_ON;



	while(1)
	{
		detect_device();
		wait_ms(200); 			// Some devices require this
		enumerate_device();
		wait_for_disconnect();
	}

}


that was my main function....
and this is what i get on the serial output trying to read the revision number:

init ARM interrupts.....Finita(done)
setting full duplex etc etc....
done
trying to read revision number:
Revision Number: 0
critical part....(Reset_Host())




and that's all...... now i can't get why the SPI won't work.....

Get Social

Information

Powered by e107 Forum System

Downloads

Comments

AntoniaRoons
Fri Apr 19 2024, 09:59 pm
carpinteyrowrl
Fri Apr 19 2024, 02:51 pm
DonaldJAX
Fri Apr 19 2024, 01:08 pm
Lewisuhakeply
Thu Apr 18 2024, 06:00 pm
Darrellciz
Thu Apr 18 2024, 11:07 am
Charlessber
Thu Apr 18 2024, 09:29 am
BartonSem
Thu Apr 18 2024, 04:56 am
DonaldKnown
Thu Apr 18 2024, 12:24 am