Moteino Mega Core Questions

Started by Leonid49, December 23, 2017, 09:50:43 AM

Leonid49

Hi.
I have some questions about the Moteino Mega Core:
1. On scheme of Moteino Mega are pointed controllers Atmega 644/1284(TQFP44). But bootloader is for Atmega 1284 only
    (DualOptiboot_V5.0_atmega1284p_BlinkD15_SPIdisable.hex). Could it means that this bootloader fit for Atmega 644 as well?
    And what does mean in bootloders name SPIdisable - can not upload sketches via SPI? 
2. Does it enough to use RFM69-master library for using Moteino Mega with RFM69 like Moteino?
3. I have Pololu USB AVR programmer  v2 which should be choosed in an Arduino IDE as AVR STK500 development board.
    This programmer allows upload sketches on an uC via  serial TTL (Rx, Tx) or SPI interfaces. Does it allows STK500 to upload sketches,
    which haves size more then 64Kb or bootloader limits size 64K?
Thaks.
Leonid.

I add: explayn me please why can not I download the program through SPI?

Felix

1. I support the 1284p only since that is what I use in the MoteinoMEGA's manufacture. But the 644p is the same chip with half the memory, you could easily adapt the core on your own to work with it. Not sure if the 1284p bootloader will run on 644, trying it should be easy. SPIDisable means SPI is disabled after the bootloader runs.
2. Yes
3. It should but I don't know since I never used that programmer ... maybe ask pololu, they should know since they made it.

Quote from: Leonid49 on December 23, 2017, 09:50:43 AM
I add: explayn me please why can not I download the program through SPI?

Please give more detail, but the SPI is only used in ISP programming, not in STK-serial programming.

Leonid49

Thanks, Felix.
QuotePlease give more detail, but the SPI is only used in ISP programming, not in STK-serial programming.
In my project I use Atmega 1284, RFM69HW and MAX485 for Modbus. 1284 and RFM69 are talking each other via SPI,
1284 and MAX485 via USART0 (so USART0 is busy and through it  can not upload sketches). USART1(TX1) I use for debuging. It would be very  conveniently upload sketches in an 1284 via SPI as well. In this case programmer  will be connected right to the SPI port of uC, and port SPI(MOSI, MISO, SCK) of uC will be connected to the SPI port of RFM69 via resistors 1K. Does it can be so?

Felix

No, the bootloaders use STK serial programming, not SPI or ISP.
You can use ISP programming via the SPI pins, then you don't even need a bootloader.

Leonid49

Thank You, Felix.

I will try without bootloader.
Tell me please how I can remove the bootloader if needed?

Leonid.

Felix

You can just overwrite it with your program. Or you can do an ISP chip erase.

Leonid49


RatTrap

Since the question has already been posed here I thought I might ask for a little elaboration on two points.

When you say that the SPI is disabled after the bootloader runs does that mean that it is disabled for programming via the ICSP pins or it is disabled completely and things like SPI flash and the HopeRF RFM69HCW will no longer be able to communicate with the MCU over the SPI bus?

Where in the source or makefile of the bootloader or pins_def is the code that controls if SPI is disabled or not?

Also per your request Felix I am posting a copy of our correspondence regarding how to compile the bootloader once customized.  Again thank you for all that you do.

"I just wanted to drop an email and say thank you for all the work you do.  I have been studying your bootloader and honestly for me it might as well be written in malboje given how far over my head it is.  I am very grateful for all of the work you have done and all of the information that you put out there to the world.  I am trying to teach myself everything I can, and I was wondering if you had any recommendations for where I can learn how to do things like compile the bootloader.  You say to compile the source and the makefile and don't forget the pin_defs.h file, but if I'm being honest I don't know how to do that.  I have all of the files but lets say I wanted to change the LED pin on the moteinoMega I found that line of code to change but I don't have a clue how to build that into a hex file.  I'm not asking you to tell me, but a nudge in the correct direction so that I can learn it for myself would be awesome, because I just don't see an obviously correct way to do it Studio7.  Obviously there is a correct way, I just don't want to epically screw up any of my chips trying and doing something stupid.

Even if you can't give me a direction to go and learn, I still appreciate everything you do for the hobby community. Thank you.

Charlie


Hi Charlie,
Thanks for reaching out and for the feedback, I much appreciate it.

I wrote the code in notepad so I dont know the details of getting it to compile in Studio7.

The pindefs contains the definition of the LED and other such GPIO, i changed that for the Moteinos.

The optiboot/dualoptiboot source will require make and the gcc toolchain to be installed on your machine.

If you have arduino installed, its the easiest way to do it since it includes these tools.

Then you have to add the paths to your system path (on windows):
c:\arduino-1.8.7.103\hardwar\tools\avr\bin\
c:\arduino-1.8.7.103\hardwar\tools\avr\etc\

Then you can invoke make anywhere and it will build source code according to the makefile.

That's it, once you have the unmodified source compiled into a HEX/BIN then you can start editing code and rebuilding/testing your changes on a Moteino or other compatible AVR.

I hope this helps,

Please consider using the forum for (this and) follow up questions so others can contribute as well and we can keep it public for others that might ask the same thing in the future.

Thank you,

-Felix

Low Power Lab"