HELP ABOUT CAN LPC1549

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

HELP ABOUT CAN LPC1549

1,949 Views
olivierpohu
Contributor I

Hi , i work with LPC1549. The Usb bus fonction correctly , but not the Can Bus .

When i send  a Can transmission to the computer  I Watch the TxCan signal with a scoop

but there are no signal and the computer say me " TX empty". When i want send a message from computer to the board

I see the signal with a scoop but the mail box is empty too. I think i have a problem of Can initialisation...

See  my schematic and program initialisation Can you help me please....

CAN3.jpg

See My Initialisation Programm

CAN4.jpg

Labels (1)
0 Kudos
11 Replies

1,276 Views
olivierpohu
Contributor I

OK  ALL function good Now.... In fact when you use lpcopen  in the function board.C  the pin pio13 and PIO18 are already affected to UART  and not to CAN ... We must modify these affectation  in board .c 

The lpc1549 CAN Function Good  Now....

 Thank you very much for your help Kerry....

0 Kudos

1,276 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Olivier,

   Thank you for your updated information, and that's very good to hear your problem is solved.

  Actually, the lpcopen code is connected to the PIO0_11 and PIO0_31, so if you want to use PIO0_13 and PIO0_18, you need to modify the code.

pastedImage_1.png


Have a great day,
Kerry

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos

1,276 Views
olivierpohu
Contributor I

Hi  ...

But i already use the lpcopen code of My Mcuxpresso 10.0.034...

I have already see on the forum that there are some  Problèmes of transmission  with LPC1549JBD48 and CAN...

The code is the code of C_CANROM of lpc 1549. I have juste changing the Number  of  the CAN PIN

( PIO13 for RDCan and PIO18 for TDCan).... You can see...

ProgLPC.jpg

About the hard i have made the same think that you....

TEMFIABA1.bmp

 I use the Muxtrace of exotest and the reponse is NO ACK... when i want send the data to the lpc

and when i want send from lpc to muxtrace... no transmission... I think there are somethink to do

in the initialisation Lpc.. Like if the can module is not powered... I don' t Known....

Can you send me your initialisation can Programme.. Please...

0 Kudos

1,276 Views
olivierpohu
Contributor I

Hi Kerry..

I have  change my drivers I use now the TJA1050T, but i have not emission again .

Can you send me   your can initialisation  , Please. I think  the problème is in the can initialisation

Thanks  for your help.

0 Kudos

1,276 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Olivier,

   Please check Floor 2, I already tell you that I am using the official code, the lpcopen code, you can download the lpcopen code and check it.

Wish it helps you!


Have a great day,
Kerry

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos

1,276 Views
olivierpohu
Contributor I

HI Kerry.

I have take an other lpc1549 board . iuse lpcopen CANrom

My environnement is now :

CAN5.jpg

 I have alway  not signal to my output  . My LPC is LPC1549 _48 with pio13 and pio18 like CANRX and CANTX.

 My code is very sample  and the up don' t stop. here...

CAN4.jpg

1°) Have you an Idée of my problem  ?

2°) Have you a documention for the calculation of baud rate ?

0 Kudos

1,276 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Olivier POHU,

   Please accept my apologies for the late reply, because recently, I am a little overloaded, now, I reply you in details after the test.

1. LPCXpress 1549 CAN_TX have no signal after run the periph_ccan_rom

  This problem is caused by no CAN transceiver in the hardware, the CAN_TX pin need to associate with the CAN transceiver, then we can get the CAN transmit data.

2. My test result details.

Board: LPCXpress LPC1549

Code: lpcopen_2_20_lpcxpresso_nxp_lpcxpresso_1549\periph_ccan_rom

CAN transceiver: I connect a external CAN transceiver, the circuit is like follows:

pastedImage_1.png

I connect the LPCXpresso LPC1549 CAN_TX to C_TXD, CAN_RX to C_RXD. CANH and CANL connect to my CAN analyzer(PEAK CAN).

Test tool:

    CAN analyzer: PEAK CAN

    Oscilloscope, test the CAN_TX, CAN_H and CAN_L wave.

Wave:

1) CAN_TX, CAN_H, CAN_L oscilloscope wave

Channel 1: CAN_TX ; Channel 2: CAN_H; Channel 3: CAN_L

  pastedImage_7.png

Zoom in it.

pastedImage_8.png

You can find the bit rate is 500Kps, just as the code defined.

2) CAN analyzer data

pastedImage_9.png

