!Ray of hope!: PIC24FJ256GB106 USB Serial not initialize
Moderator: Benj
!Ray of hope!: PIC24FJ256GB106 USB Serial not initialize
Hi
i do not know why but USB Serial or USB HID or USB Slave is not going on.
I make a simple test with USB Serial i attached.
In Windows a New Hardware will found but do not install the driver " unknown Device "
I have Simple Project attached.
Any Idea?
Thank You!
Best wishes!
Rudi
i do not know why but USB Serial or USB HID or USB Slave is not going on.
I make a simple test with USB Serial i attached.
In Windows a New Hardware will found but do not install the driver " unknown Device "
I have Simple Project attached.
Any Idea?
Thank You!
Best wishes!
Rudi
Last edited by Rudi on Sat Jul 12, 2014 2:58 pm, edited 3 times in total.
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: FC6 PIC24FJ256GB106 USB Serial / HID / Slave not initial
Hi Rudi,
It could be that your clock speed is incorrect as this would cause the unknown device error. Change the device config so 1s delays are equal to 1s with the clock speed set to 32000000 and then the USB should fire up correctly.
It could be that your clock speed is incorrect as this would cause the unknown device error. Change the device config so 1s delays are equal to 1s with the clock speed set to 32000000 and then the USB should fire up correctly.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Re: FC6 PIC24FJ256GB106 USB Serial / HID / Slave not initial
Benj wrote:Hi Rudi,
It could be that your clock speed is incorrect as this would cause the unknown device error. Change the device config so 1s delays are equal to 1s with the clock speed set to 32000000 and then the USB should fire up correctly.
Ok Benj, i was deeper in the code and ... i am sorry. i can not change the config that USB will go on.. the Uart / channels too...
if i change for Channels i can get not correct 1s = 1s for USB and if i change for USB Baudrate and Timing for Channel is wrong..
I have a question:
I am setting the Config for UART and Baudrate opposite the USB Config...
If i need USB and the Uarts at same time - what config must i set ....
Can you plz check this
i have setting a Config Bit like Microchips Code is setting, but the Bit 22-23 example has no Item to the Bit.
i set
config3: 0xFFFF
config2: 0x53FE ( here is no item in the list ) ( also with 0x43FE [WebStorageDemoUSB]..and also 0x11FF [starterKit]this is a original settimg from Code.. )
config1: 0x3E7F
i append screenshot...
i can not set the Clock and Tact correct with 12 MHz or 20 MHz Crystal..
The 12 MHz Board is the Starter Kit PIC24 from Microchip - so i wounder me that UART / USB is not going on in FC
but in MPLAP is ok. The second Board is the Wifi Server Board with 20 MHz Crystal, in the MPLAP Code is USB as CDC and
HID working well , but i can not go on with FC..
i have check the original HEX File from Microchips and Imported in MPLAP to see the Config BIts in the Code,
one is Config2: 0x43FE at Config2. btw...BIT 18 is not include.. in FC is I2C2
and one is Config2: 0x11FF
all two Config2 bits seems are not set correct the bits in FC...
there no items for the bits...
i have append this ...Can you check this? perhabs here is a mistake...
Best Thank!!! For your Service!
Best wishes
Rudi
Re: FC6 PIC24FJ256GB106 USB Serial / HID / Slave not initial
Hi Benj,
ok USB Serial now Work..
EDIT: Initialize only at windows... but no data receive...
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Bit Set: CONFIG2: 0x43BE
32000000HZ
but please...
please check the bit settings in original hex i attached
in the hex.are bit setting to CONFIG2 that not possible...
in the picture you can see my tests..
but i am happy
USB Serial no work with 0x43BE
EDIT: Initialize only at windows... but no data receive...
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Best wishes!
Rudi
ok USB Serial now Work..
EDIT: Initialize only at windows... but no data receive...
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Bit Set: CONFIG2: 0x43BE
32000000HZ
but please...
please check the bit settings in original hex i attached
in the hex.are bit setting to CONFIG2 that not possible...
in the picture you can see my tests..
but i am happy
USB Serial no work with 0x43BE
EDIT: Initialize only at windows... but no data receive...
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Best wishes!
Rudi
Re: FC6 PIC24FJ256GB106 USB Serial / HID / Slave not initial
Hi Benj..sorry ..
PIC24FJ256GB106
20MHz on Board
Clock Set 32000000 Hz
delay 1s = 1s
Config Bits
Config3: 0xFFFF
Config2: 0x43BE
Config1: 0x3E7F
USB Serial initialise.. at windows ok
USB SendString.. not arrieved..
Best wishes
Rudi
PIC24FJ256GB106
20MHz on Board
Clock Set 32000000 Hz
delay 1s = 1s
Config Bits
Config3: 0xFFFF
Config2: 0x43BE
Config1: 0x3E7F
USB Serial initialise.. at windows ok
USB SendString.. not arrieved..
Best wishes
Rudi
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: FC6 PIC24FJ256GB106 USB Serial / HID / Slave not initial
Hi Rudi,
Try adding a couple of seconds delay in the loop just above the send string. It could be that your filling and overflowing the USB data buffer by constantly sending new data in a tight loop. If this works then you can start to reduce the delay to something a bit more acceptable.
Try adding a couple of seconds delay in the loop just above the send string. It could be that your filling and overflowing the USB data buffer by constantly sending new data in a tight loop. If this works then you can start to reduce the delay to something a bit more acceptable.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Re: FC6 PIC24FJ256GB106 USB Serial / HID / Slave not initial
Hi BenjBenj wrote:Hi Rudi,
Try adding a couple of seconds delay in the loop just above the send string. It could be that your filling and overflowing the USB data buffer by constantly sending new data in a tight loop. If this works then you can start to reduce the delay to something a bit more acceptable.
i have added a delay of 20s in loop before Makro USBSendString...
and i have added in initialise a 10s timeout for Enumeration Timeout ( yes) . ( usb Serial is quickliy find and initialise )
Baudrate i have set in Terminal to 9600
sorry - no go on with data ...
what you need from me i will attached...
best wishes
rudi
Re: FC6 PIC24FJ256GB106 USB Serial / HID / Slave not initial
Hi...
Sorry for this... but i think with config bits in FC6 goes wrong with PIC24...
i posted early post the same...
i have test now with MPLAPX again...
p l e a s e have a look to the config bits at FC with the PIC24FJ256GB106
the Config2 i set with 0x43FE like the original Demo with Microchip Code..
in MPLAPX the "Flowcode bit 22-23" is set to "Both Clock Switching and Fail-Safe Clock Monitor are disabled"
but in Flowcode this will make a "3"...
i think here "shifts something in the order".. because the second Entry of Flowcode Bit Setting "I2C2 Pin Select bit" ( Flowcode Bit 18 ) is not listed in Config Bits in MPLAPX
MPLAPX = 9 ListItems
FLOWCODE = 10 Listitems
and if all ok...
Counter question:
Where i set the "Flowcode Config Bit 18 I2C2 Pin Select bit" in MPLAPX ?......
i work now a long time to go on the UART with right baud and USB response...
i have now a break in the work with pic24 .. i must stop...because i can not find the mistake.
I would love to continue to work more and go on the USB OTG and USB MIDI Class compilant attack but
as long as the basic function not goes, it makes no sense..
please check this config register bits..... is there a mistake at Flowcode6 with the PIC24 or i am wrong with my found..
Thank you!
Best wishes!
Rudi
Only a Question:
In
http://ww1.microchip.com/downloads/en/D ... 39907b.pdf
the Bit Location of I2C2SEL is CW2<2> with value 1 at side 20 noted.
In FC this at Config Bit 18 ?
i am not sure - but is this ok?
Sorry for this... but i think with config bits in FC6 goes wrong with PIC24...
i posted early post the same...
i have test now with MPLAPX again...
p l e a s e have a look to the config bits at FC with the PIC24FJ256GB106
the Config2 i set with 0x43FE like the original Demo with Microchip Code..
in MPLAPX the "Flowcode bit 22-23" is set to "Both Clock Switching and Fail-Safe Clock Monitor are disabled"
but in Flowcode this will make a "3"...
i think here "shifts something in the order".. because the second Entry of Flowcode Bit Setting "I2C2 Pin Select bit" ( Flowcode Bit 18 ) is not listed in Config Bits in MPLAPX
MPLAPX = 9 ListItems
FLOWCODE = 10 Listitems
and if all ok...
Counter question:
Where i set the "Flowcode Config Bit 18 I2C2 Pin Select bit" in MPLAPX ?......
i work now a long time to go on the UART with right baud and USB response...
i have now a break in the work with pic24 .. i must stop...because i can not find the mistake.
I would love to continue to work more and go on the USB OTG and USB MIDI Class compilant attack but
as long as the basic function not goes, it makes no sense..
please check this config register bits..... is there a mistake at Flowcode6 with the PIC24 or i am wrong with my found..
Thank you!
Best wishes!
Rudi
Only a Question:
In
http://ww1.microchip.com/downloads/en/D ... 39907b.pdf
the Bit Location of I2C2SEL is CW2<2> with value 1 at side 20 noted.
In FC this at Config Bit 18 ?
i am not sure - but is this ok?
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: FC6 PIC24FJ256GB106 USB Serial / HID / Slave not initial
Hello,
Here is an updated FCDX file, I have also been through and cleaned up the config for the rest of the family.
I would set the USB enumeration timeout setting back to no as you don't want the enumeration to timeout if you need the USB comms to work. This basically allows the init function to wait until the device is recognised by the PC and the device driver is installed before you go on to send any data.
In your config it might still have settings for the Clock switching option at 0x3, Selecting one of the options will get rid of the '3' though in reality this won't break anything.
Here is an updated FCDX file, I have also been through and cleaned up the config for the rest of the family.
I would set the USB enumeration timeout setting back to no as you don't want the enumeration to timeout if you need the USB comms to work. This basically allows the init function to wait until the device is recognised by the PC and the device driver is installed before you go on to send any data.
In your config it might still have settings for the Clock switching option at 0x3, Selecting one of the options will get rid of the '3' though in reality this won't break anything.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Re: FC6 PIC24FJ256GB106 USB Serial / HID / Slave not initial
Hi Benj - ty..
..i go on next time with this..
Benj pls can u help me in this..
i will set manually config bit like and test it with unchecked "write config on download"...
like this
/*
Enter C code below this comment
*/
#pragma config ??
_CONFIG2(IESO_OFF & PLL_96MHZ_ON & PLLDIV_DIV5 & FNOSC_PRIPLL & POSCMOD_HS) // Primary HS OSC with PLL, USBPLL /3
_CONFIG1(JTAGEN_OFF & ICS_PGx2 & FWDTEN_OFF) // JTAG off, watchdog timer off
--
can i append a makro for c at begin for this and how i can set the config bit in the code..
i think i must rename the "variable" to fc variable or can i set it to Chip Bit name.?.
IESO_OFF ..
will be then
right? can i put this at start code in main - flowchart like a makro for c code or must this in "use supplementary code"..top or bottom or all two..sorry for the beginner question i am a little unsure..
and a append question..
if i will append Assembler Code in Flowchart can i do this and can you say me how i go on with this?
btw..with "USBPLL /3" i search but have not found helps in fcdx.....
ty Benj for your help!
Best wishes!
Rudi
..i go on next time with this..
Benj pls can u help me in this..
i will set manually config bit like and test it with unchecked "write config on download"...
like this
/*
Enter C code below this comment
*/
#pragma config ??
_CONFIG2(IESO_OFF & PLL_96MHZ_ON & PLLDIV_DIV5 & FNOSC_PRIPLL & POSCMOD_HS) // Primary HS OSC with PLL, USBPLL /3
_CONFIG1(JTAGEN_OFF & ICS_PGx2 & FWDTEN_OFF) // JTAG off, watchdog timer off
--
can i append a makro for c at begin for this and how i can set the config bit in the code..
i think i must rename the "variable" to fc variable or can i set it to Chip Bit name.?.
IESO_OFF ..
will be then
Code: Select all
#pragma config IESO=OFF, PLL_96MHZ=ON, PLLDIV=DIV5, FNOSC=PRIPLL, POSCMOD=HS, JTAGEN=OFF, ICS=PGx2, FWDTEN=OFF
and a append question..
if i will append Assembler Code in Flowchart can i do this and can you say me how i go on with this?
btw..with "USBPLL /3" i search but have not found helps in fcdx.....
ty Benj for your help!
Best wishes!
Rudi
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: FC6 PIC24FJ256GB106 USB Serial / HID / Slave not initial
Hello Rudi,
You can enter your config info using the supplementary code window to get the code outside of the executable runtime code. Either pane of the supp code window will work but the top one is probably better as the configs are pretty much treated as defines. All the data should already be there thanks to the compiler so it should all work nicely.
As for inserting assembler you simply use a C icon. Syntax for a line of assembler is like this: asm("MOVLW 0");
More info here: http://www.edaboard.com/thread129118.html
You can enter your config info using the supplementary code window to get the code outside of the executable runtime code. Either pane of the supp code window will work but the top one is probably better as the configs are pretty much treated as defines. All the data should already be there thanks to the compiler so it should all work nicely.
As for inserting assembler you simply use a C icon. Syntax for a line of assembler is like this: asm("MOVLW 0");
More info here: http://www.edaboard.com/thread129118.html
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Re: FC6 PIC24FJ256GB106 USB Serial / HID / Slave not initial
Hi Benj...sorry ... now HID -....
but i think we will catch this ghost...
i am sure..
...
Best wishes..
Rudi
but i think we will catch this ghost...
i am sure..
...
Code: Select all
// Benj can you please check this...
// here stops the compiler with error..
H:\Internet\_____B~2\benj\PIC24>pic30-gcc -c -mcpu="24FJ256GB106" -funsigned-char -fno-short-double -Os -I"C:\PROGRA~1\FLOWCO~2\COMPIL~1\pic16\BATCHF~1\..\support\h" -I"C:\PROGRA~1\FLOWCO~2\COMPIL~1\pic16\BATCHF~1\..\MX_support" -Wall -std=gnu99 "testNix-HID2".c -o "testNix-HID2".o
testNix-HID2.c: In function 'FCD_06fa1_USB_HID1__SetSerialNumber':
testNix-HID2.c:339: warning: unused variable 'FCL_J'
testNix-HID2.c:338: warning: unused variable 'FCL_I'
testNix-HID2.c: In function 'FCD_06fa1_USB_HID1__ReceiveString':
testNix-HID2.c:490: warning: unused variable 'FCL_IDX'
testNix-HID2.c: In function 'FCD_06fa1_USB_HID1__Initialise':
testNix-HID2.c:626: error: 'delay_counter' undeclared (first use in this function)
testNix-HID2.c:626: error: (Each undeclared identifier is reported only once
testNix-HID2.c:626: error: for each function it appears in.)
Error returned from [pic30-gcc.exe]
Completed compilation, return = 1
C:\Programme\Flowcode 6\compilers\pic16\batchfiles\pic16_C30_comp.bat reported error code 1
FINISHED
// *********************
#ifdef MX_CAL_PIC16BIT //16-bit PIC specific
USBOutHandle = 0;
USBInHandle = 0;
USBDeviceInit();
USBDeviceAttach();
#endif
#if (1) // 1 == 1
#ifdef MX_CAL_PIC //8-bit PIC specific
while(HID_USB_status == 0 && delay_counter < 10000) //Wait for USB to startup and enumerate
#else //16-bit PIC specific
while(USBDeviceState != CONFIGURED_STATE && delay_counter < 10000) //Wait for USB to startup and enumerate
#endif
{
// *****************************************
// 626 // ....*********
FCI_DELAYBYTE_MS(10); // ......**********
// .... ******************
FCL_DELAY_COUNTER = FCL_DELAY_COUNTER + 1; // ....***************************
// *******************************************************************************************************
}
#ifdef MX_CAL_PIC //8-bit PIC specific
if (HID_USB_status == 1)
#else //16-bit PIC specific
if (USBDeviceState == CONFIGURED_STATE)
#endif
return 0;
FCR_RETVAL = 255;
#else
//Code has been optimised out by the pre-processor
#endif
return (FCR_RETVAL);
Rudi
Re: FC6 PIC24FJ256GB106 USB Serial / HID / Slave not initial
Sorry for Push,
Hi Benj,
i have read more this weekend in Datasheets and USB Framework but i am not sure..
Benj - is it possible. that the PIC24FJ256GB106 for USB need a "USBWakeFromSuspend" in the Macro Initialise, too?
I read from USBSuspend() and USBWakeFromSuspend() in the StarterKit Demo from Microchip..
Do you can please check the USBDeviceInit() routine, i think the USB still come up and the CDC driver is initialise ..
if i open the com port in Windows.. and give a return by push Enter, the cursor will prompt next line after a duration ca. 4-5 sec
the usbSendstring is not come up from the PIC.. i think the "USB Worker" still sleeps
.. i think the "USBWakeFromSuspend" routine is missed..or do not come to work..
btw:
if the timimg ( speed clock CPU ) set lees 32000000 ( 12000000) the CDC is still frozen after two returns...
..
TY
Best wishes!
Rudi
Hi Benj,
i have read more this weekend in Datasheets and USB Framework but i am not sure..
Benj - is it possible. that the PIC24FJ256GB106 for USB need a "USBWakeFromSuspend" in the Macro Initialise, too?
I read from USBSuspend() and USBWakeFromSuspend() in the StarterKit Demo from Microchip..
Do you can please check the USBDeviceInit() routine, i think the USB still come up and the CDC driver is initialise ..
if i open the com port in Windows.. and give a return by push Enter, the cursor will prompt next line after a duration ca. 4-5 sec
the usbSendstring is not come up from the PIC.. i think the "USB Worker" still sleeps
.. i think the "USBWakeFromSuspend" routine is missed..or do not come to work..
btw:
if the timimg ( speed clock CPU ) set lees 32000000 ( 12000000) the CDC is still frozen after two returns...
..
TY
Best wishes!
Rudi
Re: FC6 PIC24FJ256GB106 USB Serial / HID / Slave not initial
Hi Benj,
if you have a little "time window"..
how is the Timing for USB managed in this?
can it be that is the same Base mistake like in Delay 1s and 1000ms..
http://www.matrixmultimedia.com/mmforum ... 54&t=14797
The Timing in ms is not correct i think.
perhabs this will "sluggish tough" the usb ( i hope that the correct english words google translate me this for "Träge und Zäh" )
best wishes
Rudi
if you have a little "time window"..
how is the Timing for USB managed in this?
can it be that is the same Base mistake like in Delay 1s and 1000ms..
http://www.matrixmultimedia.com/mmforum ... 54&t=14797
The Timing in ms is not correct i think.
perhabs this will "sluggish tough" the usb ( i hope that the correct english words google translate me this for "Träge und Zäh" )
best wishes
Rudi
Re: FC6 PIC24FJ256GB106 USB Serial / HID / Slave not initial
Hi
there is a context for timing bug?
http://www.matrixmultimedia.com/mmforum ... 54&t=14797
regards
Rudi
there is a context for timing bug?
http://www.matrixmultimedia.com/mmforum ... 54&t=14797
regards
Rudi
-
- Valued Contributor
- Posts: 2045
- Joined: Wed Aug 27, 2008 10:31 pm
- Location: Netherlands
- Has thanked: 553 times
- Been thanked: 1081 times
- Contact:
Re: PIC24FJ256GB106 USB Serial/Slave not initialize Timing B
Sorry, I haven't had time to look into USB. I've got Flowcode projects for customers requiring attention.
“Integrity is doing the right thing, even when no one is watching.”
― C.S. Lewis
― C.S. Lewis
No Hurry: PIC24FJ256GB106 USB Serial/Slave No Data Send/Rece
@Leigh
Hi Leigh, you are the USB Specialist
If you have Time next Time.. "not hurry"! only by time!
..
I have search in the USB Serial in PIC24 Issues, can you have a short look about this please:
After USb Serial initialise - In Hardware Properties is shown the COM Port, can connect, but
no data send/receive.
The Result Details in USB View are:
There are 4 Unknown Descriptor.
MaxPower: 0x32 (100 Ma)
100 Ma ? Are this mean with 100mA ( 100 milli Ampere ? or Max availabel )
0x32 are 50 right - this is mean, that 50mA is need?
..
I puzzle, must the "VBUS" expicit after initialise the USB Serial go on automatic or is this done by code Initialize ( USB Serial ) or as a "extra Initialise" ( loop wake up ) ?
The Device BUS Speed looks ok ( Full Speed ) .
Thank you!
Best wishes
Rudi
...
..
...
..
Hi Leigh, you are the USB Specialist
If you have Time next Time.. "not hurry"! only by time!
..
I have search in the USB Serial in PIC24 Issues, can you have a short look about this please:
After USb Serial initialise - In Hardware Properties is shown the COM Port, can connect, but
no data send/receive.
The Result Details in USB View are:
There are 4 Unknown Descriptor.
MaxPower: 0x32 (100 Ma)
100 Ma ? Are this mean with 100mA ( 100 milli Ampere ? or Max availabel )
0x32 are 50 right - this is mean, that 50mA is need?
..
I puzzle, must the "VBUS" expicit after initialise the USB Serial go on automatic or is this done by code Initialize ( USB Serial ) or as a "extra Initialise" ( loop wake up ) ?
The Device BUS Speed looks ok ( Full Speed ) .
Thank you!
Best wishes
Rudi
Code: Select all
Device Descriptor:
bcdUSB: 0x0200
bDeviceClass: 0x02
bDeviceSubClass: 0x00
bDeviceProtocol: 0x00
bMaxPacketSize0: 0x08 (8)
idVendor: 0x12BF
idProduct: 0xF010
bcdDevice: 0x0100
iManufacturer: 0x01
0x0409: "Flowcode USB Serial"
iProduct: 0x02
0x0409: "Matrix Multimedia Ltd."
iSerialNumber: 0x00
bNumConfigurations: 0x01
ConnectionStatus: DeviceConnected
Current Config Value: 0x01
Device Bus Speed: Full
Device Address: 0x03
Open Pipes: 3
Endpoint Descriptor:
bEndpointAddress: 0x82
Transfer Type: Interrupt
wMaxPacketSize: 0x0008 (8)
bInterval: 0x02
Endpoint Descriptor:
bEndpointAddress: 0x03
Transfer Type: Bulk
wMaxPacketSize: 0x0040 (64)
bInterval: 0x00
Endpoint Descriptor:
bEndpointAddress: 0x83
Transfer Type: Bulk
wMaxPacketSize: 0x0040 (64)
bInterval: 0x00
Code: Select all
Configuration Descriptor:
wTotalLength: 0x0043
bNumInterfaces: 0x02
bConfigurationValue: 0x01
iConfiguration: 0x00
bmAttributes: 0xC0 (Bus Powered Self Powered )
MaxPower: 0x32 (100 Ma)
Code: Select all
Interface Descriptor:
bInterfaceNumber: 0x00
bAlternateSetting: 0x00
bNumEndpoints: 0x01
bInterfaceClass: 0x02
bInterfaceSubClass: 0x02
bInterfaceProtocol: 0x01
iInterface: 0x00
Code: Select all
Unknown Descriptor:
bDescriptorType: 0x24
bLength: 0x05
05 24 00 10 01
Unknown Descriptor:
bDescriptorType: 0x24
bLength: 0x04
04 24 02 02
Unknown Descriptor:
bDescriptorType: 0x24
bLength: 0x05
05 24 06 00 01
Unknown Descriptor:
bDescriptorType: 0x24
bLength: 0x05
05 24 01 00 01
Code: Select all
Endpoint Descriptor:
bEndpointAddress: 0x82
Transfer Type: Interrupt
wMaxPacketSize: 0x0008 (8)
bInterval: 0x02
Interface Descriptor:
bInterfaceNumber: 0x01
bAlternateSetting: 0x00
bNumEndpoints: 0x02
bInterfaceClass: 0x0A
bInterfaceSubClass: 0x00
bInterfaceProtocol: 0x00
iInterface: 0x00
Endpoint Descriptor:
bEndpointAddress: 0x03
Transfer Type: Bulk
wMaxPacketSize: 0x0040 (64)
bInterval: 0x00
Endpoint Descriptor:
bEndpointAddress: 0x83
Transfer Type: Bulk
wMaxPacketSize: 0x0040 (64)
bInterval: 0x00
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: PIC24FJ256GB106 USB Serial/Slave not initialize Timing B
Hello,
The current is specified in multiples of 2mA so 1 = 2mA, 2 = 4mA, 250 = 500mA etc.
The current specified is the max the USB can supply in milli Amps. If the connected device tries to draw more current then the connection to the device will likely be severed.100 Ma ? Are this mean with 100mA ( 100 milli Ampere ? or Max availabel )
0x32 are 50 right - this is mean, that 50mA is need?
The current is specified in multiples of 2mA so 1 = 2mA, 2 = 4mA, 250 = 500mA etc.
Not sure what you mean by this, if you like you can post in German and we will try and translate here.I puzzle, must the "VBUS" expicit after initialise the USB Serial go on automatic or is this done by code Initialize ( USB Serial ) or as a "extra Initialise" ( loop wake up ) ?
The Device BUS Speed looks ok ( Full Speed ) .
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Re: PIC24FJ256GB106 USB Serial/Slave not initialize Timing B
Thank you Benj, then is this clear. I have think this only 50mA. Thank you for teach this!Benj wrote: ..
The current specified is the max the USB can supply in milli Amps. If the connected device tries to draw more current then the connection to the device will likely be severed.
The current is specified in multiples of 2mA so 1 = 2mA, 2 = 4mA, 250 = 500mA etc.
sorry Benj, i mean the "Ranking".."Expiration" .."Idle USB bus" if Data / no Data at USB Bus. ..who or what is the manager for Interupt "New Data availabel.Benj wrote:Not sure what you mean by this, if you like you can post in German and we will try and translate here.I puzzle, must the "VBUS" expicit after initialise the USB Serial go on automatic or is this done by code Initialize ( USB Serial ) or as a "extra Initialise" ( loop wake up ) ?
The Device BUS Speed looks ok ( Full Speed ) .
Is the USB Bus automatic go sleep if no Data send/receive.
I think there is a period ticky that looks for data from Host, if so, then check the "manager" is USB Bus Free, if so, then "manager" will "put(s)USART..."
...
Benj, no hurry! This is the best way to learn how USB works if you have a good USB Link for learn more functionally i will thank you for this.
I only post a parallel Info to a State with a example Code MPLAP Demo ..perhhabs
I have little read ( add main.c ) in the Demo Code with LCD, Switch Menue and a MNU_Item is "UART" ( CDC ) and test it with the Pic24 Board after Hex upload with Pickit3.
After Start:
If select the UART_Item, then USB CDC will initialise and in Windows a Com Port is Create. ( on_the_fly ) this work. fine. ( Same like FC6 USB Serial simple Project )
With Terminal can connect the Com Port ( same in FC6 Example ) and Data can send likewise a little Telnet Programm and the Mikrocontroller is answere. ( This is not work in FC6 Example )
Then, ( Benj i think here is the search Point )
With Terminal it can be disconnect and reconnect and send and receive data in the Demo.
But
If select menu back to "Main" ..
the Comport is still availabel in Windows, a try to reconnect is possible but not data send/receive again.
And this "State" ( Status, Zustand, Leerlauf, Sleep Mode? ) is the same after a simple USB Serial Flowchart start.
..The USB is initialized, the comport is created, the Terminal can connect, but no Data are received, Data can be send in Terminal, but no Reaction at Mikrocontroller.
/b]
Perhabs, I have mean, perhabs because the parallel Issues, perhabs a Function / a doing is missed in USB Serial for Pic24? ( wake up?, Pins setting?..Timer Interupt for looking Data at Bus..USBAtach Flag?.. )
In the Demo there is a Menu Code for the UART like this:
I have marked the Uart Point..
Benj, no hurry -
allways i have a little Time more for play with this i try the PIC24 USB Slave.. and i mean.. "i found the issues" now ...
Why this don*t receive / don't send
Is there a possible to debug the Com port? Perhabs Data send/receive but Baudrate fail?.. ..i will test more ..
No Hurry Benj!
----------------
Best wishes
Rudi
Code: Select all
//******************************************************************************
//******************************************************************************
// Main Application
//******************************************************************************
//******************************************************************************
int main( void )
{
//******************************Varies******************************************
//******************************Oscillator Setting******************************
OSCCON = 0x3302; // Enable secondary oscillator
CLKDIV = 0x0000; // Set PLL prescaler (1:1)
//******************************LCD Test****************************************
//Inilitialize Buttons
ButtonInit();
// Initialize the RTCC
RTCCInit();
//Light LCD
LightLCD();
//Inilitialize LCD
InitLCDPins();
InitByInstru();
// Initialize the reference timer.
TickInit();
// Initialize the SPI Flash
initSPIFlash();
//LCD Output
while(1)
{
ButtonsMsg();
DisplayLCD();
}
return 0;
}
//******************************************************************************
//******************************************************************************
// Function
//******************************************************************************
//******************************************************************************
/****************************************************************************
Function:
void DisplayLCD( )
Description:
This function display current LCD information and store previous LCD
information.
Precondition:
None
Parameters:
None
Returns:
None
Remarks:
***************************************************************************/
void DisplayLCD()
{
char lcd_line1[17]={0};
char lcd_line2[17]={0};
int stringLength = 0;
unsigned char writeString[30]={0};
int i = 0;
RTCCProcessEvents();
switch(screenStateCur)
{
case SCREEN_MAIN: //Screen Title
strcpy(lcd_line1,_rtcc_str);
strcpy(lcd_line2,"WIFI WEB DEMO");
Set_Line_Information(1,0,lcd_line1,16);
Set_Line_Information(2,0,lcd_line2,16);
DelayMs(2000);
screenStateCur = SCREEN_MENU_UPGRADE_FW;
strcpy(lcd_line2,"1.Upgrade FW ");
Set_Line_Information(2,0,lcd_line2,16);
LCD_check_busy();
WriteAdress(0x4F);
WriteData(0x7E); //->
break;
case SCREEN_MENU_UPGRADE_FW: //Screen One
if(buttonPress == 1) //Right Button Pressed
{
screenStateCur = SCREEN_MENU_T_SENSOR;
strcpy(lcd_line1,_rtcc_str);
Set_Line_Information(1,0,lcd_line1,16);
strcpy(lcd_line2,"2.T Sensor ");
Set_Line_Information(2,0,lcd_line2,16);
LCD_check_busy();
WriteAdress(0x4E);
WriteData(0x7F); //<-
LCD_check_busy();
WriteAdress(0x4F);
WriteData(0x7E); //->
}
else if(buttonPress == 3) //Middle Button Pressed
{
buttonPress = 0;
gp_function = BOOTLOADER;
strcpy(lcd_line1,"1.Upgrade FW ");
Set_Line_Information(1,0,lcd_line1,16);
strcpy(lcd_line2,"Power with Key !");
Set_Line_Information(2,0,lcd_line2,16);
while(1)
{
ButtonsMsg();
if(buttonPress == 3) //Middle Button
{
buttonPress = 0;
if( gp_function == BOOTLOADER )
{
gp_function = NONEFUNCTION;
}
break;
}
}
strcpy(lcd_line1,_rtcc_str);
Set_Line_Information(1,0,lcd_line1,16);
strcpy(lcd_line2,"1.Upgrade FW ");
Set_Line_Information(2,0,lcd_line2,16);
LCD_check_busy();
WriteAdress(0x4F);
WriteData(0x7E); //->
}
else //No Button Presses,Refresh Time
{
if(previousMinute!=_rtcc_str[15])
{
strcpy(lcd_line1,_rtcc_str);
Set_Line_Information(1,0,lcd_line1,16);
}
}
break;
case SCREEN_MENU_T_SENSOR: //Screen Two
if(buttonPress == 1) //Right Button Pressed
{
screenStateCur = SCREEN_MENU_T_RESISTOR;
strcpy(lcd_line1,_rtcc_str);
Set_Line_Information(1,0,lcd_line1,16);
strcpy(lcd_line2,"3.T Resistor ");
Set_Line_Information(2,0,lcd_line2,16);
LCD_check_busy();
WriteAdress(0x4E);
WriteData(0x7F); //<-
LCD_check_busy();
WriteAdress(0x4F);
WriteData(0x7E); //->
}
else if(buttonPress == 2) //Left Button Pressed
{
screenStateCur = SCREEN_MENU_UPGRADE_FW;
strcpy(lcd_line1,_rtcc_str);
Set_Line_Information(1,0,lcd_line1,16);
strcpy(lcd_line2,"1.Upgrade FW ");
Set_Line_Information(2,0,lcd_line2,16);
LCD_check_busy();
WriteAdress(0x4F);
WriteData(0x7E); //->
}
else if(buttonPress == 3) //Middle Button Pressed
{
strcpy(lcd_line1,"2.T Sensor ");
Set_Line_Information(1,0,lcd_line1,16);
gp_function = TSENSOR;
InitTemperatureSensor();
SensorFirstTime = 1;
while(1)
{
strcpy(lcd_line2,"");
getTemperatureSensor(lcd_line2);
stringLength = strlen(lcd_line2);
if(stringLength > 0)
{
strcpy(writeString,lcd_line2);
lcd_line2[stringLength] = '0';
while( stringLength < LCDLENGTH)
{
lcd_line2[stringLength] = ' ';
stringLength++;
}
Set_Line_Information(2,0,lcd_line2,16);
}
ButtonsMsg();
if(buttonPress == 2) //Left Button
{
buttonPress = 0;
strcat(writeString," \0");
stringLength = strlen(writeString);
for( i = 0; i < 16; i++)
{
writeString[stringLength] = _rtcc_str[i];
stringLength ++;
}
writeString[stringLength] = '\0';
Nop();Nop();Nop();Nop();Nop();
StrWrite(writeString,TEMP_SENSOR_BASE_ADDRESS);
Nop();Nop();Nop();Nop();Nop();
}
if(buttonPress == 3) //Middle Button
{
buttonPress = 0;
if( gp_function == TSENSOR )
{
gp_function = NONEFUNCTION;
}
break;
}
}
strcpy(lcd_line1,_rtcc_str);
Set_Line_Information(1,0,lcd_line1,16);
strcpy(lcd_line2,"2.T Sensor ");
Set_Line_Information(2,0,lcd_line2,16);
LCD_check_busy();
WriteAdress(0x4E);
WriteData(0x7F); //<-
LCD_check_busy();
WriteAdress(0x4F);
WriteData(0x7E); //->
}
else //No Button Presses,Refresh Time
{
if(previousMinute!=_rtcc_str[15])
{
strcpy(lcd_line1,_rtcc_str);
Set_Line_Information(1,0,lcd_line1,16);
}
}
break;
case SCREEN_MENU_T_RESISTOR: //Screen Three
if(buttonPress == 1) //Right Button Pressed
{
screenStateCur = SCREEN_MENU_UART;
strcpy(lcd_line1,_rtcc_str);
Set_Line_Information(1,0,lcd_line1,16);
strcpy(lcd_line2,"4.UART ");
Set_Line_Information(2,0,lcd_line2,16);
LCD_check_busy();
WriteAdress(0x4F); //<-
WriteData(0x7F);
}
else if(buttonPress == 2) //Left Button Pressed
{
screenStateCur = SCREEN_MENU_T_SENSOR;
strcpy(lcd_line1,_rtcc_str);
Set_Line_Information(1,0,lcd_line1,16);
strcpy(lcd_line2,"2.T Sensor ");
Set_Line_Information(2,0,lcd_line2,16);
LCD_check_busy();
WriteAdress(0x4E);
WriteData(0x7F); //<-
LCD_check_busy();
WriteAdress(0x4F);
WriteData(0x7E); //->
}
else if(buttonPress == 3) //Middle Button Pressed
{
strcpy(lcd_line1,"3.T Resistor ");
Set_Line_Information(1,0,lcd_line1,16);
strcpy(lcd_line2,"Refer To LED ...");
Set_Line_Information(2,0,lcd_line2,16);
gp_function = TRESISTOR;
openDigitalDisplay();
temperatureResistorFunction();
closeDigitalDisplay();
temperature_resistor = 0;
old_temperature_resistor = 0;
strcpy(lcd_line1,_rtcc_str);
Set_Line_Information(1,0,lcd_line1,16);
strcpy(lcd_line2,"3.T Resistor ");
Set_Line_Information(2,0,lcd_line2,16);
LCD_check_busy();
WriteAdress(0x4E);
WriteData(0x7F); //<-
LCD_check_busy();
WriteAdress(0x4F);
WriteData(0x7E); //->
}
else //No Button Presses,Refresh Time
{
if(previousMinute!=_rtcc_str[15])
{
strcpy(lcd_line1,_rtcc_str);
Set_Line_Information(1,0,lcd_line1,16);
}
}
break;
UART Menu ( USB CDC )
Code: Select all
case SCREEN_MENU_UART:
if(buttonPress == 2) //Left Button Pressed
{
screenStateCur = SCREEN_MENU_T_RESISTOR;
strcpy(lcd_line1,_rtcc_str);
Set_Line_Information(1,0,lcd_line1,16);
strcpy(lcd_line2,"3.T Resistor ");
Set_Line_Information(2,0,lcd_line2,16);
LCD_check_busy();
WriteAdress(0x4E);
WriteData(0x7F); //<-
LCD_check_busy();
WriteAdress(0x4F);
WriteData(0x7E); //->
}
else if(buttonPress == 3) //Middle Button Pressed
{
strcpy(lcd_line1,"4.UART ");
Set_Line_Information(1,0,lcd_line1,16);
strcpy(lcd_line2,"UART...... ");
Set_Line_Information(2,0,lcd_line2,16);
now UART USB CDC will "init and comport in windows are availabel
with this..
#########################################################################
Code: Select all
gp_function = USBTOUART;
USBToUARTFunction();
Code: Select all
screenStateCur = SCREEN_MENU_UART;
strcpy(lcd_line1,_rtcc_str);
Set_Line_Information(1,0,lcd_line1,16);
strcpy(lcd_line2,"4.UART ");
Set_Line_Information(2,0,lcd_line2,16);
LCD_check_busy();
WriteAdress(0x4F); //<-
WriteData(0x7F);
}
else //No Button Presses,Refresh Time
{
if(previousMinute!=_rtcc_str[15])
{
strcpy(lcd_line1,_rtcc_str);
Set_Line_Information(1,0,lcd_line1,16);
}
}
break;
default:
break;
}
buttonPress = 0;
previousMinute = _rtcc_str[15];
return;
}
The "Flag" gp_function = USBTOUART;
is set, then USBToUARTFunction();
is call.
In the USBToUARTFunction();
Code: Select all
/********************************************************************
* Function: void USBToUARTFunction(void)
*
* PreCondition: enter into the function of UART
*
* Input: None
*
* Output: None
*
* Side Effects: None
*
* Overview: USBToUARTFunction funtion enables the system to
* responde to the UART Commands from USB Mini-B
*
* Note: None
*******************************************************************/
void USBToUARTFunction(void)
{
InitializeCommand();
InitializeSystem();
#if defined(USB_INTERRUPT)
USBDeviceAttach();
#endif
while(1)
{
#if defined(USB_POLLING)
// Check bus status and service USB interrupts.
USBDeviceTasks(); // Interrupt or polling method. If using polling, must call
// this function periodically. This function will take care
// of processing and responding to SETUP transactions
// (such as during the enumeration process when you first
// plug in). USB hosts require that USB devices should accept
// and process SETUP packets in a timely fashion. Therefore,
// when using polling, this function should be called
// frequently (such as once about every 100 microseconds) at any
// time that a SETUP packet might reasonably be expected to
// be sent by the host to your device. In most cases, the
// USBDeviceTasks() function does not take very long to
// execute (~50 instruction cycles) before it returns.
#endif
// Application-specific tasks.
// Application related code may be added here, or in the ProcessIO() function.
ProcessIO();
ButtonsMsg();
if(buttonPress == 3)
{
buttonPress = 0;
if( gp_function == USBTOUART )
{
gp_function = NONEFUNCTION;
}
break;
}
}//end while
return;
}
The Ranking
InitializeCommand();
InitializeSystem();
and... #if defined(USB_INTERRUPT)
USBDeviceAttach();
Code: Select all
/****************************************************************************
Function:
void InitializeCommand( void )
Description:
This function prints a command prompt and initializes the command line
information.
Precondition:
None
Parameters:
None
Returns:
None
Remarks:
None
***************************************************************************/
void InitializeCommand( void )
{
commandInfo.command = COMMAND_NO_COMMAND;
commandInfo.index = 0;
commandInfo.putsNext = 0;
commandInfo.reading = TRUE;
commandInfo.sending = FALSE;
memset( commandInfo.buffer, 0x00, MAX_COMMAND_LENGTH );
return;
}
/****************************************************************************
Code: Select all
/********************************************************************
* Function: static void InitializeSystem(void)
*
* PreCondition: None
*
* Input: None
*
* Output: None
*
* Side Effects: None
*
* Overview: InitializeSystem is a centralize initialization
* routine. All required USB initialization routines
* are called from here.
*
* User application initialization routine should
* also be called from here.
*
* Note: None
*******************************************************************/
static void InitializeSystem(void)
{
#if (defined(__18CXX) & !defined(PIC18F87J50_PIM))
ADCON1 |= 0x0F; // Default all pins to digital
#elif defined(__C30__)
AD1PCFG = 0xFFFF;
#elif defined(__C32__)
AD1PCFG = 0xFFFF;
#endif
#if defined(PIC18F87J50_PIM) || defined(PIC18F46J50_PIM) || defined(PIC18F_STARTER_KIT_1)
//On the PIC18F87J50 Family of USB microcontrollers, the PLL will not power up and be enabled
//by default, even if a PLL enabled oscillator configuration is selected (such as HS+PLL).
//This allows the device to power up at a lower initial operating frequency, which can be
//advantageous when powered from a source which is not gauranteed to be adequate for 48MHz
//operation. On these devices, user firmware needs to manually set the OSCTUNE<PLLEN> bit to
//power up the PLL.
{
unsigned int pll_startup_counter = 600;
OSCTUNEbits.PLLEN = 1; //Enable the PLL and wait 2+ms until the PLL locks before enabling USB module
while(pll_startup_counter--);
}
//Device switches over automatically to PLL output after PLL is locked and ready.
#endif
#if defined(PIC18F87J50_PIM)
//Configure all I/O pins to use digital input buffers. The PIC18F87J50 Family devices
//use the ANCONx registers to control this, which is different from other devices which
//use the ADCON1 register for this purpose.
WDTCONbits.ADSHR = 1; // Select alternate SFR location to access ANCONx registers
ANCON0 = 0xFF; // Default all pins to digital
ANCON1 = 0xFF; // Default all pins to digital
WDTCONbits.ADSHR = 0; // Select normal SFR locations
#endif
#if defined(PIC18F46J50_PIM) || defined(PIC18F_STARTER_KIT_1)
//Configure all I/O pins to use digital input buffers. The PIC18F87J50 Family devices
//use the ANCONx registers to control this, which is different from other devices which
//use the ADCON1 register for this purpose.
ANCON0 = 0xFF; // Default all pins to digital
ANCON1 = 0xFF; // Default all pins to digital
#endif
#if defined(PIC24FJ64GB004_PIM)
//On the PIC24FJ64GB004 Family of USB microcontrollers, the PLL will not power up and be enabled
//by default, even if a PLL enabled oscillator configuration is selected (such as HS+PLL).
//This allows the device to power up at a lower initial operating frequency, which can be
//advantageous when powered from a source which is not gauranteed to be adequate for 32MHz
//operation. On these devices, user firmware needs to manually set the CLKDIV<PLLEN> bit to
//power up the PLL.
{
unsigned int pll_startup_counter = 600;
CLKDIVbits.PLLEN = 1;
while(pll_startup_counter--);
}
//Device switches over automatically to PLL output after PLL is locked and ready.
#endif
// The USB specifications require that USB peripheral devices must never source
// current onto the Vbus pin. Additionally, USB peripherals should not source
// current on D+ or D- when the host/hub is not actively powering the Vbus line.
// When designing a self powered (as opposed to bus powered) USB peripheral
// device, the firmware should make sure not to turn on the USB module and D+
// or D- pull up resistor unless Vbus is actively powered. Therefore, the
// firmware needs some means to detect when Vbus is being powered by the host.
// A 5V tolerant I/O pin can be connected to Vbus (through a resistor), and
// can be used to detect when Vbus is high (host actively powering), or low
// (host is shut down or otherwise not supplying power). The USB firmware
// can then periodically poll this I/O pin to know when it is okay to turn on
// the USB module/D+/D- pull up resistor. When designing a purely bus powered
// peripheral device, it is not possible to source current on D+ or D- when the
// host is not actively providing power on Vbus. Therefore, implementing this
// bus sense feature is optional. This firmware can be made to use this bus
// sense feature by making sure "USE_USB_BUS_SENSE_IO" has been defined in the
// HardwareProfile.h file.
#if defined(USE_USB_BUS_SENSE_IO)
tris_usb_bus_sense = INPUT_PIN; // See HardwareProfile.h
#endif
// If the host PC sends a GetStatus (device) request, the firmware must respond
// and let the host know if the USB peripheral device is currently bus powered
// or self powered. See chapter 9 in the official USB specifications for details
// regarding this request. If the peripheral device is capable of being both
// self and bus powered, it should not return a hard coded value for this request.
// Instead, firmware should check if it is currently self or bus powered, and
// respond accordingly. If the hardware has been configured like demonstrated
// on the PICDEM FS USB Demo Board, an I/O pin can be polled to determine the
// currently selected power source. On the PICDEM FS USB Demo Board, "RA2"
// is used for this purpose. If using this feature, make sure "USE_SELF_POWER_SENSE_IO"
// has been defined in HardwareProfile.h, and that an appropriate I/O pin has been mapped
// to it in HardwareProfile.h.
#if defined(USE_SELF_POWER_SENSE_IO)
tris_self_power = INPUT_PIN; // See HardwareProfile.h
#endif
UserInit();
USBDeviceInit(); //usb_device.c. Initializes USB module SFRs and firmware
//variables to known states.
}//end InitializeSystem
Code: Select all
/**************************************************************************
Function:
void USBDeviceAttach(void)
Description:
Precondition:
//For normal USB devices:
//Make sure that if the module was previously on, that it has been turned off
//for a long time (ex: 100ms+) before calling this function to re-enable the module.
//If the device turns off the D+ (for full speed) or D- (for low speed) ~1.5k ohm
//pull up resistor, and then turns it back on very quickly, common hosts will sometimes
//reject this event, since no human could ever unplug and reattach a USB device in a
//microseconds (or nanoseconds) timescale. The host could simply treat this as some kind
//of glitch and ignore the event altogether.
Parameters:
None
Return Values:
None
Remarks:
None
**************************************************************************/
void USBDeviceAttach(void)
{
//if we are in the detached state
if(USBDeviceState == DETACHED_STATE)
{
//Initialize registers to known states.
U1CON = 0;
// Mask all USB interrupts
U1IE = 0;
//Configure things like: pull ups, full/low-speed mode,
//set the ping pong mode, and set internal transceiver
SetConfigurationOptions();
USBEnableInterrupts();
// Enable module & attach to bus
while(!U1CONbits.USBEN){U1CONbits.USBEN = 1;}
//moved to the attached state
USBDeviceState = ATTACHED_STATE;
#ifdef USB_SUPPORT_OTG
U1OTGCON = USB_OTG_DPLUS_ENABLE | USB_OTG_ENABLE;
#endif
}
}
#endif //#if defined(USB_INTERRUPT)
Re: PIC24FJ256GB106 USB Serial/Slave not initialize Timing B
Hi guys
buggy is back
I Debug USB
Can u Please check the PIC24 USB Serial ..
I added three Files:
Simple FC6 Project with USB Serial
================================
Start
wait 5 sec
USB Serial Init
enum this 10 sec
wait 5 sec
then goes in the loop
USB Serial Read String (255,3)
This i test with Pic18F2550
it runs like clockwork
This i test with Pic24FJ256GB106
it runs not 100 procent ..
USB is initialize
Virtuell Com Port is Create in Win
Term can connect
Term can disconnect
Term can reconnect
Term Send 123
Send is outgoing Succesfull
Term Send 456
USB is Pending
..
..
Term is disconect Successfull
Board is removes Successfull
I add DEBUG Log of USB in CSV
For reason " The extension csv is not allowed "
i added a "zip" and the end. Please remove the added ".zip"
You can import in Excel or other Calc Prog.
The Timing is nonstop
only next New Step is paused..
Info:
The Procedure are in all two the same
A) Starting protocol debug
B) Connect the Board with USB and PC
C) Connect TERMINAL to USB Virtuell COM PORT
D) SEND 123 ( + CR + LF )
E) SEND 456 ( + CR + LF )
F) SEND 789 ( + CR + LF )
G) Disconnect TERMINAL from USB Virtuell COM PORT
H) Remove the Board from USB and PC
The candidate:
Pic18F2550
Pic24FJ256GB106
The Shorts DEBUGS LOG are:
( Please look in the CSV Files this is very helpfull work to find the mistake..
The Start Procdure in PIC24 is longer
The Difference you can see at 128 - 134 in PIC24 Log
The compare each row 0 - 127 (134 ) with the Log of PIC18 is very helpfull to find the problem.
128 - 134 is to much in USB Serial in PIC24 ? ..
I think there is one procedure in USB Initialise in PIC 24 to much ../ just in time at wrong place / Sequence wrong.
..
have you see and found this in pic24 at sq ..
Thank You!
Best wishes.
Rudi
buggy is back
I Debug USB
Can u Please check the PIC24 USB Serial ..
I added three Files:
Simple FC6 Project with USB Serial
================================
Start
wait 5 sec
USB Serial Init
enum this 10 sec
wait 5 sec
then goes in the loop
USB Serial Read String (255,3)
This i test with Pic18F2550
it runs like clockwork
This i test with Pic24FJ256GB106
it runs not 100 procent ..
USB is initialize
Virtuell Com Port is Create in Win
Term can connect
Term can disconnect
Term can reconnect
Term Send 123
Send is outgoing Succesfull
Term Send 456
USB is Pending
..
..
Term is disconect Successfull
Board is removes Successfull
I add DEBUG Log of USB in CSV
For reason " The extension csv is not allowed "
i added a "zip" and the end. Please remove the added ".zip"
You can import in Excel or other Calc Prog.
The Timing is nonstop
only next New Step is paused..
Info:
The Procedure are in all two the same
A) Starting protocol debug
B) Connect the Board with USB and PC
C) Connect TERMINAL to USB Virtuell COM PORT
D) SEND 123 ( + CR + LF )
E) SEND 456 ( + CR + LF )
F) SEND 789 ( + CR + LF )
G) Disconnect TERMINAL from USB Virtuell COM PORT
H) Remove the Board from USB and PC
The candidate:
Pic18F2550
Pic24FJ256GB106
The Shorts DEBUGS LOG are:
( Please look in the CSV Files this is very helpfull work to find the mistake..
The Start Procdure in PIC24 is longer
The Difference you can see at 128 - 134 in PIC24 Log
The compare each row 0 - 127 (134 ) with the Log of PIC18 is very helpfull to find the problem.
128 - 134 is to much in USB Serial in PIC24 ? ..
I think there is one procedure in USB Initialise in PIC 24 to much ../ just in time at wrong place / Sequence wrong.
..
have you see and found this in pic24 at sq ..
Code: Select all
START Debug Log ;-).................................................
-----------------------------------------------------------------------------------------------------------------------------------------------------------------
PIC 18 F 2550.............................................................||||||||...................PIC24FJ256GB106
==========================================================================================================================
Seq What Info TIME ......
0 A)
B)
1..
..
127 SUCCESS.............................!!!!!!!!!!!.......134 SUCCESS
C)
339 SUCCESS...............................................346 SUCCESS
D)
343 SUCCESS...............................................350 SUCCESS
E)
347 SUCCESS...............................................353 PENDING <<<<<<----------!!!
F)
351 SUCCESS...............................................!!! No Reaction <<<<<---------!!!
G)
355 SUCCESS..............................................358 SUCCESS
H)
369 SUCCESS..............................................372 SUCCESS
Best wishes.
Rudi
Last edited by Rudi on Tue Jul 01, 2014 2:37 pm, edited 2 times in total.
Re: PIC24FJ256GB106 USB Serial/Slave not initialize Timing B
..push..
The PIC24 Project i added because only 3 files are allowed
The FIle Name Flowcode3...
is only Debug Item ..3..
I make this with FC6
Best wishes
Rudi
The PIC24 Project i added because only 3 files are allowed
The FIle Name Flowcode3...
is only Debug Item ..3..
I make this with FC6
Best wishes
Rudi
Re: PIC24FJ256GB106 USB Serial/Slave not initialize Timing B
Hi MM Stuff
i think in PIC24 USB Serial Init..
See please at pics
LEFT SIDE = PIC18 F 2550 -
RIGHT SIDE = PIC24 FJ 256 GB 106
PIC1
in sq: 8..9..10..11..12
is the Sequence in PIC24 wrong.
here is missed the procedure for init the device...
QUERY_ID
QUERY_ID
..
QUERY DEVICE Text
But will Get_Description_from_Device...
this comes to early!
PIC2..
in sq: 34 / 35
then Returns false status ..
never init right.. / ..
Hope this helps to find the problem now!
Best thank.
Best wishes.
Rudi
i am outside.
i think in PIC24 USB Serial Init..
See please at pics
LEFT SIDE = PIC18 F 2550 -
RIGHT SIDE = PIC24 FJ 256 GB 106
PIC1
in sq: 8..9..10..11..12
is the Sequence in PIC24 wrong.
here is missed the procedure for init the device...
QUERY_ID
QUERY_ID
..
QUERY DEVICE Text
But will Get_Description_from_Device...
this comes to early!
PIC2..
in sq: 34 / 35
then Returns false status ..
never init right.. / ..
Hope this helps to find the problem now!
Best thank.
Best wishes.
Rudi
i am outside.
Re: PIC24FJ256GB106 USB Serial not initialize wrong Sequence
Hi MM Stuff,
hi Guys,
Final Report
two question at first:
Do you have a PIC24 ( Pic24FJ256GB106 / 110 ) as EBlock / Board that USB Serial is working with FC6 ?
If so - please let me know where i can get.
If you need this Boards i use ( Shure electronic ) for replikate the issues, let me know adress where i can send a unit .
ok - i must finnish this in PIC24 usb serial... More i can not test in this.
The USB Debug Log shows, there is a difference in Initial Sequence.
All my Debugs and Tests i have posted. ( Long Time ;-/ )
The two log files are great help.
I can not find a hint in Cals, Configs in FC or other where i can look in for check the Initialise sequenze of USB Serial.
The Cal Instraction i not know.
I found, the USB Desriptor is a little change Pic18/Pic24
but i think this is not the reason,
I think because RamSize in Pic 18 and Pic 24 the size of endpoint is in Pic24 bigger.
in Pic 18 the size of endpoint3 are 0x8 ( 8 Byte ) and in pic24 0x40 ( 64 Byte ) Sequenze Line 6 + 7
The last 2 xx marked
Descriptor Point Pos 8 + 9
First 2 xx marked
the difference in 80 - C0 i think this is Bus Powered Self Powered ( 0xC0 ) in PIC24
the difference in 64 - 32 i puzzle in MA ( 0x64 = 100 MA (x2) = 200 mA ( PIC18 ) ..... 0x32 = 50 MA ( x2 ) = 100 mA . PIC24 )
one hint i found in VBus / Power sense - but this i can not technical test - my equicment for this is here in the outside room of concern small .
ok guys, i end this and sorry - other too with PIC24 i must wait for a feedback from yours.
( I need the functionally USB Serial / HID for further way )
I will go further in Pic 18.. and then AVR.. Arduino..
i think - if you studdy the Log in USB Start, you know where the issues is and you can replicate now. I hope
A short feedback in Debug Log *.csv Files would be fine.
Thank you!
Best wishes!
Rudi
hi Guys,
Final Report
two question at first:
Do you have a PIC24 ( Pic24FJ256GB106 / 110 ) as EBlock / Board that USB Serial is working with FC6 ?
If so - please let me know where i can get.
If you need this Boards i use ( Shure electronic ) for replikate the issues, let me know adress where i can send a unit .
ok - i must finnish this in PIC24 usb serial... More i can not test in this.
The USB Debug Log shows, there is a difference in Initial Sequence.
All my Debugs and Tests i have posted. ( Long Time ;-/ )
The two log files are great help.
I can not find a hint in Cals, Configs in FC or other where i can look in for check the Initialise sequenze of USB Serial.
The Cal Instraction i not know.
I found, the USB Desriptor is a little change Pic18/Pic24
but i think this is not the reason,
I think because RamSize in Pic 18 and Pic 24 the size of endpoint is in Pic24 bigger.
in Pic 18 the size of endpoint3 are 0x8 ( 8 Byte ) and in pic24 0x40 ( 64 Byte ) Sequenze Line 6 + 7
The last 2 xx marked
Descriptor Point Pos 8 + 9
First 2 xx marked
Code: Select all
PIC18 ./.Pic24
09 02 43 00 02 02 01 00 80 64 09 04 00 00 01 ......05 03 02 08 00 00 07 05 83 02 08 00 00
09 02 43 00 02 02 01 00 C0 32 09 04 00 00 01 ......05 03 02 40 00 00 07 05 83 02 40 00 00
....................... xx xx ............................. xx ..................xx
the difference in 64 - 32 i puzzle in MA ( 0x64 = 100 MA (x2) = 200 mA ( PIC18 ) ..... 0x32 = 50 MA ( x2 ) = 100 mA . PIC24 )
one hint i found in VBus / Power sense - but this i can not technical test - my equicment for this is here in the outside room of concern small .
ok guys, i end this and sorry - other too with PIC24 i must wait for a feedback from yours.
( I need the functionally USB Serial / HID for further way )
I will go further in Pic 18.. and then AVR.. Arduino..
i think - if you studdy the Log in USB Start, you know where the issues is and you can replicate now. I hope
A short feedback in Debug Log *.csv Files would be fine.
Thank you!
Best wishes!
Rudi