Alias.Moniker
Newbie level 2
Guys,
I am trying to use SPI1 of dsPIC33ep128gp506.
here are the pins interfaced
Here is the code for initialisation of SPI engine...
Here is the code for writing data over SPI...
Now, when I try to run the program, I don't see any activity on SCK and MOSI lines.
Even if it would be a problem of OSC setttings, I would have seen some waveform on SCK lines but SCK is continuously HIGH (IDLE).
Please let me know, where I am getting wrong.
I am trying to use SPI1 of dsPIC33ep128gp506.
here are the pins interfaced
Code:
AD-CS1 - PIN E.15 \n
AD-CS0 - PIN A.8 \n
AD-MOSI - PIN A.4 \n
AD-MISO - PIN A.9 \n
AD-SCK - PIN C.3 \n
Here is the code for initialisation of SPI engine...
Code:
SPI1CON1 = 0x0049;
SPI1CON2 = 0x00;
SPI1STAT = 0x000C;
SPI1CON1bits.MSTEN = 1;
SPI1STATbits.SPIEN = 1;
Here is the code for writing data over SPI...
Code:
HAL_SPI_EnableSlave(eSlave); //ChipSelect Low
u8Dummy = SPI1BUF;
SPI1BUF = u8Reg;
while (!SPI1STATbits.SPIRBF);
u8Dummy = SPI1BUF;
SPI1BUF = u8Data;
while (!SPI1STATbits.SPIRBF);
HAL_SPI_DisableSlave(eSlave); //ChipSelect High
Now, when I try to run the program, I don't see any activity on SCK and MOSI lines.
Even if it would be a problem of OSC setttings, I would have seen some waveform on SCK lines but SCK is continuously HIGH (IDLE).
Please let me know, where I am getting wrong.