Jump to content

Help Required In Using Pic_pack Usb


Recommended Posts

Hi guys,

I wish to use PIC18F2550 for my usb-uart project. Since Source boost does not have its own library, I have to use the pic_pack lib provided by Ian Harris.

I have lots of doubt, but let me start one by one.

 

In his program usb_serial.c, they have used the following header files ie. .h files

// Pic Pack includes
#include "config.h"
#include "pic_utils.h"
#include "pic_usb.h"
#include "pic_tick.h"
#include "pic_timer.h"

#include "usb_cdc_class.h"

// System includes
#include "string.h"
#include "stdlib.h"
#include "config.h"

// If you'd like USB debug info out the serial connection, uncomment this line:
//#define USB_SERIAL_DEBUG
// You also might like to uncomment the USB_DEBUG and CDC_DEBUG lines in the config.h

#ifdef USB_SERIAL_DEBUG
#include "pic_serial.h"
#endif

 

If you see the above code you will see two config.h files one in the pic pack include & other in the system includes.

where do I find the second one. Is it the same as system.h provided in the souceboost include folder?

 

How to build the above program?

Do I have to add the .lib files from the pic_pack library folders?

 

Regards

Raghunathan

Link to post
Share on other sites

Hi Raghunathan,

 

The fact that config.h is included twice does not matter. This file has conditional compile flags so it will only be included once.

 

The system files "string.h" are in double quotes but do not have to be. It could have been written as <string.h> and still compile OK. The double quotes says "Look in the project directory first, if not found look in the system ..\inc directory.

 

The demo does compile with a few warnings which could be sorted with a few casts etc.

 

Cheers

 

Reynard

Link to post
Share on other sites

Hi Reynard,

 

The usb_serial folder also has two other .hex files in the name of usb_serial_works & user_serial. Do u have any idea as why these .hex are in this project file.

Regards

Raghunathan

Link to post
Share on other sites
Hi Raghunathan,

 

These are just test file for some of Ian's projects so you can ignore them.

 

Visit Ian's web site

 

http://embeddedadventures.blogspot.com/

 

and goto USB Part 5 and it tells you a little about a file for TechToys demo board.

 

Cheers

 

Reynard

 

In fact I even have a printout of the project. I tried building the same project ie. usb_serial and the compiler returned a fail. it says it couldn't find

some of the .obj files.

 

can any one say how to build this project(usb_serial) in the demos folder of pic_pack step by step like you would to a child? I confess Iam quite dumb.

I want to know which are the files that need to be added to project etc..

 

The easiest thing would be to just burn the .hex file(only onto pic18f4550) & test it... and I only have a 2550 chip with me right now.

 

Regards

Raghunathan.

Link to post
Share on other sites

Open up the project usb_serial.__c within the IDE.

 

The "Workspace" panel shows you all the files needed and where they are (directory). Where the pic_pack library files are depends on what you done with them when you unzipped the files.

 

I just opened up the project, hit the 'B' button and it all worked.

 

Look at the Settings/Options... dialog box for extra compiler option.

 

Cheers

 

Reynard

Link to post
Share on other sites
Open up the project usb_serial.__c within the IDE.

 

The "Workspace" panel shows you all the files needed and where they are (directory). Where the pic_pack library files are depends on what you done with them when you unzipped the files.

 

I just opened up the project, hit the 'B' button and it all worked.

 

Look at the Settings/Options... dialog box for extra compiler option.

 

Cheers

 

Reynard

 

I did just that & this is what I got.

Building...
BoostC Optimizing C Compiler Version 6.92 (for PIC18 architecture)
http://www.sourceboost.com
Copyright(C) 2004-2009 Pavel Baranov
Copyright(C) 2004-2009 David Hobday

Licensed to RAGHUNATHAN PARAMASIVAM under Single user Pro License for 1 node(s)
Limitations: PIC18 max code size:Unlimited, max RAM banks:Unlimited


..\..\pic_pack_lib\pic_utils.c

success
BoostC Optimizing C Compiler Version 6.92 (for PIC18 architecture)
http://www.sourceboost.com
Copyright(C) 2004-2009 Pavel Baranov
Copyright(C) 2004-2009 David Hobday

Licensed to RAGHUNATHAN PARAMASIVAM under Single user Pro License for 1 node(s)
Limitations: PIC18 max code size:Unlimited, max RAM banks:Unlimited


..\..\pic_pack_lib\pic_tick.c

success
BoostC Optimizing C Compiler Version 6.92 (for PIC18 architecture)
http://www.sourceboost.com
Copyright(C) 2004-2009 Pavel Baranov
Copyright(C) 2004-2009 David Hobday

Licensed to RAGHUNATHAN PARAMASIVAM under Single user Pro License for 1 node(s)
Limitations: PIC18 max code size:Unlimited, max RAM banks:Unlimited


