Use onboard CAN in PIC
Moderator: Benj
-
- Posts: 502
- Joined: Wed Nov 07, 2007 6:51 pm
- Location: Antwerp Belgium
- Has thanked: 121 times
- Been thanked: 108 times
- Contact:
Use onboard CAN in PIC
Is there a way to use a PIC with CAN function on board, in Flowcode?
Can for example the 18F4685 be used without the CAN Eblock board?
The CAN component is written for CAN via a serial connection with the PIC.
Can for example the 18F4685 be used without the CAN Eblock board?
The CAN component is written for CAN via a serial connection with the PIC.
- 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: Use onboard CAN in PIC
Im testing this tonight and hopefully the component should be available tomorrow. If not then certainly sometime this week.
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
- 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: Use onboard CAN in PIC
Hello MJU,
Would you mind helping me out with the beta testing of this component. I had some luck last night so I think the component code is now close to being complete.
The attached file will give you internal CAN functionality with the CAN component. You will need to be running Flowcode v4.3 and then simply make a backup of your CAN component code file and then replace with the attached code file.
If you need to change the can from internal to external for use with a MIAC or E-Block etc then you will currently need to edit the following line of the code file. When the component code is finalised we will update the component properties page to allow this feature to happen automatically without editing the code file.
Change the line..
#define INTERNAL_CAN_ENABLE 1
to
#define INTERNAL_CAN_ENABLE 0
In testing last night I was able to receive messages correctly, however any messages I sent out were ending back in the receive buffer. Hopefully I will be able to tie this problem up tonight but it would be good if someone can confirm my findings.
Edit: Sorry I forgot to mention the clock speed currently has to be 20MHz to allow the CAN to run at the correct rate. I am hoping to have this tied up in the official release too.
Would you mind helping me out with the beta testing of this component. I had some luck last night so I think the component code is now close to being complete.
The attached file will give you internal CAN functionality with the CAN component. You will need to be running Flowcode v4.3 and then simply make a backup of your CAN component code file and then replace with the attached code file.
If you need to change the can from internal to external for use with a MIAC or E-Block etc then you will currently need to edit the following line of the code file. When the component code is finalised we will update the component properties page to allow this feature to happen automatically without editing the code file.
Change the line..
#define INTERNAL_CAN_ENABLE 1
to
#define INTERNAL_CAN_ENABLE 0
In testing last night I was able to receive messages correctly, however any messages I sent out were ending back in the receive buffer. Hopefully I will be able to tie this problem up tonight but it would be good if someone can confirm my findings.
Edit: Sorry I forgot to mention the clock speed currently has to be 20MHz to allow the CAN to run at the correct rate. I am hoping to have this tied up in the official release too.
- Attachments
-
- PIC_CAN.c
- (44.19 KiB) Downloaded 259 times
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
-
- Posts: 502
- Joined: Wed Nov 07, 2007 6:51 pm
- Location: Antwerp Belgium
- Has thanked: 121 times
- Been thanked: 108 times
- Contact:
Re: Use onboard CAN in PIC
Off course I'd like to help.
I just don't have CAN enabled PIC's yet to test on an Eblock.
What I've done already is put the new CAN component in the component directory, opened two existing files that use CAN, tied them to a VNET and started them.
I doesn't do what it should do.
I have set the XTAL speed to 20Mhz.
I will later try and find out what could be wrong with this project and let you know.
I just don't have CAN enabled PIC's yet to test on an Eblock.
What I've done already is put the new CAN component in the component directory, opened two existing files that use CAN, tied them to a VNET and started them.
I doesn't do what it should do.
I have set the XTAL speed to 20Mhz.
I will later try and find out what could be wrong with this project and let you know.
- 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: Use onboard CAN in PIC
Hello MJU,
Great thanks for helping with the testing i'll see if I can help you get the Vnet operation up and running.
This guide should help to explain how to set up the Vnet and get it to function between instances of Flowcode.
http://www.matrixmultimedia.com/mmforum ... =26&t=6649
Let me know if your still having problems getting this to work correctly.
I have added more to the internal CAN driver functionality, the bounceback messages have now dissapeared and the transmit function is working. All buffers, masks and filters as specified in the Flowcode component properties will also work correctly.
The only current drawback is the clock speed must remain fixed at 20MHz, I hope to have this resolved shortly.
Great thanks for helping with the testing i'll see if I can help you get the Vnet operation up and running.
This guide should help to explain how to set up the Vnet and get it to function between instances of Flowcode.
http://www.matrixmultimedia.com/mmforum ... =26&t=6649
Let me know if your still having problems getting this to work correctly.
I have added more to the internal CAN driver functionality, the bounceback messages have now dissapeared and the transmit function is working. All buffers, masks and filters as specified in the Flowcode component properties will also work correctly.
The only current drawback is the clock speed must remain fixed at 20MHz, I hope to have this resolved shortly.
- Attachments
-
- PIC_CAN.c
- (42.9 KiB) Downloaded 256 times
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
- 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: Use onboard CAN in PIC
Hello,
I'm still struggling with the baud rates at the moment to allow different clock speeds to work. Hopefully I can get my head around this soon and we can get this component finished.
I'm still struggling with the baud rates at the moment to allow different clock speeds to work. Hopefully I can get my head around this soon and we can get this component finished.
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
-
- Posts: 502
- Joined: Wed Nov 07, 2007 6:51 pm
- Location: Antwerp Belgium
- Has thanked: 121 times
- Been thanked: 108 times
- Contact:
Re: Use onboard CAN in PIC
BenJ: many thanks Matrix for this feature, hope I was of any assistance.
This makes my project much easier.
http://www.matrixmultimedia.com/mmforum ... =26&t=7375
This makes my project much easier.
http://www.matrixmultimedia.com/mmforum ... =26&t=7375
-
- Posts: 258
- Joined: Wed Nov 29, 2006 6:32 pm
- Location: Finland
- Has thanked: 7 times
- Been thanked: 36 times
- Contact:
Re: Use onboard CAN in PIC
Hi.
First i must thanks the int CAN feature, it work great...
But is it possible to get it working in enhanced legacy mode?
The reason why is that when the using the CAN rx int and glcd display, it causes lot of problem..
When the CAN triggers int middle of the lcd update routine, it messes the lcd print, and no, its not possible to disable CAN int when lcd is updating...
The enhanced legacy mode gives 4 or 6 extra tx/rx buffer so there is no ned to use interrupt, the buffers can be assigned direct for messages...
So is it possible to get that enhanced legacy mode? If i read the data right, it just need the filter set and the read the buffer, but i dont have time to play that...
And other thing, i am still asking more option for the custom glcd driver chip....
The T6963c and the S1D13700 would be the most used.... That gives more display area...
Is that possible?
Mika
First i must thanks the int CAN feature, it work great...
But is it possible to get it working in enhanced legacy mode?
The reason why is that when the using the CAN rx int and glcd display, it causes lot of problem..
When the CAN triggers int middle of the lcd update routine, it messes the lcd print, and no, its not possible to disable CAN int when lcd is updating...
The enhanced legacy mode gives 4 or 6 extra tx/rx buffer so there is no ned to use interrupt, the buffers can be assigned direct for messages...
So is it possible to get that enhanced legacy mode? If i read the data right, it just need the filter set and the read the buffer, but i dont have time to play that...
And other thing, i am still asking more option for the custom glcd driver chip....
The T6963c and the S1D13700 would be the most used.... That gives more display area...
Is that possible?
Mika