File tree Expand file tree Collapse file tree 4 files changed +16
-16
lines changed Expand file tree Collapse file tree 4 files changed +16
-16
lines changed Original file line number Diff line number Diff line change 16
16
// Functions
17
17
//////////////////////////////////////////////////////////////////////////
18
18
19
+ // Demo code to check if selected baud rate works on device
19
20
int main (void )
20
21
{
21
22
// initializes IO
22
23
tinyuart_init ();
23
-
24
- _delay_us (40 );
24
+ _delay_us (10 );
25
25
// toggle pattern test: after every bit delay the TX pin is toggled
26
- // tinyuart_send_uint8(0b01010101);
27
- // _delay_us(10);
26
+ tinyuart_send_uint8 (0b01010101 );
27
+ _delay_us (10 );
28
28
29
29
// every character test: verify that your receiver can read all chars at the chosen baud rate
30
30
// cheap UART-USB converts often have an issue with 0x00
@@ -34,6 +34,7 @@ int main(void)
34
34
_delay_us (10 );
35
35
}
36
36
37
+ // Test 0x00 to catch any glitches
37
38
while (1 )
38
39
{
39
40
tinyuart_send_uint8 (0 );
Original file line number Diff line number Diff line change 43
43
</DebugFile >
44
44
</AAFDebugFiles >
45
45
</AAFDebugger >
46
- <avrtool >com.atmel.avrdbg.tool.avrdragon</avrtool >
47
- <avrtoolserialnumber >00A200050668</avrtoolserialnumber >
46
+ <avrtool >com.atmel.avrdbg.tool.simulator</avrtool >
47
+ <avrtoolserialnumber >
48
+ </avrtoolserialnumber >
48
49
<avrdeviceexpectedsignature >0x1E9007</avrdeviceexpectedsignature >
49
50
<com_atmel_avrdbg_tool_simulator >
50
51
<ToolOptions >
70
71
</dependencies >
71
72
</framework-data >
72
73
</AsfFrameworkConfig >
73
- <avrtoolinterface >ISP</avrtoolinterface >
74
+ <avrtoolinterface >
75
+ </avrtoolinterface >
74
76
<com_atmel_avrdbg_tool_avrdragon >
75
77
<ToolOptions >
76
78
<InterfaceProperties >
Original file line number Diff line number Diff line change 46
46
47
47
// convert additional delay into NOPs
48
48
#if CYCLES_EXTRA == 2
49
- #define _cycle_nop () "nop\n\t nop\n\t"
49
+ #define cycle_nop "nop \n\t nop \n\t"
50
50
#elif CYCLES_EXTRA == 1
51
- #define _cycle_nop () "nop\n\t"
51
+ #define cycle_nop "nop \n\t"
52
+ #else
53
+ #define cycle_nop /*empty*/
52
54
#endif
53
55
54
56
@@ -114,12 +116,7 @@ void tinyuart_send_uint8(uint8_t data)
114
116
"send_bit:"
115
117
"mov __tmp_reg__, %[loops] \n\t" // bit delay loop
116
118
117
- #if CYCLES_EXTRA == 2 // insert nops for cycle-accurate delays
118
- "nop \n\t"
119
- "nop \n\t"
120
- #elif CYCLES_EXTRA == 1
121
- "nop \n\t"
122
- #endif
119
+ cycle_nop // insert nops for cycle-accurate delays
123
120
124
121
"send_bit_delay:"
125
122
"dec __tmp_reg__ \n\t"
Original file line number Diff line number Diff line change 21
21
#define TINYUART_F_CPU 9600000
22
22
23
23
// select a baud rate
24
- #define TINYUART_BAUD 500000
24
+ #define TINYUART_BAUD 115200
25
25
26
26
// specify pins used
27
27
#define TINYUART_PORT PORTB
You can’t perform that action at this time.
0 commit comments