Hello All,
I'm interfacing a TC77 SPI Thermometer to a 18F4685.
I'm using FC V3 and the issue I'm having is that as soon as I'm adding the SPI Macro, I'm getting problems programming the PIC.
When programming, the PIC is not recognised anymore. I have to Manually Erase (in PPP) the PIC before I can reprogram.
Has anyone had this issue?
I presume it is a clock issue. Attached is the sample.
Thanks
Henk
18F4685 not programming when using SPI
- Jan Lichtenbelt
- Posts: 797
- Joined: Tue Feb 17, 2009 8:35 pm
- Location: Haren GN, the Netherlands
- Has thanked: 128 times
- Been thanked: 264 times
- Contact:
Re: 18F4685 not programming when using SPI
Dear Henk
I tried your program with Flowcode 4. The simulation works correct. I do not have the 18F4685, but loading in a PIC gave an error. I hope Steve or Ben can help you.
I have a remark. Do not divide by 16. The simulation works correct, but in a PIC you can get wrong results. Better is to use rotate right for dividing numbers with are a power of 2. In stead of /16 use >>4.
Good luck
Jan Lichtenbelt
I tried your program with Flowcode 4. The simulation works correct. I do not have the 18F4685, but loading in a PIC gave an error. I hope Steve or Ben can help you.
I have a remark. Do not divide by 16. The simulation works correct, but in a PIC you can get wrong results. Better is to use rotate right for dividing numbers with are a power of 2. In stead of /16 use >>4.
Good luck
Jan Lichtenbelt
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: 18F4685 not programming when using SPI
Hello Henk,
I had a similar problem when using a SPI device on an AVR. Basically if the SPI pins are commoned with the programming pins then the slave SPI device can interfere with the programming signals. To get around this I had to add hardware to disable the CS pin of my SPI slave device if the uC was put into reset.
I had a similar problem when using a SPI device on an AVR. Basically if the SPI pins are commoned with the programming pins then the slave SPI device can interfere with the programming signals. To get around this I had to add hardware to disable the CS pin of my SPI slave device if the uC was put into reset.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
-
- Posts: 45
- Joined: Mon Dec 22, 2008 11:22 pm
- Location: Prospect, NS, Canada
- Has thanked: 7 times
- Been thanked: 2 times
Re: 18F4685 not programming when using SPI
Ben / Jan,
Thanks for the reply.
It is a weird problem; I picked up the project several days ago (Hadn't used the PIC for about three days) and it programmed correctly without any hasstle.
One of my friends also has some issues with this type of PIC when programming it.
Anyway, if it happens again, teh way around it is to just erase it in PPP and then program it.
Thanks for the help!
Henk
Thanks for the reply.
It is a weird problem; I picked up the project several days ago (Hadn't used the PIC for about three days) and it programmed correctly without any hasstle.
One of my friends also has some issues with this type of PIC when programming it.
Anyway, if it happens again, teh way around it is to just erase it in PPP and then program it.
Thanks for the help!
Henk