Hallo und guten Tag,
ich habe an meinen PIC16F1825 einen RFM70 angeschlossen. Das Ganze
befindet sich mitlerweile auf eienr SMD-Platine mit ordentlichen Layout.
Jedoch habe ich jetzt ein Problem: Wenn ich als Test die Chip-ID
auslesen will, kommen nur vier Nullen an. Das Lustige ist jedoch, wenn
ich mit einem Frequenzmesser eines Multimeters an den MOSI gehe, kommt
plätzlich die korekte Chip-ID. Weiße jemand woran das liegt? Die geringe
Kapazität des Frequenzmessers scheint die MOSI-Spannungskurven etwas zu
verschieben, sodass die korrekte Anweisung an den RFM kommt.
INIT:
1 | void vInitSsp(void) //Buffer: SSP1BUF
|
2 | {
|
3 | TRISCbits.TRISC2 = 0;
|
4 | TRISCbits.TRISC1 = 1;
|
5 | TRISCbits.TRISC0 = 0;
|
6 | TRISAbits.TRISA2 = 1;
|
7 | TRISCbits.TRISC3 = 0;
|
8 | TRISAbits.TRISA4 = 0;
|
9 |
|
10 | ANSELCbits.ANSC1 = 0;
|
11 | ANSELAbits.ANSA2 = 0;
|
12 |
|
13 | INTCONbits.INTE = 1; //Enable Interrupt pin
|
14 | // PIE1bits.SSP1IE = 0; //Enables the MSSP interrupt to determine when the transmission/reception has completed.
|
15 |
|
16 | OPTION_REGbits.INTEDG = 0; //Interrupt on falling edge of RB0/INT pin (RA2)
|
17 |
|
18 | CSN = 1; //Chip select active
|
19 |
|
20 | SSPCON1bits.SSPM = 0b0001; // SPI Master mode, clock = FOSC/4
|
21 | SSP1CON1bits.WCOL = 0; //Clear write collusion detection bit
|
22 |
|
23 | SSPSTATbits.CKE = 1; //Wellenform Typ 3, read and write at rising edge
|
24 | SSPSTATbits.SMP = 1; //Input data sampled at middle of data output time
|
25 | SSPCON1bits.CKP = 0; //Wellenform Typ 3
|
26 |
|
27 | BF = 0; //Clear buffer full flag, Receive complete
|
28 | // PIR1bits.SSP1IF = 0; //Clear synchronous Serial Port (MSSP) Interrupt Flag bit
|
29 |
|
30 | APFCON0bits.SDOSEL = 0; //SDO on pin RC2, not RA4
|
31 | APFCON0bits.SSSEL = 0; //SS on pin RC3, not RA3
|
32 |
|
33 | SSPCON1bits.SSPEN = 1; //Enable SSP-Transmitting
|
34 | }
|
Danke im Voraus!