Would you like to react to this message? Create an account in a few clicks or log in to continue.

You are not connected. Please login or register

P16F88x - MSSP Does not work

2 posters

Go down  Message [Page 1 of 1]

1P16F88x - MSSP Does not work Empty P16F88x - MSSP Does not work Tue Oct 03, 2023 11:55 pm

Nacho9319



I made a program where I use the I/O expander via I2C, however it didn't do anything at all. I checked the "p16F88x_perif.xml" file and realized that the synchronous serial port (MSSP) was not programmed, so I added a fraction of code based on the "p16F87x_perif.xml" file where the I2C does work. After this, the I2C protocol worked, however I could not get the SPI protocol to work. I attach the fraction of code that I added to the XML file.
I hope you can help me.
Thanks in advance.
Greetings

Code:

  <msspunit name="MSSP" type="00" configregsA="SSPCON" >
                        
    <twi name="TWI"  configregsA="SSPCON" configregsB="SSPCON2"
                     dataregs="SSPBUF"
                     addressreg="SSPADD"
                     statusreg="SSPSTAT"
                     interrupt="SSP"
                     prescalers=""
                     pins="PORTC4,PORTC3" /><!-- "SDA,SCL" -->
    
    <spi name="SPI"  configregsA="SSPCON"
                     dataregs="SSPBUF"
                     statusreg="SSPSTAT"
                     interrupt="SSP"
                     prescalers="4,16,64,0"
                     pins="PORTC5,PORTC4,PORTC3,PORTA5"/><!-- "SDI,SDO,SCK,SS" -->

  </msspunit>

2P16F88x - MSSP Does not work Empty Re: P16F88x - MSSP Does not work Wed Oct 04, 2023 12:31 am

arcachofo

arcachofo

Hi, thanks for reporting.
I was not aware that MSSP was not added to 16F88x.

Your addition is exactly what was missing, but there are some other details: missing interrupt and some bit name error in SSPSTAT.

Attached the corrected files p16F88x_int.xml and p16F88x_regs.xml.

Also solved at Rev 1962.
Attachments
P16F88x - MSSP Does not work Attachmentp16F88x.zip
You don't have permission to download attachments.
(3 Kb) Downloaded 5 times

3P16F88x - MSSP Does not work Empty Re: P16F88x - MSSP Does not work Wed Oct 04, 2023 2:43 am

Nacho9319



I downloaded the files and placed them in the corresponding folder, however the SPI protocol still does not work. Furthermore, the I2C protocol stopped working.

4P16F88x - MSSP Does not work Empty Re: P16F88x - MSSP Does not work Wed Oct 04, 2023 12:05 pm

arcachofo

arcachofo

I downloaded the files and placed them in the corresponding folder, however the SPI protocol still does not work. Furthermore, the I2C protocol stopped working.
I2C and SPI are both working for me (examples attached).

Can you share your code to test it?

Also which Simulide version and PIC model are you using?
Attachments
P16F88x - MSSP Does not work Attachment16F886_I2C-Lcd.zip
You don't have permission to download attachments.
(20 Kb) Downloaded 3 times
P16F88x - MSSP Does not work Attachment16F886_SPI.zip
You don't have permission to download attachments.
(16 Kb) Downloaded 3 times

5P16F88x - MSSP Does not work Empty Re: P16F88x - MSSP Does not work Wed Oct 04, 2023 5:09 pm

Nacho9319



Thank you very much for the examples. The I2C works perfectly, but the SPI doesn't.
I would appreciate it if you could also share the file "p16F88x_perif.xml" with me since possibly the files you shared with me previously are not compatible with the modifications I made in the file "p16F88x_perif.xml"
Thank you so much!!

6P16F88x - MSSP Does not work Empty Re: P16F88x - MSSP Does not work Wed Oct 04, 2023 5:13 pm

arcachofo

arcachofo

Here it is.
Attachments
P16F88x - MSSP Does not work Attachmentp16F88x_perif.xml.zip
You don't have permission to download attachments.
(1 Kb) Downloaded 3 times

7P16F88x - MSSP Does not work Empty Re: P16F88x - MSSP Does not work Wed Oct 04, 2023 9:45 pm

Nacho9319



Thanks for your file.
I was doing several tests using your three XML files and I realized that when the PIC is programmed to "write" to the I2C module, it does work properly, on the other hand, when I "read" the I2C module (for example the I2C to parallel ) it does not work. However, with the modifications that I had previously made to the XML files, I can perform the "reading" and "writing" operations in I2C, the bad thing is that the SPI does not work for me, it is not even noticeable that the signal works SCK clock although in the circuit you shared with me the SCK does work. The only difference relevant to MSSP that I noticed in your files compared to mine, was the name of the bits of SSPSTAT register in the file "p16F88x_regs.xml"
This is what I have:
Code:

<register name="PR2"     addr="0x92" bits="" reset="11111111"/>
        <register name="SSPADD"  addr="0x93" />
        <register name="SSPSTAT" addr="0x94"
                  bits="BF,UA,READ_WRITE,I2C_START,I2C_STOP,DATA_ADDRESS,CKE,SMP" />

And this is what you have
Code:

        <register name="PR2"     addr="0x92" bits="" reset="11111111"/>
        <register name="SSPADD"  addr="0x93" />
        <register name="SSPSTAT" addr="0x94"
                  bits="BF,UA,RW,S,P,DA,CKE,SMP" />

I don't know if this affects the operation of the SPI or if it is a matter of my program or if it is a problem as in the case of IOCB interruptions where the problem was the SLEEP mode and not the interruption itself.
I really appreciate your attention!!

