How can i compile this?

recently I wanted to start with the development in a dsp (al3201), this dsp is controlled by a microcontroller, I found the code to load it but I don't know how to compile it and load it in the microcontroller, I hope someone can help me with two things:
How can I compile and upload it to the microcontroller or at least pass all the code to a .hex?
that code from what I saw (I'm really not good at programming) is for an atmel128, my question is: what changes would I have to make to make it work on an arduino uno or nano?
avr.zip (5,2 KB)

Well you are pretty well messed up. The very first thing is to make sure the original code will compile and do what you want with the processor it was coded for. If you start off converting unknown code, how will you determine your mistakes or original programmer mistakes.

By the way, no one will open an unknown zip file from the internet.
The minimum you can do is unzip it yourself and try to post it on the forum.

what I saw is from a forum that talked about that, the code seems to be fine because I think it's what the manufacturer gave, only years ago they deleted all the information about it, by the way sorry for the .zip only that they were some files but here the uncompressed attachments
https://drive.google.com/drive/folders/1psHyqyedW96SwUlouK5DvyavxOIMoVLy?usp=sharing
I leave it on drive because it won't let me upload some extensions

Can you clarify? Do you have the al3201 on a printed circuit board with all the external components such ax crystal and bypass caps already to go to begin your Arduino program development?

Can you clarify which Arduino you are suggesting you will develop the code on?

yes , i have a pcb with everything the al3201 needs to work perfectly to load other programs, i made a thread in this forum for more information

I plan to use all that code in an atmega328 in an arduino nano

Won't work. The code uses PORTA and the ATmega328p doesn't have a PORTA. I suspect the code was written for the olde 40-pin ATmega48 which had 32 data pins. PORTA was the analog input pins, merged into PORTC on the ATmega328p.

(Edit) Oops... Nevermind. It's written for the ATmega128. It shouldn't be too hard to get it to work on the Arduino MEGA 2560.

The serial protocol is running at 38400 baud.

If a character has the top bit set, the bottom 7 bits are the "MemoryClass".

MemoryClass 0:
Each of the first 8 characters has 4 bits of a 32-bit data word, MSB first.
The next two characters have 4 bits each of an 8-bit address, MSB first.
If the address is less than 128 the word is put into the 130-entry uint32_t array ProgArea.

MemoryClass 2:
Each of the first 8 characters has 4 bits of a 32-bit data word, MSB first.
The next character has 7 bits of an 8-bit address.
128 (0x80) is added to the address.
If the address is less than 130 the word is put into the 130-entry uint32_t array ProgArea. (This is the only way to set entries 128 and 129.)

MemoryClass 8:
The first two characters have 4 bits each of an 8-bit address, MSB first.
This class triggers a reply with 8 nibbles of the ProgArea word at the specified address.

Note: Every time a character is received, the receive ISR sets a counter to 3. A Timer1 interrupt decrements the counter every 0.5 milliseconds (I think they ran the ATmega128 at 8 MHz to get 1 millisecond intervals). When the count reaches 0 the "NeedProg" flag is set to tell loop() to process the input. Basically, a 3 millisecond timeout to detect the end of a message.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.