Hello All;
Please see link in for MikroC Hex file problem
http://forum.mikroe.com/viewtopic.php?f ... 70#p271270
Please help I spent a lots of time to figure out this problem but I couldn't
Regards
USB with MikroC doesn't work!
Re: USB with MikroC doesn't work!
Hello All,
The idea is when I run the project without compiler the code, it does work as seen in Figure (The USB is detected)
The idea is when I run the project without compiler the code, it does work as seen in Figure (The USB is detected)
- Attachments
-
- 1.jpg (400.1 KiB) Viewed 4715 times
Re: USB with MikroC doesn't work!
But When I compiler the code the new Hex file does not work! as seen in figure! ( the USB doesn't detected)
and I did not change anything in the code! I just compiled it!
These are setting of MikroC
and I did not change anything in the code! I just compiled it!
These are setting of MikroC
- Attachments
-
- 2.jpg (270.87 KiB) Viewed 4715 times
-
- A.jpg (322.67 KiB) Viewed 4715 times
-
- 2.jpg (270.87 KiB) Viewed 4715 times
Re: USB with MikroC doesn't work!
I attached the project, please if any one can help and try the project before and after compiler it will work or not !
- Attachments
-
- project.rar
- (92.6 KiB) Downloaded 82 times
Re: USB with MikroC doesn't work!
Hi
Attached your Project that is working fine now and tested on my USB FS Demo board
a few things you should keep in mined
(1) you need to set-up the mcu in the configuration correctly you had the wrong OSC setting see what it should be when using a 20Mhz clock
(2) you have to include the descriptor file to your project ,delete the old descriptor file from your project and add the one that is in the project folder I posted for you there is an error in the
descriptor you are using.
You can see from my screen print that your code is now recognised by Windows
Attached your Project that is working fine now and tested on my USB FS Demo board
a few things you should keep in mined
(1) you need to set-up the mcu in the configuration correctly you had the wrong OSC setting see what it should be when using a 20Mhz clock
(2) you have to include the descriptor file to your project ,delete the old descriptor file from your project and add the one that is in the project folder I posted for you there is an error in the
descriptor you are using.
You can see from my screen print that your code is now recognised by Windows
- Attachments
-
- USB_prj.zip
- (102.67 KiB) Downloaded 82 times
-
- 2.JPG (31.7 KiB) Viewed 4706 times
-
- 3.JPG (52.42 KiB) Viewed 4706 times
P.Erasmus
Saratov,Russia
--------------------------------------------------------------
Saratov,Russia
--------------------------------------------------------------
Re: USB with MikroC doesn't work!
Hello Dear;
Thank you very much for your replay.
First of all; I load the Hex file on microcontroller proteus without compile the code and it does work fine!
but when I compile the code and take the new Hex file, it doesn't work !!!
I use the same setting as you said and I used the same disruptive file.
Can you please send the entire project that done echo (what ever you type in HID tool will received) because my project that I sent it does different job, not echo response!
Regards
ennng
Thank you very much for your replay.
First of all; I load the Hex file on microcontroller proteus without compile the code and it does work fine!
but when I compile the code and take the new Hex file, it doesn't work !!!
I use the same setting as you said and I used the same disruptive file.
Can you please send the entire project that done echo (what ever you type in HID tool will received) because my project that I sent it does different job, not echo response!
Regards
ennng
Re: USB with MikroC doesn't work!
The project I posted is your project where I did the modifications(echo characters ) and ran it successfully on my Hardware
if you use the hex file from my project it must work
Your project THE Descriptor file has an error as I mentioned
(1) use my project to compile and check how it works
(2) delete the descriptor file in your project and copy paste my descriptor to your project
(3) Make sure you have added the descriptor to the project
if you use the hex file from my project it must work
Your project THE Descriptor file has an error as I mentioned
(1) use my project to compile and check how it works
(2) delete the descriptor file in your project and copy paste my descriptor to your project
(3) Make sure you have added the descriptor to the project
- Attachments
-
- 14.05.jpg (48.86 KiB) Viewed 4682 times
P.Erasmus
Saratov,Russia
--------------------------------------------------------------
Saratov,Russia
--------------------------------------------------------------
Re: USB with MikroC doesn't work!
You should set the MCU clock frequency to 48 Mhz. The MCU uses the PLL output (which is 96 Mhz) divided by 2.ennng wrote:But When I compiler the code the new Hex file does not work! as seen in figure! ( the USB doesn't detected)
and I did not change anything in the code! I just compiled it!
These are setting of MikroC
Kind regards, Dany.
Forget your perfect offering. There is a crack in everything, that's how the light gets in... (L. Cohen)
Remember when we were young? We shone like the sun. (David Gilmour)
Forget your perfect offering. There is a crack in everything, that's how the light gets in... (L. Cohen)
Remember when we were young? We shone like the sun. (David Gilmour)
Re: USB with MikroC doesn't work!
I agree with Dany and if you close take a look in(your) the project I posted below in the Configuration you will notice the HSS with PLL and the clock at 48Mhz
I apologize I just realized the when I modified your project I just changed the PLL setting and not the 20Mhz to 48 Mhz
Sorry about that here is the new project
Again that was my mistake changeing your project to my project
I apologize I just realized the when I modified your project I just changed the PLL setting and not the 20Mhz to 48 Mhz
Sorry about that here is the new project
Again that was my mistake changeing your project to my project
- Attachments
-
- USB_prj_1.zip
- (102.74 KiB) Downloaded 88 times
P.Erasmus
Saratov,Russia
--------------------------------------------------------------
Saratov,Russia
--------------------------------------------------------------
Re: USB with MikroC doesn't work!
Hello All;
Thank you erasmus and Dany, I really appreciate your help!
First of all, erasmus I did all three steps as well as I change oscillator to 48MHz as suggested by Dany but still doesn't work!
When I use erasmus Hex file, the proteus work and I can detect the USB in HID tool but when compile the erasmus project on MikroC and generate new Hex file, proteus does not work and I can not detect the USB in HID !!!
I used the same project of erasmus without changing anything, just compile the code and use the new Hex file but doesn't work!
Also, I notes that the descriptor file of erasmus used the same number for vendor ID and product ID as both used 1234 ?
however, I used this one but does not work, also change product ID to 0001 but still the same problem, does not work!
Thank you erasmus and Dany, I really appreciate your help!
First of all, erasmus I did all three steps as well as I change oscillator to 48MHz as suggested by Dany but still doesn't work!
When I use erasmus Hex file, the proteus work and I can detect the USB in HID tool but when compile the erasmus project on MikroC and generate new Hex file, proteus does not work and I can not detect the USB in HID !!!
I used the same project of erasmus without changing anything, just compile the code and use the new Hex file but doesn't work!
Also, I notes that the descriptor file of erasmus used the same number for vendor ID and product ID as both used 1234 ?
however, I used this one but does not work, also change product ID to 0001 but still the same problem, does not work!
- Attachments
-
- 33.jpg (163.93 KiB) Viewed 4645 times
-
- 44.jpg (275.49 KiB) Viewed 4645 times
-
- 11.jpg (349.04 KiB) Viewed 4645 times
Re: USB with MikroC doesn't work!
The proteus run without error with the new Hex file but the USB analyser does not appear and usb does not detected in HID tool
but when I stop the proteus I got this
but when I stop the proteus I got this
- Attachments
-
- 22.jpg (325.46 KiB) Viewed 4644 times
Re: USB with MikroC doesn't work!
I would suggest that you first move your project to Real hard ,Simulation is exactly what it says simulation and No guarantee included with that
Use your generated hex file on real hardware to test ,unfortunately I do not have USB simulation with my Proteus , I used hardware
The problem you have here is that mE does not support Proteus for their compiler and Protues also does not support mE compiler so no one is going to solve the simulation problem for you
that is the reason I say use hardware and you can determine if it is your compiler that causing a problem or Proteus ,I am sure my compiler generates the correct hex file
This is the only sensible solution for you
Use your generated hex file on real hardware to test ,unfortunately I do not have USB simulation with my Proteus , I used hardware
The problem you have here is that mE does not support Proteus for their compiler and Protues also does not support mE compiler so no one is going to solve the simulation problem for you
that is the reason I say use hardware and you can determine if it is your compiler that causing a problem or Proteus ,I am sure my compiler generates the correct hex file
This is the only sensible solution for you
P.Erasmus
Saratov,Russia
--------------------------------------------------------------
Saratov,Russia
--------------------------------------------------------------
Re: USB with MikroC doesn't work!
Yes I agree the Hardware is the best choice to check!
But I need the simulation to do some project!
What confused me and made me a mad is that when use Hex file the proteus work fine and detect USB in HID tool but when compiled the c code the proteus doesn't work with the new Hex file
I suspect the MikroC?
But I need the simulation to do some project!
What confused me and made me a mad is that when use Hex file the proteus work fine and detect USB in HID tool but when compiled the c code the proteus doesn't work with the new Hex file
I suspect the MikroC?
Re: USB with MikroC doesn't work!
Hello All;
These results from real hardware implementation:
1- When I used erasmus's Hex file without compile the project, it does work as seen in Figures
These results from real hardware implementation:
1- When I used erasmus's Hex file without compile the project, it does work as seen in Figures
- Attachments
-
- 111.jpg (320.16 KiB) Viewed 4635 times
-
- 222.jpg (236.66 KiB) Viewed 4635 times
Re: USB with MikroC doesn't work!
2- but when I compiled the project, it compiled successfully without any error but the strange thing here when I import the new Hex file to programmer is just show two characters and the entire code is just zero !!! which doesn't make any sense. The Hex code is loaded to real microcontroller but it does not work which is acceptable as the new Hex file does not contains anything (just two characters ???)
I think the simulation and real hardware work fine but the problem and issue when generate the new Hex file!
even though, the MikroC was compiled successfully without any error!!
Please any comments or help, I appreciate that !
I think the simulation and real hardware work fine but the problem and issue when generate the new Hex file!
even though, the MikroC was compiled successfully without any error!!
Please any comments or help, I appreciate that !
- Attachments
-
- 333.jpg (272.49 KiB) Viewed 4635 times
-
- 444.jpg (355.53 KiB) Viewed 4635 times