Samstag, 17. November 2012

[TBL-AVR] Hardware Test for functionality

Well, after I ran blindly into some debugging I realized after 15min wondering why the easiest things doesn't work that AVR-Studio somehow switched back to AVR-Simulator instead of JTAGICE3 for debugging - and I wondered that the program download was sooo fast ^^


Here's the first test Program.. Max485_t is a struct written by me that represents the UART and related RW-Toggle pin.

For further information look at:
http://avrlab.com/upload_files/MAX3082-1.pdf

 int main(void) 
 {      
      system_clocks_init(); 
      MAX485_t max; 
      max.Port = &PORTD; 
      max.RW_bp = PIN5_bp; 
      max.Usart = &USARTD1; 
      max.Baudrate = 38400; 
      max.Databytes = USART_CHSIZE_8BIT_gc; 
      max.Parity = USART_PMODE_DISABLED_gc; 
      max.TwoStopBits = 0; 
      max485_init(&max); 
      unsigned char test[] = "hallo thomas"; 
      max485_enable(&max); 
      max485_send(&max, test, sizeof(test)); 
      while(1) 
      { 
      }           
 } 

... source code of test function, sends "hallo thomas" on USART1 of PortD to the PC


Examining the Result on PC via Hterm I got this:






Well, that work's nice, but some mates may now see there's a 0x00 byte at the end that was never sent on purpose... Luckily I worked with this PCB before, so I don't have to spend another day of searching for the cause of this - it's some hardware fault ;)

explained in the next post...




Keine Kommentare:

Kommentar veröffentlichen