angel | Posted: 8 Jun 2017, 10:25 AM |
---|---|
Member Posts: 4 Joined: 8-June 17 |
Hello Mit, hello everyone I am new to this forum, I write from Spain. It is a pleasure to find places like this in the ocean. I am interested in the Kiloboot project, my field is not electronics, but recently I had to find a way to update a series of old boards, which have an ATmega328p microcontroller and an ENC28J60. Unfortunately, the pinout used is not the same as the HEX compiled file. This would be the pinout used: D8 - PB0 - CS D11 - PB3 - MOSI D12 - PB4 - MISO D13 - PB5 - SCK And INT do not know if it is used. I'd like to ask you how I could use your Kiloboot with my pinout. Thank you and greetings. ------------- |
[top] | |
mit | Posted: 8 Jun 2017, 01:42 PM |
yeah whatever Admin Posts: 566 Joined: 4-May 16 |
Hi, welcome. PB3, PB4 and PB5 are the hardware SPI pins of the chip, so they have to be used for MOSI, MISO, SCK. But the other two pins, CS and INT are just used for signalling and can be changed to any other pins. To change the CS pin to PB0 is easy. I think you just need to do a search-and-replace of "PB2" into "PB0". Looking at the code, you'll also need to change line 417 because I forgot to type it as PB2 there. The line should have been: ldi r16, (1<<PB2)|(1<<PB3)|(1<<PB5) so it needs changing to: ldi r16, (1<<PB0)|(1<<PB3)|(1<<PB5) The INT pin is a little more work. You're not the first person to ask about changing the code to not need it, it should be possible to poll the packet-count register on the chip. If I get some free time I might try and implement it. In the mean time, would it be possible to wire up the INT pin? It doesn't really matter which pin it goes to on the ATmega, one of the PORTB pins will be easier, then you can just search-and-replace PB1. ------------- |
[top] | |
angel | Posted: 8 Jun 2017, 05:18 PM |
Member Posts: 4 Joined: 8-June 17 |
Excellent answer! The problem I have is that it is not a development board, it is already assembled. Maybe I can bridge the ATmega as you say. I will try it and I will comment. Thank you very much!!! ------------- |
[top] | |
mit | Posted: 14 Jun 2017, 11:09 PM |
yeah whatever Admin Posts: 566 Joined: 4-May 16 |
I have altered the bootloader to no longer require the INT pin. I just pushed it to github. https://github.com/mitxela/kiloboot I also added a define at the beginning to make changing the CS pin easier. ------------- |
[top] | |
mit | Posted: 29 Jul 2017, 04:20 PM |
yeah whatever Admin Posts: 566 Joined: 4-May 16 |
Update: there was an error with the CS_PIN definition. The hardware SPI uses PB2 as a chip select pin. Although we can use any pin as a chip select in master mode, the hardware still listens to PB2, so it needs to either be held high, or set as an output, for the SPI to work correctly. So that line in the post above should really be:
------------- |
[top] | |
Sign in to post a reply.