Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

usb data logger using pic24fj64GB106........

Status
Not open for further replies.

jit_singh_tara

Full Member level 6
Joined
Dec 22, 2006
Messages
325
Helped
9
Reputation
18
Reaction score
4
Trophy points
1,298
Location
Delhi , India
Activity points
4,293
Dear Friends ,

Trying to interface usb mcu pic24fj64gb106 , There is no voltage on Vbus pin34 of the mcu ,When i connect the mcu to uart and hyper terminal it shows USB Error : overcurrent detected.

I am using AN1145 , Microchip application library usb thumbdrive data logger project.
Modified the usb_data_logger file .......

The circuit is :
View attachment ConverterRS-USB.pdf


Why there is no voltage on the Vbus pin ,and the error "**** USB Error : overcurrent detected.*****

What to do?
 

I think the Vbus pin is 5V input pin If no voltage in that pin means the output is short circuited or overloaded..
 

overcurrent detected usually means you are attempting to pull too much current from a USB port
check for a short circuit on pin 1 of the USB connector
 

I have connected my usb connector to the mcu ,

You mean to say that i am drawing too much current from the vbus pin of the mcu .......Can i connect the pen drive +pin( pin1) to 5V Directly........or what else can be done .

The problem is that even when the pen drive is not connected the over current error keeps on popping....on hyper terminal which is connected to the uart2 .
 
Last edited:

Just give it 5V and check.

- - - Updated - - -

Yeah You are absolutely missing that part

Untitled.png


You have to give 5V to that pin in host mode
 

I have connected my usb connector to the mcu ,

You mean to say that i am drawing too much current from the vbus pin of the mcu .......Can i connect the pen drive +pin( pin1) to 5V Directly........or what else can be done .

The problem is that even when the pen drive is not connected the over current error keeps on popping....on hyper terminal which is connected to the uart2 .
missread your application!

your USB connector is wired so the PIC24 is a USB device, e.g. you connect it to a PC host and it appears as a mouse, HID device, etc depending what it is programmed as

your data logger application requires the PIC24 to act as a USB host and it should supply the 5volts to pin 1 of the connector, e.g. your circuit should be something like

USB.jpg
 
Last edited:

I tried that ,

now it is showing over current condition removed and after 2 sec again it is showing over current detected .... this is repeating again and again......
 

I havent given the divided signal to a/d pin ......is it also required if yes then at what pins.......

- - - Updated - - -

I connected the 2.5 volt to the desired pin an8 now the error is gone....usb over current ....

But still i get a new error " No Media Present".
 

Please find the attached zipped file .

Running in c30 compiler , mplab x ide , pic24fj64gb106 .


"Not detecting the media ."
 

Attachments

  • Copy of Host - Mass Storage - Thumb Drive Data Logger.rar
    566.1 KB · Views: 122
Last edited:

you have probably got the USB frequency incorrect
what is your crystal frequency?
check the config settings (I assume you did the modifications?)
Code:
    #elif defined(__PIC24FJ256GB106__)
    _CONFIG2(FNOSC_PRIPLL & POSCMOD_HS & PLL_96MHZ_ON & PLLDIV_DIV2) // Primary HS OSC with PLL, USBPLL /2
_CONFIG1(JTAGEN_OFF & FWDTEN_OFF & ICS_PGx2)   // JTAG off, watchdog timer off

        //_CONFIG1( JTAGEN_OFF & GCP_OFF & GWRP_OFF & COE_OFF & FWDTEN_OFF & ICS_PGx2) 
       // _CONFIG2( 0xF7FF & IESO_OFF & FCKSM_CSDCMD & OSCIOFNC_OFF & POSCMOD_HS & FNOSC_PRIPLL & PLLDIV_DIV3 & IOL1WAY_ON)
 
Hi horace ,

I am using 20 Mhz Crystal ...and i havent selected the settings you indicated for the config bits.....
 

I got the modified code from the microchip support .......They changed the usb_data_logger.c file . I have posted the modified code project in earlier post .
 

I got the modified code from the microchip support .......They changed the usb_data_logger.c file . I have posted the modified code project in earlier post .

in hardwareprofile.h is
Code:
// Sample clock speed for a 16-bit processor
#if defined (__C30__) || defined __XC16__

    // Various clock values
    #define GetSystemClock()            32000000UL
    #define GetPeripheralClock()        (GetSystemClock())
    #define GetInstructionClock()       (GetSystemClock() / 2)

    // Clock values
    #define MILLISECONDS_PER_TICK       10
    #define TIMER_PRESCALER             TIMER_PRESCALER_8   // 8MHz: TIMER_PRESCALER_1
    #define TIMER_PERIOD                20000                // 10ms=20000, 1ms=2000
it looks like the code is built for an 8MHz crystal

either change the crystal or your config settings
 

How did you got the MLA for C30 compiler, I am not able to do it by my self getting lot of errors..
 

I tried 8 Mhz also ,

But same error : No Media Present .

- - - Updated - - -

I am using c30 v 3.02 , i had been using it earlier in mplab 8......Now i am using it in mplabx ide .

- - - Updated - - -

I am using the project from :

microchip_solutions_v 2013-06-15
 

I built
C:\microchip_solutions_v2013-06-15\USB\Host - Mass Storage - Simple Demo\Firmware\USB Host - MSD - Simple Demo - XC16.mcp

using the C30 compiler (I had to add heap and stack settings to the project)
and loaded it into a Bytronic Mechatronics trainer
**broken link removed**

which uses a PIC24FJ256GB110 with 8MHz crystal
plugged in a USB flash drive and the TEXT.TXT file was written OK

what is your circuit now?
 
I tried to run the project as stated by you , but the device pic24fj64gb106 .


Project : Usb mass storage simple demo:

I added to turn on an led in the following code segment :

while(1)
{
//USB stack process function
USBTasks();

PORTCbits.RC14 = 0;

//if thumbdrive is plugged in
if(USBHostMSDSCSIMediaDetect())
{
PORTCbits.RC14 = 1; // if media detect turn on the led connected to rc14

deviceAttached = TRUE;

//now a device is attached
//See if the device is attached and in the right format
if(FSInit())
{
//Opening a file in mode "w" will create the file if it doesn't
// exist. If the file does exist it will delete the old file
// and create a new one that is blank.
myFile = FSfopen("test.txt","w");
.
.
.
.
.
.
.
.
.
.
.
}

By doing this i can say that the file test.txt is still not created , bcoz the led is never turned on which means it is not detecting the media ....now how do i check for this thing that why the usb is not getting detected in both the projects:


1. usb thumbdrive data logger .
2. Simple usb ms demo.

- - - Updated - - -

Please check and tell if there is anything wrong with the schematic :
 

Attachments

  • ConverterRS-USB.pdf
    64.3 KB · Views: 110

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top