industrialNETworXnetx

HP

HP

| 12.01.2007 | 08:42 | 18 replies

CAN HAL V2

Hey folks

I ported the original CAN HAL to rcX (at least the functionality I needed). Now I see you did some changes concerning performance and some bugfixing. Can I include everything and just switch the task functionality and interrupthandling to rcX, like I did before, or is there something I should be aware of with those performance changes that works different in rcX (like cache and stuff like that)?

Andreas Jacob

Andreas Jacob

Hilscher Gesellschaft fuer Systemautomation mbH

| 15.01.2007 | 14:58

Hi HP,

in the Version 2.0 are some new functionalities included. So it would be possible for you tu "upgrade" your project.

:idea: But I would please you to wait a little bit, before you start. There will be a newer version available, soon. In the next version it would be possible to set a priority for the receive frames. Maybe it is interesting for you.

HP

HP

| 15.01.2007 | 15:02

Hm, how will this priority thing work? As far as I know, the only way to have different priority frames is using the arbitration of the CAN-ID (lower ID = higher prio).

Since our device will only relay data between different bus segments and not be an actual participant of the communication that wont be important for us I think. At least if it's something on the application level and not on the standard CAN level.

M T

M T

Hilscher Gesellschaft für Systemautomation mbH

| 15.01.2007 | 22:32

The priority setting being available in the new example is not the CAN bus priority. (low ID = high priority).

You will be able to differentiate two indication priority levels. (2 different IRQ sources). In the standard way each frame is indicated by a low priory indication interrupt. You can now select any combination of the 2048 Standard RX Identifiers to be indicated by a high priority indication interrupt. When using 29 Bit identifiers you will have 8 registers to filter frames for high priority indications.

This priority settings is useful for example for the sync frame which will then be inserted into a high priority reception FIFO and indicated by a seperate IRQ. This offers better reaction times to such frames.

Hope this clears up the priorization possibilities.

HP

HP

| 16.01.2007 | 07:51

Thanks for the additional info, MT. That might indeed be interesting to our costumers, so I think I'll wait with upgrading. Can you tell me how soonish "coming soon" actually means? :wink:

M T

M T

Hilscher Gesellschaft für Systemautomation mbH

| 16.01.2007 | 12:45

When it's done. :wink:

Ok. The Demo is finished and will be tested on the boards it was designed for.

In parallel the documentation is updated.

I think you can expect it the next few days. If any of the tests fail, it might get a little delayed though. So don't hang me, if a delay occurs
8)

HP

HP

| 16.01.2007 | 13:25

That's alright, within the "next few days" is fine even if there is a delay :) Could you post here when it's available, so I get a mail? That would be great!

Andreas Jacob

Andreas Jacob

Hilscher Gesellschaft fuer Systemautomation mbH

| 17.01.2007 | 11:57

Hy,

good news. The new version (V2.100) is now available.

Please follow this link to download this version.

The update includes the following changes:

Quote:
Added Functions:
- Can_Start
- Can_Deint
- Can_SetRxExtPrioCmpReg
- Can_GetRxExtPrioCmpReg
- Can_SetRxStdIdPrio
- Can_GetRxStdIdPrio

Updates:
- New CAN microcode (V1.004)
- Diagnostic counters added for Hi Priority extensions (see CAN_COUNTERS_T structure)

New functionalities
- High priority receive frame indication added
- Initialize and Start of CAN seperated to allow configuration during disabled CAN
- Deinit of CAN controller possible (will stop XC)

HP

HP

| 17.01.2007 | 13:23

Hey AJ

Thanks a bunch for the feedback. I'm going to update it tomorrow if all goes well.

HP

HP

| 27.02.2007 | 09:38

I finally got to update the CAN version (talking about delays :roll: )

Well, now I have a problem with my interrupt service routine. It is never executed. The Xc is running, I can send CAN-Messages using it, message I send to netX using another CAN-Device are acknowledged, just the ISR is never entered. That means I can't receive messages of course. I do the following to initialize the ISR:

  strcpy(tIntCan.tCfgHd.szIdn,c16IrqName);
  tIntCan.tCfgHd.eTyp = RX_PERIPHERAL_TYPE_INTERRUPT;
  tIntCan.tCfgHd.uInst = ucCanChannelNo;
  tIntCan.uIntNum = uiIrqNumber;
  tIntCan.uPrio = uiIrqPrio;
  tIntCan.eMod = RX_INTERRUPT_MODE_TASK;
  tIntCan.eEoi = RX_INTERRUPT_EOI_AUTO;
  tIntCan.eTrig = RX_INTERRUPT_TRIGGER_RISING_EDGE;
  tIntCan.ePrio = RX_INTERRUPT_PRIORITY_STANDARD;
  tIntCan.eRntr = RX_INTERRUPT_REENTRANCY_DISABLED;

//Interrupt initialisieren
if (rX_MemAllocateMemory(&hIntCan,DRV_INTERRUPT_SIZE) != RX_OK) // Get memory
Error(ERROR_IF_4);
// Create the Interrupt Object now
if (Drv_IntCreateInterrupt(hIntCan, &tIntCan) != RX_OK)
Error(ERROR_IF_4);
if (Drv_IntInitializeInterrupt(hIntCan,fnIrqXpecCan,(void*)&sCanXcSettings) != RX_OK)
Error(ERROR_IF_4);
// Confirm the interrupt sources
Drv_XcSetInterrupt(hXpecCan,~MSK_CAN_INTERRUPTS_ENABLE_RES1);
// Enable the Interrupt
if (Drv_IntEnableInterrupt(hIntCan) != RX_OK)
Error(ERROR_IF_4);

