All the messages with 8 bytes of data!!!
2009/8/4 IGOR <igorreal@...>
Hi guys!!Now, Iīve done a better test....Two ATMega168+MCP2515 and PEAK SYSTEM USB<=>CAN- Clock Speed ATMega and MCP2515 => 16 Mhz- Bus Speed => 1Mbit/s- SPI => 8 Mhz (Fosc/2)+ Boards => Arduino Diecimila+ SPI <-->CAN => http://www.avrcard.com/products/can_adapter.htm+ "Sniffer" => http://www.peak-system.com/Product-Details.49+M578cbdb898b.0.html?&L=1&tx_commerce_pi1[catUid]=6&tx_commerce_pi1[showUid]=16Software method to get the Incomming msgs=> Polling (Timer 2 event every 1 ms).At the moment,Iīm not implement RX interrupt to get it.* One of ATMega => Sends 16 periodic messages (20 ms).* Second ATMega => Receive can messages and send again with ID+1 and multiply per two data bytes. (To add a little math operation to check what happens).With sniffer I can check can bus activity. The ID messages and ID+1 have the same counters in my sniffer tool => OK!!I think the problems in my last tests was try to send many messages with short time between them (I canīt control this with the USB <-->CAN device), which itīs equivalent to a huge load can bus activity. Althought the periods were of 20 ms, the device try to send all the mesagges at the same time.I think, this is enought power for my application.... But just in case, Iīve ordered an AT90CAN128 (Olimex prototype board) to Sparkfun. Iīm going to add more messages and less period to find the limits....What is your opinion?Regards,Igor
---------- Forwarded message ----------
From: IGOR <igorreal@...>
Date: 2009/8/4
Subject: Re: [CANLIST] Microcontroller with CAN feature inside VS external controller (MCP2515)To: canlist@...
Hi John,
A small briefing:
- SPI Speed = 8 Mhz
- Bit rate = 1Mbit/s
- Tx Objects of MCP2515 = 3
- Data bytes of all messages = 8
Electronic:
PC with PEAK USB-CAN <====can bus ====> ATMega168+ SPI-CAN from www.avrcards.com
Hardware Links:
- http://www.peak-system.com/Product-Details.49+M578cbdb898b.0.html?&L=1&tx_commerce_pi1[catUid]=6&tx_commerce_pi1[showUid]=16#
- http://www.avrcard.com/products/can_adapter.htm
Today Iīm going to do a test controlling the time between messages, because I think that Iīm not doing good my test to know the maximum bus load capacity of the system.
Iīll keep you updated...
Regards,
Igor
2009/8/4 John Dammeyer <johnd@...>
Hi,So how fast are you running your SPI?What bit rate are you using?How many Tx Objects are you using?When you send a message to the MCP2515 how many bytes do you transfer.How do you signal that a message should be sent?You have so many variables here and no reports of controlling any of those. Pretty hard to help you debug.Subject: Re: [CANLIST] Microcontroller with CAN feature inside VS external controller (MCP2515)Hi,
Thank you very much for your support. There are too many good answers, and with a lot of experience behind them.
Iīm able to choose the micro which I want, there isnīt a problem (within reasonable). I would like to do the project with an Atmel micro, because the C compiler and tools are free...
In the begining,the idea of external CAN controller liked me because I could choose different micros without problems of CAN feature.
Iīve continued this days doing small test with ATMega168 and MCP2515 and I canīt improve more than 7-8 mensajes (all with 20 ms of period).
What I do is check with an USB to CAN device (Peak Systems) which has a small tool. I send with it these messanges.
The ATMega160, received them and resend with ID+1.
I can follow the TX counter and the RX counter. Seven is the maximum without no difference between TX and RX counters of each ID menssage.
I donīt know if this test is too stressing, because I canīt control when this menssages start (thinking in absolute time). Because you can have this period but with enough time between menssages to be saved.... Am I right? For example, if I start sending messages as:
ABSOLUTE TIME
t=0 ms, ID=100, next message at 20 ms, 40ms,...
t=3 ms, ID=102, next message at 22 ms, 42ms,..
t=6 ms, ID=104, next message at 24 ms, 44 ms,..
..
It not the same if I have:
t=0 ms, ID=100, next message at 20 ms, 40ms,...
t=0,5 ms, ID=102, next message at 20.5 ms, 41ms,..
t=1 ms, ID=104, next message at 21 ms, 41.5 ms,..
..
I mean, could be happening that the phase(time between messages) is being too sort, and in addition my software is not debugged enough......What do you think?
Iīve always used CAN bus as user (automotive data acquisition), but never as designer-programmer. Althought Iīm going to choose a microcontroller with can inside, I would like to know the power of mcp2515...ha,ha,ha
Regards,
Igor
2009/8/3 Allen Pothoof <apothoof@...>
Igor,
I did a system with the ATMega128 (programmed in C) and the MCP2510; this was a production system, not a test or prototype. I was given the hardware and told to make it work, which I did, but we didn't run any tests to see what happened if we cranked up the bus speed or started loading it to 80% or 90% bus capacity.
Regards,
Allen Pothoof
Date: Sun, 2 Aug 2009 18:36:05 +0200
Subject: Re: [CANLIST] Microcontroller with CAN feature inside VS external controller (MCP2515)
From: igorreal@...
To: canlist@...
Hi Allen,
Thank you very much for your answer.
- Did your test done with ATMega programmed in C?
If the answer is yes, then something itīs happening to my code...
I have ATMega168+MCP2515 both at 16 Mhz and SPI speed at 8 MHz (Fosc/2).
To try to evaluate de power of the microcontroller and my software, Iīve connected my electronic to a CAN BUS sniffer (PEAK SYSTEMS USB to CAN http://www.peak-system.com/Product-Details.49+M578cbdb898b.0.html?&L=1&tx_commerce_pi1[catUid]=6&tx_commerce_pi1[showUid]=16).
My software resends the incoming menssages to ATMega168+MCP2515 with ID+1 and I can follow with the sniffer in my computer TX and RX menssages counters and periods.
Now, the maximum are 7 menssages without modify the original period which they have been transmited (20 ms). When I increase the number of menssages, I see in the sniffer the periods of ID+1 menssages decrease...
At this moment, Iīm not using filters because I would like to know the power of the system.
Regards,
Igor
2009/8/2 Allen Pothoof <apothoof@...>
Igor,
I've used both internal and external (SPI) CAN controllers; externally, you can't tell the difference. External controllers are intrinsically slower to process messages (more overhead) but, with well designed code, 250K and 500K busses should be no problem; I haven't tried 1M but, with the speeds microcontrollers are capable of these days, it should be achievable. My primary concern would be how fast you could crank up the transfer speed between the micro and the CAN controller.
I've used the ATMega 8-bit microcontrollers; 15-20 messages in 10-20 ms should not stress it (depending on what else it has to do, of course).
One comment I might make is to use the filtering capabilities of the CAN controller (either external or internal) to do as much of the sorting as you can. I've had times when the IDs of the messages were so dispersed that I had to open the filters up, receive every message, and sort it out in the software. If you can cut out half the messages with the filters, that's 50% less incoming message processing you have to do.
Regards,
Allen Pothoof
Date: Sun, 2 Aug 2009 12:28:07 +0200
Subject: [CANLIST] Microcontroller with CAN feature inside VS external controller (MCP2515)
From: igorreal@...
To: canlist@...
Hi,
My name is Igor and itīs the first time I writte in this forum. I donīt know if this question has been answered in the past...sorry!
Iīve doubts about CAN Bus devices:
Is there any difference between using an 8 bits microcontroller with the CAN feature inside or using an external SPI controller,i.e., MCP2515? I mean if itīs possible to achieve more power or itīs similar.
What do you think about the power of an ATMega 8 bits microcontroller processing 15-20 traces with a period of 10-20 ms? (Programming in C)
Actually, Iīve an Arduino Diecimila with SPI <-->CAN (http://www.avrcard.com/products/can_adapter.htm) working. But I canīt achieve a big speed of processing and I would like to know if itīs normal or something itīs happenning.
Iīve done a program which send again to CAN bus the messanges received with ID+1.With a CAN BUS sniffer, I can follow what itīs hapenning.
At 1 Mbit/s of speed, I achieve resend a maximum of 7 mensagges at 20 ms of period which were originally sent. This isnīt too much, but maybe itīs for a 8 bits microcontroller with an external CAN BUS controller...anyone knows it?
Maybe changing to a microcontroller with CAN feature inside is a big improvement or maybe itīs a problem of my code...
Anyone has done this test? I would like to use it in automotive application (500 Kbit/s and mensagges with periods of 10-20 ms). I would like to know if an 8 bits controller has the enought power to manage 20 mensagges in "real time (20ms)" or if itīs too much. (Receive + look correct ID+ save in a stack + extract individual channels inside mensagge (motorola or intel format)with their linearization).
Thank you.
Regards,
Igor R
Windows Live: Keep your life in sync. Check it out.
Express your personality in color! Preview and select themes for HotmailŪ. Try it now.