After the board reset, you can find the CAN analyzer can receive the standard ID 0x345, data is 0x54 0x45, 0x53, 0x54, just as the transmit code:

    /* Send a simple one time CAN message */
    msg_obj.msgobj  = 0;
    msg_obj.mode_id = 0x345;
    msg_obj.mask    = 0x0;
    msg_obj.dlc     = 4 ;
    msg_obj.data[0] = 'T';    /* 0x54 */
    msg_obj.data[1] = 'E';    /* 0x45 */
    msg_obj.data[2] = 'S';    /* 0x53 */
    msg_obj.data[3] = 'T';    /* 0x54 */

Then, use the CAN analyzer send the CAN data, standard ID: 0X400, data is 0X00, 0X01,0X02,0X03,0X04,0X05,0X06,0X07.From the code:

static void CAN_rx(uint8_t msgNumber)
{
    /* Determine which CAN message has been received */
    msg_obj.msgobj = msgNumber;

    /* Now load up the msg_obj structure with the CAN message */
    LPC_CAND_API->hwCAN_MsgReceive(pCanHandle, &msg_obj);
    if (msgNumber == 1) {
        /* Simply transmit CAN frame (echo) with with ID +0x100 via buffer 2 */
        msg_obj.msgobj = 2;
        msg_obj.mode_id += 0x100;
        LPC_CAND_API->hwCAN_MsgTransmit(pCanHandle, &msg_obj);
    }
}

We can find after the LPC1549 receive the CAN data, it will add 0x100 to the received ID, then send the data back the CAN bus.

pastedImage_10.png

Look the above pictures, you can find the CAN analyzer received the 0X500 standard ID, it is 0X400+0X100, it is correct.

All the above data and waves meas the lpcopen can code works, both the send and receive.

So, I think you problem may be caused by your CAN transceiver hardware, if the CAN transceiver hardware have problem, you won't get the correct data or test the correct wave.

You can refer to may CAN transceiver circuit to try it.

Wish it helps you!

If you still have question about it, please let me know!


Have a great day,
Kerry

 

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
----------------------------------------------------------------------------------------------------------------------

0 Kudos

1,276 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Olivier,

1. code

  I test it like you in the lpcxpress1549 board with lpcopen, CAN_TX didn't add the external CAN transceiver, I also didn't get the data in the oscilloscope, I will do the deep research, then reply you later, please wait patiently.

2. Have you a documention for the calculation of baud rate ?

Please check the following information

/* btr values can be obtained from www.bittiming.can-wiki.info  (use Bosch C_CAN / D_CAN) */
http://www.oertel-halle.de/files/cia99paper.pdf

Wish it helps you!

Best Regards,

Kerry

0 Kudos

1,276 Views
olivierpohu
Contributor I

Hi Kerry , Thanks very much  for your help .You can see my test environnement on the drawwing.

CAN3.bmp

Yes i have already use LpcOpen , but that do the same think....

Have you the formule for calculate baud rate  and % Point  evironnemnent  on LPC1549 ?

I send my Trame with 500K 87% and the Lpc1549 is programmed à 500K 87,5 % ( 0x502) ?

But i have no information for baud rate calculation .. Perhaps it is that ?

Thank for your help Kerry.. 

0 Kudos

1,276 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Olivier POHU,

   Thank you for your updated information.

   From your new picture, it seems, your LPC1549 can't sent the CAN data out.

   I think maybe the code or LPC1549 hardware still have problem, you can use the same external crystal with the LPCXpresso LPC1549 board, then use the lpcopen code to test it.

  Or, if you have the LPCXpresso 1549 board on your side, you can test this board with the lpcopen code directly, just make sure your external test platform have no problem.

  I suggest you use the debug to debug your code, check the code, whether it execute the CAN code, or it stop in some area.

Please check it again, any updated information, please kindly let me know!

If you still have question after the test, please tell me the updated information.

 

Wish it helps you!

Have a great day,
Kerry

 

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos

1,276 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Olivier POHU,

   1. Hardware

      What is your scoop, is that also a CAN TOOL(CAN analyzer)which can get the CAN data and send the CAN data with PC software?

     Do you mean your CAN analyzer can receive the CAN data from your own board?

      You must make sure your U20 circuit works at first.

  2. Software

    I suggest you try the official lpcopen code for LPC1549 at first, you can download it from this link:

LPCOpen Software for LPC15XX|NXP 

   You can try this project: lpcopen_2_20_lpcxpresso_nxp_lpcxpresso_1549\periph_ccan_rom

   This code can send CAN data, and receive all 11-bit messages 0x400-0x4FF.

   Please try this can code.

If you still have question after the test, please tell me the updated information.

Wish it helps you!

Have a great day,
Kerry

 

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos