Is it possible to change Atmega48 source code? How to?

Discussion specific to NXT-G, NXC, NBC, RobotC, Lejos, and more.
Post Reply
ricardocrl
Posts: 117
Joined: 27 Dec 2010, 19:27

Is it possible to change Atmega48 source code? How to?

Post by ricardocrl »

Hi,

I would like to change some code in the source code of the Atmega48.
I am using the IAR workbench, but as I understand, it uses compiled code for the Atmega48 and/or simply only flashes new Firmware to the main processor, is that right?

Thank you!
mattallen37
Posts: 1818
Joined: 02 Oct 2010, 02:19
Location: Michigan USA
Contact:

Re: Is it possible to change Atmega48 source code? How to?

Post by mattallen37 »

Here is a direct download link for downloading the FW source-code from the mindstorms website (I think it's version 1.29 of the ARM FW, but you want the AtMega source anyhow).

Here is a link to the NBC/NXC EFW v1.32 source-code.

Both of the linked to source-codes include the source code of the AtMega48. I'm not sure if they are the same, but I would assume so.

I think in order to change the binary of the AtMega48 co processor in the NXT, you would need to use a JTAG (which would require opening the NXT and soldering to the PCB), which you probably already know.
Matt
http://mattallen37.wordpress.com/

I'm all for gun control... that's why I use both hands when shooting ;)
ricardocrl
Posts: 117
Joined: 27 Dec 2010, 19:27

Re: Is it possible to change Atmega48 source code? How to?

Post by ricardocrl »

Yes, I have the source code, and I have lost time deciding where and what to change before I came with the question "how to compile and flash". :-)
I think in order to change the binary of the AtMega48 co processor in the NXT, you would need to use a JTAG (which would require opening the NXT and soldering to the PCB), which you probably already know.
That's a tough new... Can anyone else confirm this?

I didn't really want to reach hardware, for many reasons (LEGO purist geek, danger of damaging, lazy to do it, no tools, etc).
mattallen37
Posts: 1818
Joined: 02 Oct 2010, 02:19
Location: Michigan USA
Contact:

Re: Is it possible to change Atmega48 source code? How to?

Post by mattallen37 »

For the SW side (assuming you're using Windows), I suggest WIN AVR. I have used it a little for programming an AtMega328, and it seems to work nicely.

For the HW side, looking at the schematic and PCB of the NXT, it looks like you could program it using ICSP (and if so, this programmer should work fine). I'm quite sure though that the AtMega48 in the NXT doesn't have a bootloader, so you will certainly need to open the NXT and solder to the programming header.
Matt
http://mattallen37.wordpress.com/

I'm all for gun control... that's why I use both hands when shooting ;)
ricardocrl
Posts: 117
Joined: 27 Dec 2010, 19:27

Re: Is it possible to change Atmega48 source code? How to?

Post by ricardocrl »

Thank you mattallen!

It looks feasible and fun to try once at least. But I personally like more flexible/reusable solutions. I wouldn't like to have to do everything again if I change NXT by some reason.

Just for curiosity, what I was planning to change is something that maybe others could need. It's increasing the resolution of the PWM given to a motor. Right now, the Atmega48 scales the range 0-100 to 0-255. My goal would be to control the full range of 255 values.
I am needing it for a very specific project, it won't probably be need for most of the applications.
mattallen37
Posts: 1818
Joined: 02 Oct 2010, 02:19
Location: Michigan USA
Contact:

Re: Is it possible to change Atmega48 source code? How to?

Post by mattallen37 »

You will need to make sure that the ARM7 > AtMega48 data stream will support the extra bit. Most likely you will need to change the ARM7 FW as well.
Matt
http://mattallen37.wordpress.com/

I'm all for gun control... that's why I use both hands when shooting ;)
Post Reply

Who is online

Users browsing this forum: Semrush [Bot] and 46 guests