PIC18F1625 : Alternate pin issues & sleep (info)

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 7.

Moderator: Benj

Post Reply
User avatar
faveremario
Posts: 28
Joined: Sat Jun 02, 2012 6:08 pm
Has thanked: 8 times
Been thanked: 13 times
Contact:

PIC18F1625 : Alternate pin issues & sleep (info)

Post by faveremario »

Hi all

I guess this is something for Ben to resolve, all for the 16F1825:

Issue 1: (always reproducible)
The 16F1825 has alternate pins for the SPI hardware-module (see data-sheet). The alternate pin function is unfortunately not available. I tried it for the SPI & RS232 component. Can this be adapted? I know the PIC definitions are written in clear text, but do not have the time to reverse-engineer the meaning of all parameters... Ben does have this knowledge, and I think it will take only a few moments to solve this issue :wink:

Issue 2: (not always reproducible)
When I used the software SPI with MOSI on RA4 (since the alternate pin can not be selected from Channel1), I experimented with other parameters such as measuring the current the chip was drawing with different internal osc clock-settings, and also combined with the sleep-function.
Suddenly, the chip was not sending (MOSI) on RA4 anymore (which I wanted on RA4), but on RA5! Other signals where OK.
The solution : using the Channel 1 SPI, compile, switch back to software & recompile.
I have not been able to pinpoint the correct reason why the mismatch happened nor when it exactly occurred.

Issue 3: (only for info)
the "sleep();" command is replaced with "SLEEP();" in the new FC7-compiler.

Greetz
Attachments
uart.PNG
(21.66 KiB) Downloaded 1524 times
spi.PNG
(20.41 KiB) Downloaded 1524 times
Datasheet 16F1825.PNG
(76.18 KiB) Downloaded 1524 times

User avatar
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: PIC18F1625 : Alternate pin issues & sleep (info)

Post by Benj »

Hello,

Just having a look at this for you now.

I have just tried the UART (RS232) component with the 16F1825 target in v7.3 and the alt pins are correctly showing up for me. Please can you check you are using v7.3 and if this doesn't help then maybe try using the CAL_UART component rather than the UART component, it's available from the Tools component category.
RS232Alt.jpg
RS232Alt.jpg (9.71 KiB) Viewed 2996 times
Looks like the SPI components don't currently support the Alt pin setting as there are so few chips that use it. Here you could maybe change the pin in the FCDX file and then change to the alt pin using a C code icon to set the bit in the alt register.

Code: Select all

APFCON0 = APFCON0 | 0x40;
It's not ideal I know but it's potentially a very big change to roll out to the CAL C code, the CAL component and then all other SPI related components.

Not sure about issue 2, sounds strange. Maybe check the silicone errata document for the chip on the microchip website to see if they have published any known problems with the chip. Also could potentially be an intermittent short on your circuit?

User avatar
faveremario
Posts: 28
Joined: Sat Jun 02, 2012 6:08 pm
Has thanked: 8 times
Been thanked: 13 times
Contact:

Re: PIC18F1625 : Alternate pin issues & sleep (info)

Post by faveremario »

Hi Ben

Thanks for the reply. My FC7 was 7.2.1.4 so upgrading did the trick.

For Issue 2 : The hint could be plausible, but I had a logic analyser attached to almost all pins and the expected pin was doing nothing at all (as it was primarily monitored).
Changing the FCDX is a good option, the target-list is updating automatically when a new file is added, so the original FCDX is not affected and '16F1825 Alternate' PIC is showing up.

Keep up the good work!

Post Reply