Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
18f45k50 Intosc - Fail Usb (cdc) & function Millis slow
24-11-2013, 08:56 PM, (This post was last modified: 24-11-2013, 11:06 PM by psteve.)
#1
18f45k50 Intosc - Fail Usb (cdc) & function Millis slow
Using 18f45k50 with intosc bootloader, I found some problems..

The bootloader is 4.13 and Ide 940.

Compiling and download is perfect, but all the functions in application are slowed.

Millis is x 8

usb does'nt works...

There is a workaround?
...

Tested with bootloader 4.9

Usb works (cdc)
1000 millis look like 200 millis..

...

Tested with bootloader 4.12
1000 millisec = 8000 millisec
usb fail

Huh
Reply
25-11-2013, 09:53 AM,
#2
RE: 18f45k50 Intosc - Fail Usb (cdc) & function Millis slow
Thank you for reporting this problem. I will check this. We keep in touch.
It is easier to complain than it is to do, but it is better to do than it is to complain.
Reply
25-11-2013, 01:33 PM, (This post was last modified: 25-11-2013, 01:34 PM by regis.)
#3
RE: 18f45k50 Intosc - Fail Usb (cdc) & function Millis slow
I think I fixed it.
Please try this new bootloader and replace the main.c file with the one I joined.

.hex   Bootloader_v4.13_18f45k50_INTOSC.hex (Size: 7.13 KB / Downloads: 6)

.c   main.c (Size: 10.92 KB / Downloads: 5)

Once it works for you I will update the svn server.
It is easier to complain than it is to do, but it is better to do than it is to complain.
Reply
25-11-2013, 03:34 PM, (This post was last modified: 25-11-2013, 04:04 PM by psteve.)
#4
RE: 18f45k50 Intosc - Fail Usb (cdc) & function Millis slow
(25-11-2013, 01:33 PM)regis Wrote: Please try this new bootloader and replace the main.c file with the one I joined.
...

With new Hex file & main.c e 944 ide

- Millis works better but is a bit slow (45 cycle instead 60 in a minute).

- CDC works with getkey example, but fails with print-cdc-p8 example.

This is the log:

Board: Pinguino 45k50
Proc: 18f45k50
File: G:\ping\x.4\examples\04.Communication\USB\CDC\printf-cdc-p8.pde
compiling...
compilazione ultimata
code size: 14496 / 29696 bytes (48% used)
1.7 tempo di elaborazione secondi

Pinguino found ...
- with PIC18f45k50 (id=0x5c00)
- with 29696 bytes free (29 KB)
- with USB bootloader v4.13
Uploading user program ...
14496 bytes written.
printf-cdc-p8.hex successfully uploaded
Starting user program ...
_________________________________________________


After this No serial was detected...

Also BlinkLedwithInterrupt doesn't works now...
During compile :

________________________________________________
Board: Pinguino 45k50
Proc: 18f45k50
File: G:\ping\x.4\examples\08.Interrupt\BlinkLedWithInterrupt.pde
compiling...
error line 286 operator '||' has no right operand

error line 319 operator '||' has no right operand

error line 350 operator '||' has no right operand

error while compiling
check highlighted lines in your code
You can review the file stdout (F8) for more information.

____________________________________________________

F8 shows:

_________________________________________________

In file included from G:/ping/x.4/p8/pinguino/core/interrupt.c:54,

from G:\ping\x.4\source\/define.h:8,

from G:\ping\x.4\source\main.c:54:

G:/ping/x.4/p8/pinguino/core/interrupt.h:286:56: error: operator '||' has no right operand

G:/ping/x.4/p8/pinguino/core/interrupt.h:319:54: error: operator '||' has no right operand

G:/ping/x.4/p8/pinguino/core/interrupt.h:350:54: error: operator '||' has no right operand

Processor: 18f4550

sdcc: Calling preprocessor...

sdcc: Generating code...

/dvpt/sdcc/sources/sdcc/src/pic16/main.c:686 setting interrupt vector addresses 0xc00
_________________________________________________


Using easypack903:

Interrupt compile ok, but print-cdc-p8 fails.
Interrupt slow like millis.

I hope this help.

Steve
Reply
25-11-2013, 05:03 PM,
#5
RE: 18f45k50 Intosc - Fail Usb (cdc) & function Millis slow
(25-11-2013, 03:34 PM)psteve Wrote: - Millis works better but is a bit slow (45 cycle instead 60 in a minute).
Please edit oscillator.c, line 171 replace 64000000 by 48000000

(25-11-2013, 03:34 PM)psteve Wrote: - CDC works with getkey example, but fails with print-cdc-p8 example.
Work perfect for me ... Don't forget to hit a key to start.
Are you under Windows or Linux. What Terminal do you use ?

(25-11-2013, 03:34 PM)psteve Wrote: Also BlinkLedwithInterrupt doesn't works now...
Here is a clean interrupt.h but there is still a bug somewhere I didn't find. I'm on it.


.h   interrupt.h (Size: 19.45 KB / Downloads: 4)

