CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

Running code with and without USB Bootloader

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
Bcox



Joined: 09 Oct 2007
Posts: 17
Location: Windsor, CT

View user's profile Send private message Visit poster's website

Running code with and without USB Bootloader
PostPosted: Mon May 05, 2008 8:29 am     Reply with quote

Hello all,
I am a developing a USB HID system using a 18F4550. I have developed a LabView application that communicates with this device with no problems. A new requirement came along that has required me to use a bootloader for this system so I am attempting to use the ex_usb_bootloader.c as a starting place. I am able to install the bootloader no problem and download my code using SIOW.exe no problem.

Here is my problem:
When I run my system without a bootloader I have reliable communication back and forth from the PC and PIC. When I install my program with the bootloader it does not seem like I can send data from the PIC to the PC when requested. I know the PC and PIC are talking to each other since the computer recognizes the device and I can control the PIC from the PC (LabView program). I am trying to send data using the usb_put_packet command.

Code:
sprintf(out_data,"%fR",pressure_value);
usb_put_packet(1, out_data, strlen(out_data), USB_DTS_TOGGLE);


This code runs fine when I don't have a bootloader installed. When the bootloader is installed, the PIC does not freeze up and the usb_put_packet returns TRUE so i know it is running the code.

Are the pointer locations getting lost due to the offset of code from the bootloader? I am not sure what else might cause this problem. This is my first project using USB and a bootloader so my knowledge of both is rather lacking. Could it be the size of my program that is causing the probem? The software I am installing after the bootloader uses 44% of rom and 59%-65% of RAM. Any help would be greatly appreciated. Thanks!
Bcox



Joined: 09 Oct 2007
Posts: 17
Location: Windsor, CT

View user's profile Send private message Visit poster's website

Problem Solved
PostPosted: Mon May 05, 2008 10:59 am     Reply with quote

Problem Solved. I had only defined the variable out_data as follows:
Code:
char out_data[];


when I should have defined it as (for example):

Code:
 char out_data[40];


I can now accurately send data to and from the PC and the PIC.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group