thomasonw / NMEA2000_avr

A driver for the NMEA2000 Arduino library and Atmel CAN enabled AVR CPUs
8 stars 8 forks source link

ATMega64M1 freezes after a few seconds #3

Open tmcadam opened 5 years ago

tmcadam commented 5 years ago

Thank you very much for this library (and your others). I have put together a test and am having a small problem. I am an ATMega64M1 and have tested 2551 and 2562 transceivers. Both work initially then freeze after a few seconds. If the board is disconnected from the bus, it doesn't freeze. If I switch off the Garmin chartplotter off it doesn't freeze. The Garmin outputs a few messages, my theory is that this is causing the problem.

Do you think 4kb is enough memory? Should I be applying some of the strategies to reduce memory usage mentioned in the NMEA 2000 docs?

thomasonw commented 5 years ago

Hello. You may be onto something with regards to memory. Are you using Timo’s NMEA2000 lib? In my usage, I did need to take config steps to reduce memory usage with that lib

tmcadam commented 5 years ago

Thanks for the reply. Yes I'm using Timo's library. I followed his guide on memory reduction and my device is running reliably now.

I moved product information to PROGMEM and set : NMEA2000.SetN2kCANMsgBufSize(2); NMEA2000.SetN2kCANSendFrameBufSize(15);

I am creating a simple sending node for a sensor, so I don't think that reducing these buffers will create a problem. What do you think?