USB using 18f13k50

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 4.
To post in this forum you must have a registered copy of Flowcode 4 or higher. To sign up for this forum topic please use the "Online Resources" link in the Flowcode Help Menu.

Moderator: Benj

Post Reply
lewisrendal
Flowcode V4 User
Posts: 61
Joined: Tue Feb 01, 2011 7:21 pm
Has thanked: 3 times
Been thanked: 1 time
Contact:

USB using 18f13k50

Post by lewisrendal »

Hi ,

To anyone who has used this PIC successfully, I have used the 18f2455 and the 18f4455 family and have successfully used them with HID setup, the PC does not like the settings in the 18f13k50 PIC.

Any Help much appreciated.

Best
James

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: USB using 18f13k50

Post by Benj »

Hi James,

The problem is still to do with the config settings not being quite correct in PPP. I will look into getting this fixed.

The program I sent over to you had the correct config data embedded into it and was running the HID code correctly on hardware.

Sparkoids
Posts: 267
Joined: Mon Sep 14, 2009 10:34 am
Has thanked: 30 times
Been thanked: 19 times
Contact:

Re: USB using 18f13k50

Post by Sparkoids »

Another point when using this device and the other variants of it, is to ensure that the voltage adaptor from Microchip is used in series with the programmer when programming on the pcb via ICD 2/3.

The board is only £20ish and since MPLAB would allow the programming (and wrecking) of the PIC without it, it is obviously vital!

Also be aware that the in circuit programming is slightly different with this range of PIC's that the normal 6 pin header - an extra 2 caps and 1 resistor are required to be fitted. I have modded a Matrix EB006 programmer simply and successfully to accommodate this (without the need to cut any tracks) and if anyone needs a picture of the mod just let me know.

Thanks Ben for your investigation into the problems with this range....

lewisrendal
Flowcode V4 User
Posts: 61
Joined: Tue Feb 01, 2011 7:21 pm
Has thanked: 3 times
Been thanked: 1 time
Contact:

Re: USB using 18f13k50

Post by lewisrendal »

Hi,

Thanks for the info sparkoids.

Ben have you managed to sort this issue so I can get going on the development of this chip ?

Thanks
James

Sparkoids
Posts: 267
Joined: Mon Sep 14, 2009 10:34 am
Has thanked: 30 times
Been thanked: 19 times
Contact:

Re: USB using 18f13k50

Post by Sparkoids »

Hi James,

If you are using MPLAB and an ICD 3 you can manually set the configuration in that program.

After connecting OK you need to set the following manually:

CPUDIV - CPU SYSTEM CLOCK / 2
USBDIV - OSC1/OSC2 / 2
FOSC - HS OSCILLATOR
PLLEN - OSCILLATOR * 4
FCMEN - FAIL SAFE CLOCK DISABLED
IESO - OSCILLATOR SWITCHOVER DISABLED
PWRTEN - PWRT ENABLED
BOREN - RESET ENABLED - HARDWARE ONLY
BORV - VBOR SET TO 3.0V NOMINAL
WDTEN - WDT CONTROLLED BY SWDTEN
WDTPS - 1:32768
HFOFST - DO NOT WAIT FOR OSCILLATOR
MCLRE - MCLR PIN ENABLED
STVREN - STACK FULL / UNDERFLOW RESETS
LVP - SINGLE SUPPLY ICSP DISABLED
BBSIZ - 1KW BOOT BLOCK SIZE
XINST - INSTRUCTION SET / EXTENSION ENABLED

With a 12Mhz crystal that runs ok on a Mac, PC or Linux operating system....

I think there may be some confusion here since we are both named "James" and both doing similar programs it seems.

Ben's a star but tends to be busy - as a guess I would say the upgraded file will be included in the next revision of Flowcode...

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: USB using 18f13k50

Post by Benj »

Hello,

I have checked the 13K50 in the latest PPP release and it now looks to be ok. Attached are the latest PPP files. You should simply be able to copy the files over the files currently existing in the "Flowcode v4/Tools/PPP" directory.
PPP Configs v5.zip
(1.29 MiB) Downloaded 316 times
Let me know how you get on.

lewisrendal
Flowcode V4 User
Posts: 61
Joined: Tue Feb 01, 2011 7:21 pm
Has thanked: 3 times
Been thanked: 1 time
Contact:

Re: USB using 18f13k50

Post by lewisrendal »

Hi Ben,

I have attached my program for your perusal regarding still not working, if you would be so kind and have a quick look and you proberly will see what is wrong knowing you ?

Thanks in advance

James :)
Attachments
flow4_usb_18f13k50_test_v1.1 8 meg temp2.fcf
(14.06 KiB) Downloaded 292 times

Sparkoids
Posts: 267
Joined: Mon Sep 14, 2009 10:34 am
Has thanked: 30 times
Been thanked: 19 times
Contact:

Re: USB using 18f13k50

Post by Sparkoids »

Hi James,

Right mouse click your HID Component and go External Properties.

You need to tell the component that it is a boot device and what type - I think!


James :-}
Attachments
Windows 7 - Desktop.jpg
Windows 7 - Desktop.jpg (96.57 KiB) Viewed 11318 times

lewisrendal
Flowcode V4 User
Posts: 61
Joined: Tue Feb 01, 2011 7:21 pm
Has thanked: 3 times
Been thanked: 1 time
Contact:

Re: USB using 18f13k50

Post by lewisrendal »

Hi james,

Yep tried that and still no joy, the issue I'm getting is this below:
usb issue pic.jpg
usb issue pic.jpg (110.4 KiB) Viewed 11308 times
Cheers
James :)

Sparkoids
Posts: 267
Joined: Mon Sep 14, 2009 10:34 am
Has thanked: 30 times
Been thanked: 19 times
Contact:

Re: USB using 18f13k50

Post by Sparkoids »

Hi James,

What exactly is your USB device?


James :-}

lewisrendal
Flowcode V4 User
Posts: 61
Joined: Tue Feb 01, 2011 7:21 pm
Has thanked: 3 times
Been thanked: 1 time
Contact:

Re: USB using 18f13k50

Post by lewisrendal »

Hi,

My device is a custom descriptor that Ben wrote for me, it originally was for a relay switching unit running through VB2008 from microsoft using the 18f4455 chip, that works no probs, when using the usb converter e.g ft232bl that works fine with any chip supporting a uart on board.

So not new to this, it's been about 2 years since I started the first project that worked and now microchip have bought out this cost effective chip = 18f13k50 which is low cost and more suited to the application I'm trying to do.

I believe the issue lies between the custom descriptor or/and the hardware setup, that's it, really needs matrix to sort out to be honest, there is no 18f13k50 example to be had ?!

Regards
James :(

Sparkoids
Posts: 267
Joined: Mon Sep 14, 2009 10:34 am
Has thanked: 30 times
Been thanked: 19 times
Contact:

Re: USB using 18f13k50

Post by Sparkoids »

Hi James,

I'm just completing a USB keyboard project and I hate this device.

I did the same as you in terms of cost and already we are onto the forth revision of the board!

Can't help on the required descriptor but Ben is a star on these things...

Good luck anyway and if you need someone to build them, prototypes or otherwise just PM me...


James :-}

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: USB using 18f13k50

Post by Benj »

Hello,

I think the problem is with the config settings of the 18F13K50 device in PPP. Here are updated files for PPP. Please can you give them a go by extracting the files from the archive into your "Flowcode v4/Tools/PPP" folder. Then in Flowcode click chip -> Configure and double check all the settings are correct.
PPP Configs v5.zip
(1.29 MiB) Downloaded 219 times
Let me know how you get on.

nmindana
Posts: 82
Joined: Thu Nov 18, 2010 5:00 pm
Has thanked: 52 times
Been thanked: 5 times
Contact:

Re: USB using 18f13k50

Post by nmindana »

Hi Support team,

The attached simple serial USB programme with 18f13k50 doesn't seem to compile. Says RAM -118 ?
I set the config as advised by James (Sparkoids) but no luck. Does this work with EB055, anybody with experience
using both !.

Any help much appriciated.

'Happy New Year'

Thanks in advance

Indana


'count' size:1 bytes
'buffer_size' size:2 bytes
'buffer' size:2 bytes
'bd' size:2 bytes
'store_gie' size:1 bytes
'CompTempVar2281' size:1 bytes
'CompTempVar2282' size:1 bytes
'CompTempVar2283' size:1 bytes
'$ret' size:1 bytes
'str' size:2 bytes
'count' size:1 bytes
'my_lc' size:2 bytes
'CompTempVar2300' size:3 bytes
'$ret' size:1 bytes
'delay_counter' size:2 bytes
'String' size:2 bytes
'MSZ_String' size:1 bytes
'$ret' size:1 bytes
'timeout' size:2 bytes
'CompTempVar2313' size:1 bytes

RAM available:512 bytes, used:630 bytes (123.0%), free:-118 bytes (-23.0%),
Heap size:0 bytes, Heap max single alloc:0 bytes
ROM available:8192 bytes, used:0 bytes (0.0%), free:8192 bytes (100.0%)



failure

Return code = -2

Flowcode was unable to assemble the ASM file due to the following errors:


FINISHED
Attachments
Flowcode usb.fcf
(6 KiB) Downloaded 180 times

lewisrendal
Flowcode V4 User
Posts: 61
Joined: Tue Feb 01, 2011 7:21 pm
Has thanked: 3 times
Been thanked: 1 time
Contact:

Re: USB using 18f13k50

Post by lewisrendal »

Hi,

I believe the 18f14k50 would be a better choice due the limited room for programming using flowcode, the 13k50 seems fairly useless to be honest, but still have the issue with the family not being reconized by the pc ! maybe something to do with the setup ? , When I get a 18f14k50 I will test and if no luck will furnish matrix with one to test for everyone !
:wink:
Regards
James

Sparkoids
Posts: 267
Joined: Mon Sep 14, 2009 10:34 am
Has thanked: 30 times
Been thanked: 19 times
Contact:

Re: USB using 18f13k50

Post by Sparkoids »

Hi James,

I finally got the PIC18F13K50 working OK under Flowcode - (thanks to a concerted effort of help by Ben) but the 18f2455 would be a better choice.

In fact anything would be a better choice than the 13K50 I feel but Flowcode does run properly with this device once setup is sorted and it does operate at very low power on a USB bus at least.

Have you tried Ben's updated definitions files? They don't seem to work on this chips brother - the 14K version but he's even looking into that...

James :-}

nmindana
Posts: 82
Joined: Thu Nov 18, 2010 5:00 pm
Has thanked: 52 times
Been thanked: 5 times
Contact:

Re: USB using 18f13k50

Post by nmindana »

Hi James,

Can you post the config data and fcf that worked for you.
The initialise macro itself consumes >500 Ram memory for the chip !
Wondered how you got it working under flowcode :wink:

regards

Indana

Sparkoids
Posts: 267
Joined: Mon Sep 14, 2009 10:34 am
Has thanked: 30 times
Been thanked: 19 times
Contact:

Re: USB using 18f13k50

Post by Sparkoids »

Hi Indana,

I'll have to post it tomorrow - it's on my computer at work.

If you search in this forum for topics from Ben and this device it's the one he attached to his post...

Best regards,


James :-}

nmindana
Posts: 82
Joined: Thu Nov 18, 2010 5:00 pm
Has thanked: 52 times
Been thanked: 5 times
Contact:

Re: USB using 18f13k50

Post by nmindana »

Ben posted updated PPP config file which I downloaded but no luck.
It will be be nice if someone could post a working example for 18f13k50 & 18f14k50 along with config settings
and hardware connections.

18f13k50 is the cheapest PIC available with USB capabilities and has immense commercial value for embedded projects
I am sure everyone will agree on this. :?:

regards

Indana

Sparkoids
Posts: 267
Joined: Mon Sep 14, 2009 10:34 am
Has thanked: 30 times
Been thanked: 19 times
Contact:

Re: USB using 18f13k50

Post by Sparkoids »

Hi Indana,

What are you actually trying to do - is it the hardware side that is causing the problem?

My config file is the one mentioned in the post above but certainly it doesn't work on the 14K50 variant only the 18F13K50.

If you take your Flowcode file and compile to .hex you can *****IMPORT***** it into MPLAB.

Then use these settings in MPLAB to override the Flowcode settings and it'll work.


CPUDIV - CPU SYSTEM CLOCK / 2
USBDIV - OSC1/OSC2 / 2
FOSC - HS OSCILLATOR
PLLEN - OSCILLATOR * 4
FCMEN - FAIL SAFE CLOCK DISABLED
IESO - OSCILLATOR SWITCHOVER DISABLED
PWRTEN - PWRT ENABLED
BOREN - RESET ENABLED - HARDWARE ONLY
BORV - VBOR SET TO 3.0V NOMINAL
WDTEN - WDT CONTROLLED BY SWDTEN
WDTPS - 1:32768
HFOFST - DO NOT WAIT FOR OSCILLATOR
MCLRE - MCLR PIN ENABLED
STVREN - STACK FULL / UNDERFLOW RESETS
LVP - SINGLE SUPPLY ICSP DISABLED
BBSIZ - 1KW BOOT BLOCK SIZE
XINST - INSTRUCTION SET / EXTENSION ENABLED


********Remember*************** you have to use a voltage level dropper in series (from Microchip) with this device and the circuit must have the 2 caps and resistor fitted to program it.

I have custom modified a ICD 3 test lead to put that circuitry on board so it doesn't have to be fitted on every PCB to be programmed and will upload my findings on this awful device Monday next week.

So far we have programmed the device many times without issue on 4 different versions of a PCB so it can work once your config is set correctly and finally try recompiling the program and importing into MPLAB after every restart.

I don't know why but for some reason it doesn't seem to save the file correctly but that may be a Flowcode issue perhaps...

nmindana
Posts: 82
Joined: Thu Nov 18, 2010 5:00 pm
Has thanked: 52 times
Been thanked: 5 times
Contact:

Re: USB using 18f13k50

Post by nmindana »

Hi James Thanks,

I will work on this and feedback how I got on... :)

regards

Indana

Post Reply