AnsweredAssumed Answered

CAN ROM API compatibility between LPC11Cxx and LPC15xx

Question asked by Paul Paterson on Jul 7, 2016
Latest reply on Sep 29, 2016 by soledad

Is anyone maintaining a CAN library compatible with both LPC11Cxx and LPC15xx devices?  Do you have suggestions on how I might go about it?  I don't think it should be too difficult, but want to see what experience any others may have had.

 

I have a code base built up with LPC11Cxx using the LPCOpen chip library.  I need more functionality for a new device and want to use the LPC15xx series.  In general, I am a little confused why naming is so different between the LPCOpen chip libraries.  I am wondering if part of my porting the library should be to refactor some things in the LPC11Cxx chip library to be more in sync with the LPC15xx library.  But then, my concern is about maintaining a fork of the LPCOpen libraries and dealing with updates.

 

For the most obvious example:

LPC11Cxx:

void CAN_IRQHandler(void) {

      LPC_CCAN_API->isr();

}

LPC15xx:

void CAN_IRQHandler(void) {

  LPC_CAND_API->hwCAN_Isr(pCanHandle);

}

 

I am curious if CCAN and CAND are names that actually mean something to distinguish the two, or if they are arbitrary, as though the writers of the chip libraries didn't know the other existed...

 

The ROM APIs are definitely different, and the structures themselves (LPC_CCAN_API and LPC_CAND_API) reflect that.  The initialization must be unique between the devices - at a minimum, the LPC15xx ROM API calls require a handle to a CAN device in order to accommodate chips with multiple devices and allows you to define memory space (more than 255 canopen dictionary entries YAY!).  So, I need a compatibility layer of some sort anyway to maintain a single library for the two devices - more compatible naming would not prevent that.  But I am lamenting that I think it could have made it easier.

 

Thoughts?  Thank you.

Outcomes