The only thing i changed compared to the previous version is the mask used with Drv_XcSetInterrupt. In the earlier version I used ~MSK_CONTROL_RES1, now I'm using ~MSK_CAN_INTERRUPTS_ENABLE_RES1 which encompasses the new interrupt sources as well. Any ideas what I might have to change?

Andreas Jacob

Andreas Jacob

Hilscher Gesellschaft fuer Systemautomation mbH

| 03.03.2007 | 10:11

Why are you using in your ISR the reserved Bits ?
You try to create an IRQ for the reserved BIT area.
Every Define which includes the name "...RES..." describes a reserved area.

unsigned int RES1 : BFW_CAN_INTERRUPTS_ENABLE_RES1; // reserved, shall be set to zero

Please have a look into the file "can_xpec_regdef.h".
At line 949 you will find the CAN IRQ Enable register description.

M T

M T

Hilscher Gesellschaft für Systemautomation mbH

| 03.03.2007 | 11:30

Hi HP,

The following line was used to reset all pending Interrupts on the Interrupt controller of the XC.

 // Confirm the interrupt sources
 Drv_XcSetInterrupt(hXpecCan,~MSK_CAN_INTERRUPTS_ENABLE_RES1); 

The upper 16 Bits are ARM to XC and must be cleared from XC. The lower 16Bits are XC to ARM and must be cleared from ARM side.

So Make sure your are only writing the lower 16 Bits. to perform an EOI on this IRQ controller.

Also make sure to enable the MSYNC Irq from the corresponding XC, as the high priority indications (receptions) are signalled via this IRQ line.

The lowest 12 bits of the IRQ status register must be handled by the COM ISR and the next 4 Bits must be handled in the MSYNC ISR, as it was done in the code provided in the zip package.

Regards

MT

HP

HP

| 05.03.2007 | 09:16

Well, that's done exactly as I did it before, just with the additional bits for the new interrupt sources. The intent of this codeline is to confirm all pending interrupts on my side. With the inverted bits of the reserved mask it should actually confirm the lower bit interrupt sources, shouldnt it?

Edit: I didnt actually implement a ISR for the higher priority frames yet, because I dont intend to use this functionality for now. Will that be a problem?

HP

HP

| 12.03.2007 | 14:46

Any additional info on this behaviour?

M T

M T

Hilscher Gesellschaft für Systemautomation mbH

| 12.03.2007 | 19:22

I wonder why your ISR is never entered.

Could you post the variables ucCanChannelNo, uiIrqNumber and uiIrqPrio four your Interrupt initialization, so we can setup a demo project, or even better let the support get a demo project, for debugging.

We crosschecked the download, and it worked ok here. Maybe there's something going on in your project. Also check the other thread (http://board.hilscher.com/viewtopic.php?t=184) about the listening mode which might still be enabled aber re-initializing the CAN controller. We are waiting for confirmation on this issue.

I assume you have exchanged the Can_xpeg_regdef in your project, as the register offset might have changed.

PS: Also make sure to Acknowledge all interrupts with the 0x0000FFFF mask instead of the ~MSK_... define. If you have used another firmware on this XC before it might be needed, to reset all IRQs on this XC, instead of just the CAN ones. (This might be a cosmetic only issue, but it is recommended this way)

Regards

MT

HP

HP

| 13.03.2007 | 16:23

Hey MT

I tried replacing my used mask with 0x0000FFFF. That doesnt change anything. The listening-only mode that is mentioned in that other topic can't be the problem, because I can send messages using this interface. However, even when sending the ISR is not executed.

I'm not using your project, because I'm working on my own target, and the inputs/outputs might not be compatible. I more or less did the same changes I did when porting the original CAN HAL to rcX. I can send you my project if you want, so you can verify what I did. As I mentioned before, I didnt implement the higher/lower prio frames, nor did I turn on the MMU-Cache, so it should actually be working like it did with the originally ported version.

Andreas Jacob

Andreas Jacob

Hilscher Gesellschaft fuer Systemautomation mbH

| 05.04.2007 | 12:39

Hy HP,

sorry for the long waiting time for an answer.

I checked the available HAL-CAN_Ver.2.101 application from the web on all Hilscher reference boards. It is working. So I made some more tests with the starter board (this board uses also the XC3 for the CAN) but I can not reproduce your described behavior. :?:

I assume that you will have a problem with your hardware. Please check your hardware. Have a look on the schematics and layout. Maybe there is something wrong. :wink:

HP

HP

| 10.04.2007 | 13:35

Hey AJ

After doublechecking our hardware....again....we actually found the error: a ground-net label had a typo in it and thus the pin of a device was not actually connected to ground :oops:

Now everything works fine :wink:

Andreas Jacob

Andreas Jacob

Hilscher Gesellschaft fuer Systemautomation mbH

| 10.04.2007 | 13:44

Hi HP,

:D that are great news. Thank you for your reply.

Login