FlexCan Driver - 56f83xx

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

FlexCan Driver - 56f83xx

7,321 Views
admin
Specialist II
The included Processor Expert bean for the 56F83xx will only initialize the FlexCan module.  There doesn't seem to be any other functionality in the bean.  Does a more robust FlexCan bean for this part exsist?  If not, does anyone know of a 56f83xx FlexCan driver that includes some basic functionality beyond initialization?
Labels (1)
0 Kudos
9 Replies

958 Views
ProcessorExpert
Senior Contributor III
Hello,
There is a fully functional CAN bean named FreescaleCAN but it is not licensed with the standard license. It has to be licensed (purchased) separately as a part of the Premium beans package. Please contact the Freescale sales department for more information.

This bean (FreescaleCAN) provides a high-level interface with properties and methods for comfortable sending/reception of the data.
You can see tha bean in the Bean selector in the category Internal Peripherals / Communication if you disable the filter by un-clicking the 'Licensed' button at the bottom. You can even add the bean to the project and see its interface. Hower, you won't get any code until you'll have a valid license.

best regards
Petr Hradsky
Processor Expert Support Team
UNIS
0 Kudos

958 Views
admin
Specialist II
What can i do to initialize flexCAN buffer with extended ID format manually? It seems like PE automatically choose type of ID (i.e. if ID less than 0x8FFFF id will be set as Standard).
0 Kudos

958 Views
ProcessorExpert
Senior Contributor III

Alexey wrote:
What can i do to initialize flexCAN buffer with extended ID format manually? It seems like PE automatically choose type of ID (i.e. if ID less than 0x8FFFF id will be set as Standard).



It is true that PE currently chooses the extended/standard type of the ID along the ID value (i.e. if ID less than 0x8FFFF id will be set as Standard). It has been already implemented for the upcoming version that it allows to configure the type of the ID for any ID value by a special property.

At the moment, the solution is to initialize the message buffer with standard ID and then in the main routine, after the PE_low_level_init(); function rewrite the ID_HIGH and ID_LOW registers of the appropriate bufer according to the CPU datasheet (MC56F8300UM.PDF, chapter 7.5 Message Buffers), the following way (e.g. for buffor 0):

setReg(FCMB0_ID_HIGH, xxx); // IDE bit has to be set to 1, etc ...
setReg(FCMB0_ID_LOW, yyy); // Lower part of the ID

best regards
Petr Hradsky
Processor Expert Support Team
UNIS
0 Kudos

958 Views
admin
Specialist II
Thanks.

Now I have the following problem.
There are 4 message buffers (MB) - 2 receive (with ID's 0xFAF00, 0xFAF50) and 2 transmit (0xFAF00, 0xFAF60). Receive and transmit MB's with the same ID are used to implement an exchange with PC by my own protocol (read received message (all messages) in interrupt, send answer in main program). I use ReadFrame and SendFrame functions from FreescaleCAN bean. But after some time my device stops answering to PC. In debugger i found that MB's HIGH_ID and LOW_ID became the same for both receive buffers (i.e. 0xFAF50). What's wrong? How to use the above mentioned functions in proper way?
0 Kudos

958 Views
admin
Specialist II
I have found solution in the last "Errata" on chip 56F8323. This is hardware (FlaexCAN module) problem.
From errata:
FlexCAN transmit buffer activation at a node during message's CRC and EOF reception at that
node can either corrupt the received messages's ID_LOW at that node or corrupt the message screening at that node.

 Solution:
quote:
Workaround (for both 1 and 2):Activate transmit buffers when neither the CRC nor the EOF reception can be concurrent. Use the following procedure to activate transmt buffers:1) Disable the Mailbox (MB) interrupt by using the FCMSGBUF bit in the interrupt
priority register of the interrupt controller module.2) Check the IDLE and TX/RX bits in the Error and Status Register (FCSTATUS).If IDLE bit = 1, or TX/RX bit =1, continue with step 3-7; otherwise jump to step 7.3) Write the Control/Status word to hold the transmit MB inactive.4) Write the ID_HIGH and ID_LOW.5) Write the Data bytes.6) Write the Control/Status word ( active CODE, LENGTH).7) Enable the MB interrupt.[

 

2 ProcessorExpert team
So you need to modify code of SendFrame function for this chip (i don't know about another chips).

Message Edited by Alexey on 2006-08-21 05:25 AM

Message Edited by Alexey on 2006-08-21 05:26 AM

0 Kudos

958 Views
ProcessorExpert
Senior Contributor III
Thank you for the information. We are working on using the errata workaround in our bean methods. It should be available in the next release of Processor Expert.

best regards
Petr Hradsky
Processor Expert Support Team
UNIS
0 Kudos

958 Views
admin
Specialist II
Is this possible to add initialization of transmit message buffers in Init method? Now during initialization for transmit buffers only control register is set, ID_HIGH/ID_LOW is empty. As far as i understand "Writnig ID_HIGH and Id_LOW words" in transmit process is optional step. So setting buffer's ID during init will be helpfull (IMHO).
0 Kudos

958 Views
admin
Specialist II
This will be helpfull if i only need to transmit a message as a response to a Remote frame.

Message Edited by Alexey on 2007-03-1507:55 PM

0 Kudos

958 Views
bruce
Contributor I
:manhappy:Hi, You can get more recent infromation from :http://www.processorexpert.com 
Well,can you tell me how to  learn program with C language about 56F8323 please,thanks
0 Kudos