.c   oscillator.c (Size: 12.05 KB / Downloads: 5)
It is easier to complain than it is to do, but it is better to do than it is to complain.
Reply
25-11-2013, 05:44 PM, (This post was last modified: 25-11-2013, 06:08 PM by psteve.)
#6
RE: 18f45k50 Intosc - Fail Usb (cdc) & function Millis slow
(25-11-2013, 05:03 PM)regis Wrote:
(25-11-2013, 03:34 PM)psteve Wrote: - CDC works with getkey example, but fails with print-cdc-p8 example.
Work perfect for me ... Don't forget to hit a key to start.
Are you under Windows or Linux. What Terminal do you use ?

Windows 7 with Hyperterminal p.e.

Using print-cdc-p8, no com port available
Using getkey, com20 appears immediatly after start...

With oscillator.c modified millis becomes perfect.
With new Interrupt.h, compile it's ok but after upload it doesn't works.

Steve
Reply
25-11-2013, 09:35 PM,
#7
RE: 18f45k50 Intosc - Fail Usb (cdc) & function Millis slow
(25-11-2013, 05:44 PM)psteve Wrote: With new Interrupt.h, compile it's ok but after upload it doesn't works.
Fixed in rev. 950.
It is easier to complain than it is to do, but it is better to do than it is to complain.
Reply
26-11-2013, 02:55 AM, (This post was last modified: 26-11-2013, 09:41 AM by psteve.)
#8
RE: 18f45k50 Intosc - Fail Usb (cdc) & function Millis slow
With rev 950 & interrupt i have this error:

Board: Pinguino 45k50
Proc: 18f45k50
File: G:\ping\x.4\examples\08.Interrupt\BlinkLedWithInterrupt.pde
compiling...
error line 951 #error "Your processor don't have any Timer4."

error while compiling
check highlighted lines in your code
You can review the file stdout (F8) for more information.


With F8:

in file included from G:\ping\x.4\source\/define.h:11,

from G:\ping\x.4\source\main.c:54:

G:/ping/x.4/p8/pinguino/core/interrupt.c:951:2: error: #error "Your processor don't have any Timer4."

Processor: 18f45k50

sdcc: Calling preprocessor...

sdcc: Generating code...

/dvpt/sdcc/sources/sdcc/src/pic16/main.c:686 setting interrupt vector addresses 0xc00

G:/ping/x.4/p8/pinguino/core/oscillator.c:192: warning 126: unreachable code

G:/ping/x.4/p8/pinguino/core/oscillator.c:192: warning 126: unreachable code

G:/ping/x.4/p8/pinguino/core/oscillator.c:192: warning 126: unreachable code

G:/ping/x.4/p8/pinguino/core/oscillator.c:192: warning 126: unreachable code

G:/ping/x.4/p8/pinguino/core/oscillator.c:192: warning 126: unreachable code

G:/ping/x.4/p8/pinguino/core/oscillator.c:196: warning 126: unreachable code

G:/ping/x.4/p8/pinguino/core/oscillator.c:196: warning 126: unreachable code

G:/ping/x.4/p8/pinguino/core/oscillator.c:196: warning 126: unreachable code

G:/ping/x.4/p8/pinguino/core/oscillator.c:196: warning 126: unreachable code

G:/ping/x.4/p8/pinguino/core/oscillator.c:233: warning 85: in function System_getCpuFrequency unreferenced local variable : 'CPUDIV_XTAL'

G:/ping/x.4/p8/pinguino/core/oscillator.c:233: warning 85: in function System_getCpuFrequency unreferenced local variable : 'fosc'




Checking printf-cdc-p8...
if i delete function setup contents a new serial port com20 appears...
Maybe something related to printf function.
Using this reduced setup works...

CDC.getKey();

CDC.printf("string = %s\r\n", string);
//CDC.printf("character = \"%c\"\r\n", c);
/*CDC.printf("signed char = %d / unsigned char = %u\r\n", -c, -c);
CDC.printf("signed int = %d / unsigned int = %u\r\n", -i, -i);
CDC.printf("signed long = %ld / unsigned long = %lu\r\n", -l, -l);
*/
//CDC.printf("decimal[%d] = hexa[0x%X] ",i,i);
//CDC.printf("= binary[0b%016b] = octal[%o]\r\n", i,i);

CDC.printf("float = %f\r\n", f);
//CDC.printf("justif: \"%10s\"\r\n", "right");
//CDC.printf(" 3: %04d zero padded\r\n", 3);

//CDC.printf(" 3: %4d right justif.\r\n", 3);
//CDC.printf("-3: %04d zero padded\r\n", -3);

//CDC.printf("-3: %4d right justif.\r\n", -3);

CDC.printf("Press Any Key ...\r\n");
c = CDC.getKey();
CDC.printf("You pressed Key %c\r\n", c);
CDC.printf("\r\n");

CDC.printf("Press Any Key to continue ...\r\n");
c = CDC.getKey();


If i uncomment something, no com ports is discovered at startup.

Huh
Reply
26-11-2013, 10:36 AM,
#9
RE: 18f45k50 Intosc - Fail Usb (cdc) & function Millis slow
Checked also with 4.14 Bootloader with no differences...
Reply
26-11-2013, 07:59 PM,
#10
RE: 18f45k50 Intosc - Fail Usb (cdc) & function Millis slow
Fixed interrupt library in rev. 952
No idea where the problem comes from with CDC ...
It is easier to complain than it is to do, but it is better to do than it is to complain.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)