Hi,
Im using the attached test code to send a can signal using the ECIO DS pic. There appear to be two problems, the first is that the actual board rate generated is half that of the rate assigned in FC (e.g. I need to assign 1000 in Properties Bus rate to get a received CAN message at 500 b).
The next problem is that the Tx id address actually sent remains 1 regardless of the number set in the code, I have tried altering the address and the method of setting it (e.g SET TX ID simple or SET TXID)
Am I missing something or is this a bug?
Regards,
Chris
DS PIC ECIO CAN bug? Or am I missing something?
Moderator: Benj
-
- Posts: 186
- Joined: Wed Jan 23, 2013 3:43 pm
- Has thanked: 2 times
- Been thanked: 21 times
- Contact:
DS PIC ECIO CAN bug? Or am I missing something?
- Attachments
-
- TESTFC File.fcfx
- (7.54 KiB) Downloaded 265 times
-
- Posts: 186
- Joined: Wed Jan 23, 2013 3:43 pm
- Has thanked: 2 times
- Been thanked: 21 times
- Contact:
Re: DS PIC ECIO CAN bug? Or am I missing something?
Hi,
Has anyone got any help on this please? Is it a bug?
regards,
Chris
Has anyone got any help on this please? Is it a bug?
regards,
Chris
- LeighM
- Matrix Staff
- Posts: 2178
- Joined: Tue Jan 17, 2012 10:07 am
- Has thanked: 481 times
- Been thanked: 699 times
- Contact:
Re: DS PIC ECIO CAN bug? Or am I missing something?
Hi Chris,
Yes, looks like a bug, in line 1650 of PIC16BIT_CAL_CAN.c
This is using the component property value, MX_CAN_TXB0ID_X, rather than the macro parameters.
You would probably be better using SetTxIdent macro,
although it looks like there is a bug in that too, on line 2183
I think that should be shifting 5 bits, not 2
Could you try it please? (I don't have hardware to hand at the moment)
Thanks
Leigh
ps. I'll have a look at the baud rate issue
Yes, looks like a bug, in line 1650 of PIC16BIT_CAL_CAN.c
Code: Select all
MX_MEMBUF_X[buffer][0] = (MX_CAN_TXB0ID_X << 2) & 0b0001111111111100;
You would probably be better using SetTxIdent macro,
although it looks like there is a bug in that too, on line 2183
Code: Select all
MX_MEMBUF_X[buffer][0] = (id << 2) & 0b0001111111111100;
Code: Select all
MX_MEMBUF_X[buffer][0] = id << 5;
Thanks
Leigh
ps. I'll have a look at the baud rate issue
-
- Valued Contributor
- Posts: 2045
- Joined: Wed Aug 27, 2008 10:31 pm
- Location: Netherlands
- Has thanked: 553 times
- Been thanked: 1081 times
- Contact:
Re: DS PIC ECIO CAN bug? Or am I missing something?
Oops, my bad.LeighM wrote: Yes, looks like a bug, in line 1650 of PIC16BIT_CAL_CAN.cThis is using the component property value, MX_CAN_TXB0ID_X, rather than the macro parameters.Code: Select all
MX_MEMBUF_X[buffer][0] = (MX_CAN_TXB0ID_X << 2) & 0b0001111111111100;
Why would you want to shift 5 bits? According to the data sheet page 381, ECAN™ MESSAGE BUFFER WORD 0:LeighM wrote: You would probably be better using SetTxIdent macro,
although it looks like there is a bug in that too, on line 2183I think that should be shifting 5 bits, not 2Code: Select all
MX_MEMBUF_X[buffer][0] = (id << 2) & 0b0001111111111100;
Code: Select all
MX_MEMBUF_X[buffer][0] = id << 5;
So a shift of two bits looks right to me.Microchip wrote: bit 12-2 SID<10:0>: Standard Identifier bits
I recall having added code to the CAN CAL component to fix a silicon bug. For some devices CnCTRL1bits.CANCKS works in reverse (so setting it to 1 is the setting listed in the data sheet for 0 v.v.) I know this bug applies to the chip on ECIO16, may-be the work around is not triggered for this device? (Or something completely different might be wrong)LeighM wrote: ps. I'll have a look at the baud rate issue
“Integrity is doing the right thing, even when no one is watching.”
― C.S. Lewis
― C.S. Lewis
-
- Posts: 186
- Joined: Wed Jan 23, 2013 3:43 pm
- Has thanked: 2 times
- Been thanked: 21 times
- Contact:
Re: DS PIC ECIO CAN bug? Or am I missing something?
Errr ...
First, thanks for looking into this
Im afraid Im a little confused as to what the fix is and how to implement it?
How do I get to the right place (presumably in the FC6 CAN CAl library file?)
And what do I actually correct?
Regards,
Chris
First, thanks for looking into this
Im afraid Im a little confused as to what the fix is and how to implement it?
How do I get to the right place (presumably in the FC6 CAN CAl library file?)
And what do I actually correct?
Regards,
Chris
- LeighM
- Matrix Staff
- Posts: 2178
- Joined: Tue Jan 17, 2012 10:07 am
- Has thanked: 481 times
- Been thanked: 699 times
- Contact:
Re: DS PIC ECIO CAN bug? Or am I missing something?
Hi Chris,
Looks like you should be OK with the SetTxIdent macro
Leigh
Looks like you should be OK with the SetTxIdent macro
Leigh
-
- Posts: 186
- Joined: Wed Jan 23, 2013 3:43 pm
- Has thanked: 2 times
- Been thanked: 21 times
- Contact:
Re: DS PIC ECIO CAN bug? Or am I missing something?
Thanks Leigh,
Ill try that! Will you please let me know when the bud is fixed?
Regards Chris
Ill try that! Will you please let me know when the bud is fixed?
Regards Chris