dspic33ep512mu810 canbus not working in fc8

Any bugs you encounter with Flowcode should be discussed here.
Post Reply
merkelbachdesign
Posts: 4
http://meble-kuchenne.info.pl
Joined: Thu Dec 10, 2020 1:21 pm

dspic33ep512mu810 canbus not working in fc8

Post by merkelbachdesign »

hello
i am trying to get then Can bus working in fc8 on a mikroe clicker2 dspic pcb
using the internal canbus and program it with pickkit3

i made code for reading the Can and display the id and datalength on a 4x20 lcd
the usb and lcd seem to work but the can does not function
CheckRx , get RxIdent GetrxData and getrxdataCount stay zero
the can msg that is send by a peakcan module is (correctly) acknowleged by the pic controller,
so the timing seems ok
check for updates shows [0 Updates Available]
in the project there is a sendbuffer component disabled for the test , if enabled the dspic resets completely

if i save a copy of this project and open it in fc9 (demo version) the Canbus works with the exeption that it runs the can at 1mhz
the can is set to 500khz in the project
it even sends can data every (400ms +display write time)446 ms

i hope some one can help me
Attachments
lcd_usb_can_2_fc8.fcfx
(19.47 KiB) Downloaded 369 times

merkelbachdesign
Posts: 4
Joined: Thu Dec 10, 2020 1:21 pm

Re: dspic33ep512mu810 canbus not working in fc8

Post by merkelbachdesign »

this text is shown in the buy flowcode section:
You will need a pro licence if you are using Flowcode for commercial purposes. You will receive enhanced levels of support via our forums.

this is text only not real support

Steve-Matrix
Matrix Staff
Posts: 1465
Joined: Sat Dec 05, 2020 10:32 am
Has thanked: 204 times
Been thanked: 347 times

Re: dspic33ep512mu810 canbus not working in fc8

Post by Steve-Matrix »

Sorry that your post has not had a reply. If this happens again, please post a reply to the original post to 'bump' the topic to remind us and forum users the problem remains unresolved.

I see that this is a problem with Flowcode v8. Have you posted in the v8 forums? It may be more appropriate to post there.

And because this is an issue specific to the hardware you are using, it is not always that simple for us or other forum users to solve. Hopefully what you have already told us will help, but is there anything more you can tell us that could help isolate the issue?

BenR
Matrix Staff
Posts: 1926
Joined: Mon Dec 07, 2020 10:06 am
Has thanked: 501 times
Been thanked: 686 times

Re: dspic33ep512mu810 canbus not working in fc8

Post by BenR »

Hello,

I've now pushed a fix for you that hopefully should allow the CAN to work correctly on your device in v8.

Let us know how you get on.

merkelbachdesign
Posts: 4
Joined: Thu Dec 10, 2020 1:21 pm

Re: dspic33ep512mu810 canbus not working in fc8

Post by merkelbachdesign »

hello fc team

Tested the update the can works fine , the micro has no resets on transmit anymore

only the can bus is now the same as in fc9
if you set it to 500khz , It is running at 1mhz
if you set it to 250khz , It is running at 500khz
i can work with this , as i dont need the 125khz

thank you for the support

sorry for the remark of Sun Sep 11, next time i wil post on the fc8 forum

BenR
Matrix Staff
Posts: 1926
Joined: Mon Dec 07, 2020 10:06 am
Has thanked: 501 times
Been thanked: 686 times

Re: dspic33ep512mu810 canbus not working in fc8

Post by BenR »

Hello,

There is / was a bug on the silicon relating to the CAN baud rate, we have provided a workaround as specified in the errata, I wonder if you've got a newer version of the silicon where the bug no longer exists, or maybe the 810 was never effected?

This is the code in the file here if you want to try and remove the issue.
C:\ProgramData\MatrixTSL\FlowcodeV8\CAL\PIC16BIT\PIC16BIT_CAL_CAN.c

Starting line 387.

Code: Select all

			// No CANCKS on 33F/24H (http://www.microchip.com/forums/m421868.aspx)
			#if __dsPIC33E__ || __dsPIC24E__ || __dsPIC33F__
				// Setup clock:
				// Set CAN clock to Fp (==Fosc/2)
				#if __dsPIC33EP256MU806__ || __dsPIC33EP256MU810__ || __dsPIC33EP256MU814__ || __PIC24EP256GU810__ || __PIC24EP256GU814__ || __dsPIC33EP512MU810__ || __dsPIC33EP512MU814__ || __dsPIC33EP512GP806__ || __dsPIC33EP512MC806__
					// (Errata: this bit is reversed)
					C1CTRL1bits.CANCKS = 1;
				#else
					C1CTRL1bits.CANCKS = 0;
				#endif
			#endif

Post Reply