..\..\pic_pack_lib\pic_timer.c

success
BoostC Optimizing C Compiler Version 6.92 (for PIC18 architecture)
http://www.sourceboost.com
Copyright(C) 2004-2009 Pavel Baranov
Copyright(C) 2004-2009 David Hobday

Licensed to RAGHUNATHAN PARAMASIVAM under Single user Pro License for 1 node(s)
Limitations: PIC18 max code size:Unlimited, max RAM banks:Unlimited


usb_serial.c
C:\Program Files\SourceBoost\Samples\C\BoostC\pic_pack\picpack_2.0\demos\usb_serial\usb_serial.c(133): warning: conversion from 'unsigned int' to 'unsigned char', possible loss of data
C:\Program Files\SourceBoost\Samples\C\BoostC\pic_pack\picpack_2.0\demos\usb_serial\usb_serial.c(239:2): warning: expression is always true

success
BoostC Optimizing C Compiler Version 6.92 (for PIC18 architecture)
http://www.sourceboost.com
Copyright(C) 2004-2009 Pavel Baranov
Copyright(C) 2004-2009 David Hobday

Licensed to RAGHUNATHAN PARAMASIVAM under Single user Pro License for 1 node(s)
Limitations: PIC18 max code size:Unlimited, max RAM banks:Unlimited


usb_config_serial.c

success
BoostC Optimizing C Compiler Version 6.92 (for PIC18 architecture)
http://www.sourceboost.com
Copyright(C) 2004-2009 Pavel Baranov
Copyright(C) 2004-2009 David Hobday

Licensed to RAGHUNATHAN PARAMASIVAM under Single user Pro License for 1 node(s)
Limitations: PIC18 max code size:Unlimited, max RAM banks:Unlimited


..\..\pic_pack_lib\usb_cdc_class.c
C:\Program Files\SourceBoost\Samples\C\BoostC\pic_pack\picpack_2.0\pic_pack_lib\usb_cdc_class.c(125): warning: conversion from 'unsigned int' to 'unsigned char', possible loss of data

success
BoostC Optimizing C Compiler Version 6.92 (for PIC18 architecture)
http://www.sourceboost.com
Copyright(C) 2004-2009 Pavel Baranov
Copyright(C) 2004-2009 David Hobday

Licensed to RAGHUNATHAN PARAMASIVAM under Single user Pro License for 1 node(s)
Limitations: PIC18 max code size:Unlimited, max RAM banks:Unlimited


..\..\pic_pack_lib\pic_usb_buffer_mgt.c

success
BoostC Optimizing C Compiler Version 6.92 (for PIC18 architecture)
http://www.sourceboost.com
Copyright(C) 2004-2009 Pavel Baranov
Copyright(C) 2004-2009 David Hobday

Licensed to RAGHUNATHAN PARAMASIVAM under Single user Pro License for 1 node(s)
Limitations: PIC18 max code size:Unlimited, max RAM banks:Unlimited


..\..\pic_pack_lib\pic_usb.c
C:\Program Files\SourceBoost\Samples\C\BoostC\pic_pack\picpack_2.0\pic_pack_lib\pic_usb.c(354): warning: assignment of constant to pointer
C:\Program Files\SourceBoost\Samples\C\BoostC\pic_pack\picpack_2.0\pic_pack_lib\pic_usb.c(635): warning: conversion from 'unsigned int' to 'unsigned char', possible loss of data

success
BoostC Optimizing C Compiler Version 6.92 (for PIC18 architecture)
http://www.sourceboost.com
Copyright(C) 2004-2009 Pavel Baranov
Copyright(C) 2004-2009 David Hobday

Licensed to RAGHUNATHAN PARAMASIVAM under Single user Pro License for 1 node(s)
Limitations: PIC18 max code size:Unlimited, max RAM banks:Unlimited


..\..\pic_pack_lib\pic_serial.c

success
BoostLink Optimizing Linker Version 6.92
http://www.sourceboost.com
Copyright(C) 2004-2009 Pavel Baranov
Copyright(C) 2004-2009 David Hobday




