Page 1 of 1

USB serial PIC18F2455 compile warning

Posted: Wed Dec 07, 2016 3:15 pm
by radist73
Hi,
Some questions about USBserial ...
1. Compiler give warning message:

Employing 18F2455 errata work-arounds:
* Corrupted fast interrupt shadow registers
. . .

ENC28J60_Example3.c: FCD_056e1_USB_Serial1__ReadByte()
902: return (FCR_RETVAL);
^ (345) unreachable code (warning)

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

2. USBserial cant initialize without connection to PC. Main loop will run only after USB is connected to PC. It is OK?
I think, USB serial is not a first priority device... For example, if USB serial is used only for debugging or device configuration, device need to be started without usb connection, but usb need to be ready for hot connection of PC. What solution may be good for this?
3. attached example contain a 1sec flasher made by TMR0 interrupt, and once per second usb serial send "connection check" text to pc. It works ok. When webserver receive GET command, usbserial must send to terminal message "get received". In real hardware after message "get received" usb will crash. Main loop works, led blinks, web page works, but 1sec test messages and GET messages not working.
Usb start working again only after usb cable disconnecting and terminal program restarting. Is it any bug or my wrong code?
Thanks!

Re: USB serial PIC18F2455 compile warning

Posted: Wed Dec 07, 2016 4:14 pm
by Benj
Hello,

1) The errata workaround warnings are just saying there are known issues on the chip and that the compiler knows how to get around them. Nothing to worry about. The unreachable code one is interesting and I will investigate.

2) The USB component has a property (Enumeration Timout) which allows it to either wait forever (default) or timeout after a number of seconds to allow your program to carry on without USB comms if not plugged in.

3) I'll have a look for you.

Re: USB serial PIC18F2455 compile warning

Posted: Wed Dec 07, 2016 4:38 pm
by radist73
No any result with Enumeration timeout turned to YES and time 0,2,5 or 10 seconds. :( Program will start only after connecting usb to pc once. After disconnecting program stay to run.