Hi u all!
I'm facing a problem here, I'm trying to develop a serial flash memory interface here. The memory is M25P128, and I'm using LPC2368.
The thing is..I don't have much experience with SPI/SSP. Well.. I've downloaded some examples but I couldn't establish the communication appropriately. Ideally I should have an oscilloscope to check all this, but..
The following code just try to request from the memory its status register:
int InitSSP() { PCONP = 1<<10; PINSEL0 = 0xA8000; PINMODE0 = 0xA8000;// Here is my first doubt, the pins should be configured with pull-up or not? //INTERRUPT VICVectAddr11 = (unsigned long) SSP_Isr; VICVectCntl11 = 0; VICIntEnable |= 0x800; // 11th bit is the SSP1 FIO2DIR1 = (1<<3); //SS Pin - configured as output SSP1CR1 = 0;//SSP disable SSP1CR0 = 0x07; SSP1CPSR= 10; SSP1IMSC = 3;//Receives int SSP1CR1 = 2; } void SSP_Isr(void) __irq { spiBuf[0] = SSP1DR; VICVectAddr = 0; // reset VIC FIO2PIN1 = 1<<3;//HIGH } int WriteFlash()//Adress, Data, size { FIO2PIN1 = 1<<3; //HIGH FIO2PIN1 = 0<<3; //LOW SSP1DR = 0x05; //Instrução WREN while (!(SSP1SR & SSPSR_BSY)); //FIO2PIN1 = 1<<3; //HIGH - In this test I set the High signal in the interruption method because it should be set after receive the message from the memory }
The problem is, doesn't matter which instruction I send I still receive answers that doesn't make any sense! And should be just a few specific instructions that the memory should answer back.
thanks
One transistor and some R/C is OK with you? Actually if you need full Vcc swing you need to amplify it so may it's not so good idea but it will buffer signals.
The 74F series can oscillate with a crystal but the layout is very critical and if not done right can result in the oscillator not starting up or starting up intermittently. Because of this I prefer to use crystal modules at higher frequency's. You could use 74AC or 74ACT at 3.3V if you can find them. Alternatively you could use a transistor but the layout is very critical and it is hard to get reliable start up.
You building an oscilloscope with 74F + crystal???
I really wanted to thank Per for the help! After a lot of tests it's working now, the problem was with the dummy bytes. Thank you, Per.
Nice :)