failure
Error: Failed to open:pic_utils.obj
Error: Failed to open:pic_tick.obj
Error: Failed to open:pic_timer.obj
Error: Failed to open:usb_cdc_class.obj
Error: Failed to open:pic_usb_buffer_mgt.obj
Error: Failed to open:pic_usb.obj
Error: Failed to open:pic_serial.obj
"C:\Program Files\SourceBoost\boostc.pic18.exe" ..\..\pic_pack_lib\pic_utils.c -t PIC18F4550 -W2 -I "..\..\pic_pack_lib" 
"C:\Program Files\SourceBoost\boostc.pic18.exe" ..\..\pic_pack_lib\pic_tick.c -t PIC18F4550 -W2 -I "..\..\pic_pack_lib" 
"C:\Program Files\SourceBoost\boostc.pic18.exe" ..\..\pic_pack_lib\pic_timer.c -t PIC18F4550 -W2 -I "..\..\pic_pack_lib" 
"C:\Program Files\SourceBoost\boostc.pic18.exe" usb_serial.c -t PIC18F4550 -W2 -I "..\..\pic_pack_lib" 
"C:\Program Files\SourceBoost\boostc.pic18.exe" usb_config_serial.c -t PIC18F4550 -W2 -I "..\..\pic_pack_lib" 
"C:\Program Files\SourceBoost\boostc.pic18.exe" ..\..\pic_pack_lib\usb_cdc_class.c -t PIC18F4550 -W2 -I "..\..\pic_pack_lib" 
"C:\Program Files\SourceBoost\boostc.pic18.exe" ..\..\pic_pack_lib\pic_usb_buffer_mgt.c -t PIC18F4550 -W2 -I "..\..\pic_pack_lib" 
"C:\Program Files\SourceBoost\boostc.pic18.exe" ..\..\pic_pack_lib\pic_usb.c -t PIC18F4550 -W2 -I "..\..\pic_pack_lib" 
"C:\Program Files\SourceBoost\boostc.pic18.exe" ..\..\pic_pack_lib\pic_serial.c -t PIC18F4550 -W2 -I "..\..\pic_pack_lib" 
"C:\Program Files\SourceBoost\boostlink.pic.exe" /ld "C:\Program Files\SourceBoost\lib" libc.pic18.lib pic_utils.obj pic_tick.obj pic_timer.obj usb_serial.obj usb_config_serial.obj usb_cdc_class.obj pic_usb_buffer_mgt.obj pic_usb.obj pic_serial.obj /t PIC18F4550 /d "C:\Program Files\SourceBoost\Samples\C\BoostC\pic_pack\picpack_2.0\demos\usb_serial" /p usb_serial
Exit code was -2.
Removing target: usb_serial.hex
Failed to locate output file 'C:\Program Files\SourceBoost\Samples\C\BoostC\pic_pack\picpack_2.0\demos\usb_serial\usb_serial.hex'
Done

Failed

In the compiler options in the exta compiler I can see this... "-I "..\..\pic_pack_lib""

The linker option is empty. Anything to with it

Regards

Raghunathan

Edited by ra68gi
Link to post
Share on other sites

Mmmmmmmmmmmmm!

 

Upgrade to BoostC 6.95.

 

Alternatively copy all the USB library files into the application/project directory.

 

Cheers

 

Reynard

 

ps. See version log V6.93 RC2

Edited by Reynard
Link to post
Share on other sites
Mmmmmmmmmmmmm!

 

Upgrade to BoostC 6.95.

 

Alternatively copy all the USB library files into the application/project directory.

 

Cheers

 

Reynard

 

ps. See version log V6.93 RC2

 

I didn't tamper with the folder at all. I just down loaded the zip file today extracted all the files. opened Sourceboost Ide selected the project & hit build button.

Anything to do with the linker options

Regards

Raghunathan.

Link to post
Share on other sites
The problem is possibly in the V6.92 that you are using which had problems with sources from multiply locations.

 

Upgrade to V6.95.

 

Cheers

 

Reynard

I think your right.

 

I have this from the version updates..

SourceBoost V6.92 
(13-February-2009) 	
BoostC/BoostC++/BoostBasic
1.Fixed LFSR instruction use in inline assembler.
2.Fixed bug when compiler generated incorrect code for expressions like (&First->a)->local_1 = 0x5555;
3.Obj files are now created in the same directory where source  files are. Before this change obj files were created in the current directory.

 

I try downloading the latest version.

Thanks

Raghunathan.

Link to post
Share on other sites

Hi Raghunathan

 

I had to add the 18F2550 to the analog_inputs_off() def in picutils.h and it compiles and runs just fine.

 

With the serial debug turned on, at a slower baud rate than Ian's, the code did not work. I turned the debug code off and it all runs perfectly.

 

I hope that helps

 

Regards

 

Tim

Link to post
Share on other sites
Hi Raghunathan

 

I had to add the 18F2550 to the analog_inputs_off() def in picutils.h and it compiles and runs just fine.

 

With the serial debug turned on, at a slower baud rate than Ian's, the code did not work. I turned the debug code off and it all runs perfectly.

 

I hope that helps

 

Regards

 

Tim

Thanks Tim for those tips.

I will spend some more time going thro' the lib files try to understand the program & then burn the chip. I should be in a position to modify the code to suit my application. will get back to you when I face problems.

 

Regards

Raghunathan

Link to post
Share on other sites

Join the conversation

You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...