8P16F88x - MSSP Does not work Empty Re: P16F88x - MSSP Does not work Wed Oct 04, 2023 10:11 pm

arcachofo

arcachofo

Nacho9318 wrote:I was doing several tests using your three XML files and I realized that when the PIC is programmed to "write" to the I2C module, it does work properly, on the other hand, when I "read" the I2C module (for example the I2C to parallel ) it does not work.
It is working for me for write and read (example attached).

Nacho9318 wrote:However, with the modifications that I had previously made to the XML files, I can perform the "reading" and "writing" operations in I2C
Something is missing here:
You only reported the additons to p16F88x_perif.xml file.
With only that changes and without the interrupt added to p16F88x_int.xml, I2C can't work.
Indeed the program will crash if you try to use an interrupt that doesn't exist.

Nacho9318 wrote:the bad thing is that the SPI does not work for me, it is not even noticeable that the signal works SCK clock although in the circuit you shared with me the SCK does work.
arcachofo wrote:Can you share your code to test it?

Also which Simulide version and PIC model are you using?
Attachments
P16F88x - MSSP Does not work Attachment16F886_I2C-RAM.zip
You don't have permission to download attachments.
(18 Kb) Downloaded 3 times

9P16F88x - MSSP Does not work Empty Re: P16F88x - MSSP Does not work Thu Oct 05, 2023 4:42 am

Nacho9319



Of course, Thank you!

In the I2C example, the LB1 LEDs should light up when the SW2 switches are manipulated and at the same time, an 8-bit binary counter should be visible on the LB2 LEDs.

In the SPI example, the LB2 LEDs should light when the SW3 switches are operated and the LB3 LEDs should light when the SW2 switches are operated.

Finally, your file "p16F88x_int.xml" and mine contain exactly the same interrupts (code attached).

Code:

<parts>
    <interrupts enable="GIE">
        <interrupt name="RESET"                                  priority="1" vector="0x0000"/>
        <interrupt name="INT"      enable="INTE"   flag="INTF"   priority="1" vector="0x0004"/>
        <interrupt name="T0_OVF"   enable="T0IE"   flag="T0IF"   priority="1" vector="0x0004"/>
        <interrupt name="PB_INT"   enable="RBIE"   flag="RBIF"   priority="1" vector="0x0004"/>
        <interrupt name="ACOMP1"   enable="C1IE"   flag="C1IF"   priority="1" vector="0x0004"/>
        <interrupt name="ACOMP2"   enable="C2IE"   flag="C2IF"   priority="1" vector="0x0004"/>
        <interrupt name="USART_R"  enable="RCIE"   flag="RCIF"   priority="1" vector="0x0004"/>
        <interrupt name="USART_T"  enable="TXIE"   flag="TXIF"   priority="1" vector="0x0004"/>
        <interrupt name="SSP"      enable="SSPIE"  flag="SSPIF"  priority="1" vector="0x0004"/>
        <interrupt name="CCP1"     enable="CCP1IE" flag="CCP1IF" priority="1" vector="0x0004"/>
        <interrupt name="CCP2"     enable="CCP2IE" flag="CCP2IF" priority="1" vector="0x0004"/>
        <interrupt name="T1_OVF"   enable="TMR1IE" flag="TMR1IF" priority="1" vector="0x0004"/>
        <interrupt name="T2_MATCH" enable="TMR2IE" flag="TMR2IF" priority="1" vector="0x0004"/>
        <interrupt name="EEPR"     enable="EEIE"   flag="EEIF"   priority="1" vector="0x0004"/>
        <interrupt name="ADC"      enable="ADIE"   flag="ADIF"   priority="1" vector="0x0004"/>
    </interrupts>
</parts>

10P16F88x - MSSP Does not work Empty Re: P16F88x - MSSP Does not work Thu Oct 05, 2023 4:49 am

Nacho9319



Here is the files
Attachments
P16F88x - MSSP Does not work AttachmentSPI_I2C.zip
You don't have permission to download attachments.
(22 Kb) Downloaded 3 times

11P16F88x - MSSP Does not work Empty Re: P16F88x - MSSP Does not work Thu Oct 05, 2023 11:24 am

arcachofo

arcachofo

Here is the files
Thank you.

12P16F88x - MSSP Does not work Empty Re: P16F88x - MSSP Does not work Thu Oct 05, 2023 4:01 pm

arcachofo

arcachofo

I2C problem with ACKSTAT when reading solved at Rev 1972.

At least I2C seems to be working, not sure if the program is doing what is supposed to do:

P16F88x - MSSP Does not work I2c10

13P16F88x - MSSP Does not work Empty Re: P16F88x - MSSP Does not work Thu Oct 05, 2023 7:26 pm

Nacho9319



Indeed, according to the image, the circuit does what it should do. Thank you so much.

I can't find the Rev 1972. I downloaded the last stable version (sept 20, 2023) for MacOS but it says R1402 and say the same in Windows version.

14P16F88x - MSSP Does not work Empty Re: P16F88x - MSSP Does not work Fri Oct 06, 2023 12:21 pm

arcachofo

arcachofo

I can't find the Rev 1972. I downloaded the last stable version (sept 20, 2023) for MacOS but it says R1402 and say the same in Windows version.
I will upload executables here soon (probaly today):
https://simulide.forumotion.com/t550-simulide-trunk-tester-builds#2961

Sponsored content



Back to top  Message [Page 1 of 1]

Permissions in this forum:
You cannot reply to topics in this forum