Search found 55 matches

by lexicon
Mon Nov 23, 2020 12:26 pm
Forum: 8-Bit PIC
Topic: PIC 18F45K80 CAN bus speed issue
Replies: 0
Views: 39791

PIC 18F45K80 CAN bus speed issue

I'm using a PIC 18F45K80, running @64MHz (16MHz resonator, 4xPLL), CAN bus is set to 500kbs in Flowcode7. When I try to use the internal CAN it is not working correctly - it seems the transmit speed is about 10% too fast. Although PICOscope is able to decode it, our CANalyser does not accept the tra...
by lexicon
Thu Dec 05, 2019 12:23 pm
Forum: Article Discussion
Topic: MX009 - PID Control
Replies: 23
Views: 52121

Re: MX009 - PID Control

The link to the PID article is broken (404).
by lexicon
Thu Oct 24, 2019 1:48 pm
Forum: 16-Bit PIC
Topic: dsPIC33EP512GM710 CAN bus stopped working
Replies: 28
Views: 28792

Re: dsPIC33EP512GM710 CAN bus stopped working

Having continued to struggle, but needing a solution, I decided to have a go at driving the CAN bus in MPLABX using the device configurator (MCC). I was able to fairly easily create code to transmit CAN messages. I have since been able to 'merge' the Flowcode .c code with the MCC generated files and...
by lexicon
Tue Oct 15, 2019 2:20 pm
Forum: 16-Bit PIC
Topic: dsPIC33EP512GM710 CAN bus stopped working
Replies: 28
Views: 28792

Re: dsPIC33EP512GM710 CAN bus stopped working

Due to a period of stupidity on my part, I was wrong to say that the device no longer resets with certain PIC16BIT_CAL_CAN.c files - it does, just the same :oops: Anyway, I have tried all 8 versions that I have, but I still get the same results - the ones that do not cause a reset have the corrupted...
by lexicon
Mon Oct 14, 2019 4:14 pm
Forum: 16-Bit PIC
Topic: dsPIC33EP512GM710 CAN bus stopped working
Replies: 28
Views: 28792

Re: dsPIC33EP512GM710 CAN bus stopped working

A few more experiments with variable definitions resulted in more variations on the output: 5x int = 08 00 FC 1F FC 1F 08 00 6x = 00 00 FC 1F 00 00 FC 1F 7x = FC 1F FC 1F FC 1F FC 1F And then with 8 int's defined... it worked correctly. ETA: It seems like the pattern probably repeats then as 9 is th...
by lexicon
Fri Oct 11, 2019 4:11 pm
Forum: 16-Bit PIC
Topic: dsPIC33EP512GM710 CAN bus stopped working
Replies: 28
Views: 28792

Re: dsPIC33EP512GM710 CAN bus stopped working

I tried some of the other PIC_CAL_CAN.c files, and although that didn't fix the issue, it was interesting that the versions that previously caused a device reset do not do so with the later compiler. Different variable configurations give varying results, but there's a definite pattern to the CAN ou...
by lexicon
Thu Oct 10, 2019 5:12 pm
Forum: 16-Bit PIC
Topic: dsPIC33EP512GM710 CAN bus stopped working
Replies: 28
Views: 28792

Re: dsPIC33EP512GM710 CAN bus stopped working

I've configured Flowcode to compile using XC16 V1.41, but that in itself did not make any difference.
Not initialising the variable also made no difference.
I will conduct further experiments...
by lexicon
Wed Oct 09, 2019 10:51 am
Forum: 16-Bit PIC
Topic: dsPIC33EP512GM710 CAN bus stopped working
Replies: 28
Views: 28792

Re: dsPIC33EP512GM710 CAN bus stopped working

Yeah, that would be an alternative to using MPLABX to compile it.
Wouldn't it be XC16 for the device in question?
by lexicon
Wed Oct 09, 2019 10:04 am
Forum: 16-Bit PIC
Topic: dsPIC33EP512GM710 CAN bus stopped working
Replies: 28
Views: 28792

Re: dsPIC33EP512GM710 CAN bus stopped working

Hi Leigh,

OK, thanks for the suggestions (especially 'try anything' - LOL).
I'll try a few things and see what happens.
Definitely having different code produces different results in terms of how corrupted the output is - I'll have a play around with that.

Regards,
Martin.
by lexicon
Tue Oct 08, 2019 3:36 pm
Forum: 16-Bit PIC
Topic: dsPIC33EP512GM710 CAN bus stopped working
Replies: 28
Views: 28792

Re: dsPIC33EP512GM710 CAN bus stopped working

Hi Leigh,

OK...
Any suggestions then?
Is there any mileage in, for example, trying to compile it in MPLABX?
I appreciate that you can't know every device, but it is supposed to be supported, and that makes it sound like you're just cutting it loose.

Regards,
Martin.
by lexicon
Thu Oct 03, 2019 2:38 pm
Forum: 16-Bit PIC
Topic: dsPIC33EP512GM710 CAN bus stopped working
Replies: 28
Views: 28792

Re: dsPIC33EP512GM710 CAN bus stopped working

Any thoughts or updates on this issue?

Regards,
Martin.
by lexicon
Wed Aug 28, 2019 9:54 am
Forum: 16-Bit PIC
Topic: dsPIC33EP512GM710 CAN bus stopped working
Replies: 28
Views: 28792

Re: dsPIC33EP512GM710 CAN bus stopped working

Hi Leigh, That gave the same results (CAN output but corrupted). It also generated these warning messages during compile: C:\Program Files (x86)\Flowcode 7\CAL\/PIC16BIT\PIC16BIT_CAL_CAN.c: In function 'FC_CAL_Internal_CAN_Init_1': C:\Program Files (x86)\Flowcode 7\CAL\/PIC16BIT\PIC16BIT_CAL_CAN.c:3...
by lexicon
Fri Aug 23, 2019 1:22 pm
Forum: 16-Bit PIC
Topic: dsPIC33EP512GM710 CAN bus stopped working
Replies: 28
Views: 28792

Re: dsPIC33EP512GM710 CAN bus stopped working

Hi Leigh,

I'd put the CAL in the wrong place - Program Files(x86)/Flowcode v8/DefaultData.
Putting it in the ProgramData path makes the CAN work, but gives the same corrupted data as FC7.

Regards,
Martin.
by lexicon
Fri Aug 23, 2019 12:04 pm
Forum: 16-Bit PIC
Topic: dsPIC33EP512GM710 CAN bus stopped working
Replies: 28
Views: 28792

Re: dsPIC33EP512GM710 CAN bus stopped working

Hi Leigh,
On FC8 we're back to the device apparently resetting on a buffer send.
I tried the new CAN CAL file posted earlier, but that made no difference (are these files compatible between 7 & 8?)

Regards,
Martin.
by lexicon
Fri Aug 23, 2019 9:25 am
Forum: 16-Bit PIC
Topic: dsPIC33EP512GM710 CAN bus stopped working
Replies: 28
Views: 28792

Re: dsPIC33EP512GM710 CAN bus stopped working

No, not tried that - I can give it a go though...
by lexicon
Fri Aug 16, 2019 3:21 pm
Forum: 16-Bit PIC
Topic: dsPIC33EP512GM710 CAN bus stopped working
Replies: 28
Views: 28792

Re: dsPIC33EP512GM710 CAN bus stopped working

Following on from the above, the attached CAN test program (DSPIC33_CAN_work) produces the expected cycling output in all 8 bytes of the CAN message. However, 'DSPIC33_CAN_fail' always outputs the first 2 bytes as 08 00 while the other six are correct. The only difference between the two is the UINT...
by lexicon
Thu Aug 15, 2019 2:17 pm
Forum: 16-Bit PIC
Topic: dsPIC33EP512GM710 CAN bus stopped working
Replies: 28
Views: 28792

Re: dsPIC33EP512GM710 CAN bus stopped working

So, here's an odd thing - depending on other code in the program, the transmitted CAN values may not be correct. I've not really got to grips with the details yet, but if I have a simple loop that outputs an incrementing counter in the 8 CAN message bytes it works fine. If I implement that same meth...
by lexicon
Wed Aug 14, 2019 11:06 am
Forum: 16-Bit PIC
Topic: dsPIC33EP512GM710 CAN bus stopped working
Replies: 28
Views: 28792

Re: dsPIC33EP512GM710 CAN bus stopped working

Hi Leigh,

Yes, that works - thank you.

If I add my post-init config (attached) as before, the speed is correct too @ 500kbps instead of 420.
Could a fix for that also be included?

Regards,
Martin.
by lexicon
Tue Aug 13, 2019 4:51 pm
Forum: 16-Bit PIC
Topic: dsPIC33EP512GM710 CAN bus stopped working
Replies: 28
Views: 28792

Re: dsPIC33EP512GM710 CAN bus stopped working

Hi Leigh, Thanks for the archive: @72 and @278 both work (albeit with the incorrect speed as per the thread referenced in my opening post). All the others, including the as-installed version, appear to reset the device (i.e the whole PIC) when performing a buffer send. Initially I couldn't understan...
by lexicon
Fri Aug 09, 2019 11:49 am
Forum: 16-Bit PIC
Topic: dsPIC33EP512GM710 CAN bus stopped working
Replies: 28
Views: 28792

Re: dsPIC33EP512GM710 CAN bus stopped working

As per opening post, I can no longer produce working code from this CAN test program (dsPIC33_uart2can). The original hex file (dsPIC33_uart2can.org.hex) works fine. If I compile it now I get a smaller hex file (dsPIC33_uart2can.hex) that outputs nothing on the CAN bus (as observed on an oscilloscop...
by lexicon
Thu Apr 18, 2019 10:37 am
Forum: 16-Bit PIC
Topic: dsPIC33EP512GM710 CAN bus stopped working
Replies: 28
Views: 28792

dsPIC33EP512GM710 CAN bus stopped working

More than a year ago I did a bit of work with CAN on the dsPIC33EP512GM710 and I had some issues with the speed configuration (see https://www.matrixtsl.com/mmforums/viewtopic.php?f=69&t=19843). However I did get everything to work eventually. Recently I began a new project using the same device whi...
by lexicon
Wed Mar 27, 2019 12:14 pm
Forum: 16-Bit PIC
Topic: ADC oddness on dsPIC33EP512GM710
Replies: 18
Views: 12700

Re: ADC oddness on dsPIC33EP512GM710

It's been a while since I had the ADC issue, but I recently started a new project based on the same device and it appears that AN46 and AN47 do not work - I always seem to get a zero output. I've had a look at the config file but they appear to be mapped to the correct pins (A14 & 15). I'm using 7 o...
by lexicon
Tue Jan 08, 2019 11:21 am
Forum: 16-Bit PIC
Topic: dsPIC33EP512GM710 missing PWM channels
Replies: 2
Views: 5293

Re: dsPIC33EP512GM710 missing PWM channels

OK, thanks Ben. You have actually told me that before - memory's getting carp these days! The thing that threw me about this is that the datasheet only mentions the 12 high speed PWM channels. It doesn't say the OC modules also have a PWM mode. Only when you read the OC control register info does it...
by lexicon
Mon Jan 07, 2019 3:21 pm
Forum: 16-Bit PIC
Topic: dsPIC33EP512GM710 missing PWM channels
Replies: 2
Views: 5293

dsPIC33EP512GM710 missing PWM channels

Hi,

In the PWM properties channel selector only 8 channels are listed, but there are 12 available on this device.

Regards,
Martin.
by lexicon
Wed Nov 14, 2018 5:05 pm
Forum: Flowcode V5 Issues
Topic: PIC18F66K80 - Confused by UART config
Replies: 3
Views: 5799

Re: PIC18F66K80 - Confused by UART config

I changed the config file to this: Define22=#define MX_UART_1 Define23=#define MX_UART_1_TX_PORT portg Define24=#define MX_UART_1_TX_TRIS trisg Define25=#define MX_UART_1_TX_PIN 3 Define26=#define MX_UART_1_RX_PORT portg Define27=#define MX_UART_1_RX_TRIS trisg Define28=#define MX_UART_1_RX_PIN 0 De...