Very Odd CAN Behaviour on LPC1549

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

Very Odd CAN Behaviour on LPC1549

400 Views
anmolthind
Contributor I

Hi,

I'm currently working on a library for use on LPC15xx microcontrollers, part of the library is a CAN module and I'm seeing some really strange behaviour.

To better explain what I have, I have two stages to the library. The CAN module of the higher level library is built on a lower level CAN library I wrote to the Canpie spec, but the higher level library has a lot of other stuff like generic interfaces to GPIO, timers, UART etc.

Now when I test just the low level Canpie library functions, everything works fine. But when I use my higher level library the data segments in my CAN packets are not what they should be. The higher level library calls the exact same functions as my Canpie test does as well. Right now I'm trying to pass a CAN packet full of 0's in the data segment (DLC of 8) but my output has occasional bits changed or simply doesn't give out a valid CAN packet, though the ID is always fine. I really have no idea what could be causing this and would appreciate any help. I'm worried it could be some sort of memory or stack issue, but the DA registers on the C_CAN0 peripheral never go non-zero as far as I can see in debugging so I still have no idea what it could be.

I've attached a sample of the output I get from my Salae logic analyser, hooked up to the TX pin on the LPC1549 dev board, reminder that the data should be all zeroes. In case it helps anyone.

Time [s] Analyzer Name Decoded Protocol Result
2.255614CANExtended CAN Identifier: 405898241
2.255686CANControl Field: 8 bytes
2.255694CANData Field Byte: 0
2.255714CANData Field Byte: 0
2.255732CANData Field Byte: 0
2.255752CANData Field Byte: 0
2.255772CANData Field Byte: 8
2.255788CANData Field Byte: 0
2.255808CANData Field Byte: 0
2.255826CANData Field Byte: 0
2.255846CANCRC value: 20654
2.255878CANNAK
3.149655CANExtended CAN Identifier: 405898241
3.149727CANControl Field: 8 bytes
3.149735CANData Field Byte: 0
3.149755CANData Field Byte: 0
3.149773CANData Field Byte: 0
3.149793CANData Field Byte: 0
3.149813CANData Field Byte: 8
3.149829CANData Field Byte: 0
3.149849CANData Field Byte: 0
3.149867CANData Field Byte: 0
3.149887CANCRC value: 20654
3.149919CANNAK
4.220714CANExtended CAN Identifier: 405898241
4.220786CANControl Field: 8 bytes
4.220794CANData Field Byte: 0
4.220814CANData Field Byte: 0
4.220832CANData Field Byte: 0
4.220852CANData Field Byte: 0
4.220872CANData Field Byte: 8
4.220888CANData Field Byte: 0
4.220908CANData Field Byte: 0
4.220926CANData Field Byte: 0
4.220946CANCRC value: 20654
4.220978CANNAK
5.03876CANExtended CAN Identifier: 405898241
5.038832CANControl Field: 8 bytes
5.03884CANData Field Byte: 0
5.03886CANData Field Byte: 0
5.038878CANData Field Byte: 0
5.038898CANData Field Byte: 1
5.038916CANData Field Byte: 0
5.038934CANData Field Byte: 0
5.038954CANData Field Byte: 0
5.038972CANData Field Byte: 0
5.038992CANCRC value: 20654
5.039024CANNAK
5.869806CANExtended CAN Identifier: 405898241
5.869878CANControl Field: 8 bytes
5.869886CANData Field Byte: 0
5.869906CANData Field Byte: 0
5.869924CANData Field Byte: 0
5.869944CANData Field Byte: 0
5.869964CANData Field Byte: 8
5.86998CANData Field Byte: 0
5.87CANData Field Byte: 0
5.870018CANData Field Byte: 0
5.870038CANCRC value: 20654
5.87007CANNAK
6.634848CANExtended CAN Identifier: 405898241
6.63492CANControl Field: 8 bytes
6.634928CANData Field Byte: 0
6.634948CANData Field Byte: 0
6.634966CANData Field Byte: 0
6.634986CANData Field Byte: 0
6.635006CANData Field Byte: 8
6.635022CANData Field Byte: 0
6.635042CANData Field Byte: 0
6.63506CANData Field Byte: 0
6.63508CANCRC value: 20654
6.635112CANNAK
Labels (2)
Tags (2)
0 Kudos
0 Replies