Page 1 of 1
USB using 18f13k50
Posted: Fri Nov 25, 2011 5:29 pm
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
Re: USB using 18f13k50
Posted: Fri Nov 25, 2011 5:33 pm
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.
Re: USB using 18f13k50
Posted: Sat Nov 26, 2011 5:11 pm
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....
Re: USB using 18f13k50
Posted: Thu Dec 01, 2011 5:45 pm
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
Re: USB using 18f13k50
Posted: Wed Dec 07, 2011 11:04 am
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...
Re: USB using 18f13k50
Posted: Thu Dec 08, 2011 12:21 pm
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.
Let me know how you get on.
Re: USB using 18f13k50
Posted: Mon Dec 12, 2011 10:28 pm
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

Re: USB using 18f13k50
Posted: Tue Dec 13, 2011 12:36 pm
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 :-}
Re: USB using 18f13k50
Posted: Tue Dec 13, 2011 6:33 pm
by lewisrendal
Hi james,
Yep tried that and still no joy, the issue I'm getting is this below:

- usb issue pic.jpg (110.4 KiB) Viewed 12286 times
Cheers
James

Re: USB using 18f13k50
Posted: Wed Dec 14, 2011 3:12 pm
by Sparkoids
Hi James,
What exactly is your USB device?
James :-}
Re: USB using 18f13k50
Posted: Wed Dec 14, 2011 4:21 pm
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

Re: USB using 18f13k50
Posted: Wed Dec 14, 2011 5:53 pm
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 :-}
Re: USB using 18f13k50
Posted: Wed Dec 14, 2011 6:36 pm
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.
Let me know how you get on.
Re: USB using 18f13k50
Posted: Sat Dec 31, 2011 7:15 pm
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
Re: USB using 18f13k50
Posted: Sat Jan 07, 2012 9:16 am
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 !
Regards
James
Re: USB using 18f13k50
Posted: Sat Jan 07, 2012 1:21 pm
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 :-}
Re: USB using 18f13k50
Posted: Sat Jan 07, 2012 7:42 pm
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
regards
Indana
Re: USB using 18f13k50
Posted: Sun Jan 08, 2012 3:00 pm
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 :-}
Re: USB using 18f13k50
Posted: Sun Jan 08, 2012 7:55 pm
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
Re: USB using 18f13k50
Posted: Tue Jan 10, 2012 3:58 pm
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...
Re: USB using 18f13k50
Posted: Thu Jan 12, 2012 2:30 pm
by nmindana
Hi James Thanks,
I will work on this and feedback how I got on...
regards
Indana