Autor Tema: PIC18F47Q43 Error SPI  (Leído 1687 veces)

0 Usuarios y 1 Visitante están viendo este tema.

Desconectado ingrafa23

  • PIC10
  • *
  • Mensajes: 1
PIC18F47Q43 Error SPI
« en: 12 de Marzo de 2021, 10:57:44 »
Hello, I have several days in trying to put in operation the module SPI1 and SPI2 of the pic18f47q43 with the MCC. and I don't see a clock in SCLK and SDO on the oscilloscope. I bought another pic, and the same result happens, I don't know what the error is, this is the mcc configuration code

void SPI2_Initialize (void)
{
     // EN enabled; LSBF MSb first; MST bus master; BMODE last byte;
     SPI2CON0 = 0x82;
     // SMP Middle; CKE Active to idle; CKP Idle: Low, Active: High; FST disabled; SSP active high; SDIP active high; SDOP active high;
     SPI2CON1 = 0x40;
     // SSET enabled; TXR required for a transfer; RXR suspended if the RxFIFO is full;
     SPI2CON2 = 0x07;
     // CLKSEL MFINTOSC;
     SPI2CLK = 0x02;
     // BAUD 255;
     SPI2BAUD = 0xFF;
     TRISBbits.TRISB1 = 0;
}


and in the main I send

SPI2_WriteByte (0b10101010);

previously I use
SPI2_Open (); to initialize

Desconectado remi04

  • PIC24F
  • *****
  • Mensajes: 657
Re:PIC18F47Q43 Error SPI
« Respuesta #1 en: 12 de Marzo de 2021, 16:13:34 »
Hallo;

Your have configured SCLK source mode from MFINTOSC block.

Please, read the OSCSTAT.5 (MFOR). bit  ¿Is 1?.

 Otherwise, try to set the OSCEN.5 (MFOR) bit.

  Is possible that this bit is set to 0 and Medium frequency oscillator block is disabled.

  What is your general oscillator settings.  Please, place the fuses setting for more clarity.

 Best regards