STK500v2 using UART1

Go To Last Post
6 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Will changing the UART receive and transfer ports in the stk500boot file available in the " https://github.com/arduino/Ardui... " from 0 to 1 will boot load via UART1 ?

If not, how do I boot load via UART1 using this boot loader ?

 

 

Thanks,

Srinivasa Varadhan

Last Edited: Mon. Feb 15, 2016 - 09:43 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I thought you were using mega1284? I don't see support in that for the 1284? You need to add a section like this:

	#define	UART_BAUD_RATE_LOW			UBRR0L
	#define	UART_STATUS_REG				UCSR0A
	#define	UART_CONTROL_REG			UCSR0B
	#define	UART_ENABLE_TRANSMITTER		TXEN0
	#define	UART_ENABLE_RECEIVER		RXEN0
	#define	UART_TRANSMIT_COMPLETE		TXC0
	#define	UART_RECEIVE_COMPLETE		RXC0
	#define	UART_DATA_REG				UDR0
	#define	UART_DOUBLE_SPEED			U2X0

but as I keep telling you (not sure why you started a new thread?) the fact is that if you want to switch a bootloader from UART 0 to UART 1 it is simply a case of changng the 0's to 1's so this would actually be:

	#define	UART_BAUD_RATE_LOW			UBRR1L
	#define	UART_STATUS_REG				UCSR1A
	#define	UART_CONTROL_REG			UCSR1B
	#define	UART_ENABLE_TRANSMITTER		TXEN1
	#define	UART_ENABLE_RECEIVER		RXEN1
	#define	UART_TRANSMIT_COMPLETE		TXC1
	#define	UART_RECEIVE_COMPLETE		RXC1
	#define	UART_DATA_REG				UDR1
	#define	UART_DOUBLE_SPEED			U2X1

As UART1 and UART0 in the 1284 are identical then simply switching these 0's to 1's is all you require.

 

But why keep posting threads about this? Why not simply try what is obvious anyway?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi clawson,

 

Thank you for writing it back. Yes you are right. I am working with atmega1284 and also with atmega2560. I thought stk500v2 will be compatible for both the MCU's. This won't function with mega1284 ?

I have one more doubt. If I have bluetooth module on the UART1 and type the following code below my bootloader code, will the MCU will flash he files via Bluetooth, provided I have a mobile app already connected to HC 05 and I have a terminal in mobile to send avrdude commands to flash ?

 

Quote:
if (Serial1.available())
{
  p = Serial1.read();   // 
    if (p == '1')   { 
soft_restart();

 

Correct me if I am wrong or my misconception .

Thanks,

Srinivasa Varadhan

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi clawson, 

 

One another doubt is, why do we need to use UART_DOUBLE_SPEED ?

Thanks,

Srinivasa Varadhan

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

srinivardhan wrote:
This won't function with mega1284 ?

Well it willI guess. It will use this default section:

#elif defined(UBRR0L) && defined(UCSR0A) && defined(TXEN0)
	/* ATMega with two USART, use UART0 */
	#define	UART_BAUD_RATE_LOW			UBRR0L
	#define	UART_STATUS_REG				UCSR0A
	#define	UART_CONTROL_REG			UCSR0B
	#define	UART_ENABLE_TRANSMITTER		TXEN0
	#define	UART_ENABLE_RECEIVER		RXEN0
	#define	UART_TRANSMIT_COMPLETE		TXC0
	#define	UART_RECEIVE_COMPLETE		RXC0
	#define	UART_DATA_REG				UDR0
	#define	UART_DOUBLE_SPEED			U2X0

so change everything there from 0's to 1's

srinivardhan wrote:
I have one more doubt. If I have bluetooth module on the UART1 and type the following code below my bootloader code, will the MCU will flash he files via Bluetooth
I'm sorry but it seems to me that you clearly have no idea how to go about this. I could answer your next 50 questions about this but I'm still not confident you are going to be able to do this (and I don't plan on writing it for you). Your current programming skills do not appear to be developed enough to take on the challenge of what you are currently attempting. If I were you I'd park this project for a few months and just run some experiments on the basics of what you need - like the simple question of how you configure the bluetooth module to make a link. Without this kind of fundamental knowledge in place you cannot apply it to the more complex task of merging this into a bootloader.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi clawson,

 

Thank you for writing it. Yes I am newbie and I do not have a sound programming knowledge. As you say, I will learn the fundamentals and then jump into this project.

But one doubt that I want to clear with you is, by passing a softwareReset will the control go to the bootloader ? And how long the boot loader will wait for new software update before it starts functioning the existing application code. ?

Thanks,

Srinivasa Varadhan