Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Any PIC32 Micro SPI examples that compile?
31-03-2015, 06:59 PM,
#1
Any PIC32 Micro SPI examples that compile?
Sorry everyone,
I should of said that in the first post. None of the demo files in the IDE files with
SPI commands compile. I have tried to work my way past the errors but it gets daunting.
Does anyone have any examples for PIC32 Micro with SPI commands that compile?

Best Regards
59Techs
Reply
31-03-2015, 09:25 PM,
#2
RE: Any PIC32 Micro SPI examples that compile?
Hi

Yes, even SPI do not work under 11 version of the IDE.
I think the problem is due to the restructuration of SPI library.

The errors for PIC32 Micro are
Code:
C:\pinguino-11\p32\include\pinguino\core/spi.c: In function 'SPI_begin':
C:\pinguino-11\p32\include\pinguino\core/spi.c:440:13: error: 'MODE16' undeclared (first use in this function)
             MODE16 = 0;
             ^
C:\pinguino-11\p32\include\pinguino\core/spi.c:440:13: note: each undeclared identifier is reported only once for each function it appears in
C:\pinguino-11\p32\include\pinguino\core/spi.c:441:13: error: 'MODE32' undeclared (first use in this function)
             MODE32 = 0;


Bye Bye, Moreno
Reply
31-03-2015, 09:33 PM, (This post was last modified: 31-03-2015, 09:34 PM by 59Tech.)
#3
RE: Any PIC32 Micro SPI examples that compile?
Hi Moreno

Yes you are right!

I can get around that with #define SPIx 3
but this triggers more errors.

59Techs
Reply
01-04-2015, 08:37 AM,
#4
RE: Any PIC32 Micro SPI examples that compile?
Hi

To compile MCP23S17-SPI_IO_Expander.pde I modified some library files but, I'm pretty sure which the compiled program do not work.

1) SPI.C inside SPI_begin

Code:
#if (SPIx == 1)
    switch (this_role)
    {
        case SPI_MASTER8:
            MODE16 = 0;
            MODE32 = 0;
            MSTEN  = 1; // Master
            break;
        case SPI_MASTER16:
            MODE16 = 1;
            MODE32 = 0;
            MSTEN  = 1; // Master
            break;
        case SPI_MASTER32:
            MODE16 = 0;
            MODE32 = 1;
            MSTEN  = 1; // Master
            break;
        case SPI_SLAVE:
            MSTEN  = 0; // Slave
            break;
    }
#endif

2) iswrapper.c
Code:
#ifndef ISRWRAPPER_C
#define ISRWRAPPER_C

        void SPI1Interrupt(void)
        {
            Nop();    
        }

        void SPI2Interrupt(void)
        {
            Nop();    
        }

3) MCP23S17.c in MCP23S17_init
Code:
switch (Mcp->SPIChannel)
  {
   case 0:
    Mcp->SPILoc.CPOL = FALSE;    // Clock Polarity
    Mcp->SPILoc.CPHA = TRUE;    // Sample position
    Mcp->SPILoc.DelayuS = 0;    // Delay Clock uS
    Mcp->SPILoc.LoSCK = LoSCK;
    Mcp->SPILoc.LoSDO = LoSDO;
    Mcp->SPILoc.LoSDI = LoSDI;
    SPILoc_Init (&Mcp->SPILoc);
    break;
   case 1:
   case 2:
    SPI_begin();
    break;
  }


I think the problem is which PINGUINO IDE support many kind of boards with conflictual behaviours.
One programmer solve problems for a board and destroy the support for other boards.

From my point of view the only solution is to create a P32 branch for each kind of board.


Bye Bye, Moreno
Reply
03-04-2015, 03:20 PM,
#5
RE: Any PIC32 Micro SPI examples that compile?
Hi

Now, with the latest library the MODE16 MODE32 error disappear, remain the problem with SPI_Init but for that I need the hardware.


Bye Bye, Moreno
Reply
07-04-2015, 02:19 PM,
#6
RE: Any PIC32 Micro SPI examples that compile?
I changed some names of libraries and functions and also updated the Pinguino interrupt system management and that's why it didn't work. I fixed most of the bugs (thanks Moreno). However I didn't test all examples but I'm using a SPI TFT LCD without problem at that moment.
It is easier to complain than it is to do, but it is better to do than it is to complain.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)