diff --git a/boards/Spannungsversorgung.kicad_pcb b/boards/Spannungsversorgung.kicad_pcb index d174240..870ed12 100644 --- a/boards/Spannungsversorgung.kicad_pcb +++ b/boards/Spannungsversorgung.kicad_pcb @@ -1,9 +1,9 @@ (kicad_pcb (version 4) (host pcbnew 4.0.2+dfsg1-stable) (general - (links 26) + (links 27) (no_connects 0) - (area 81.124379 58.391666 121.960504 114.64) + (area 81.124379 58.391666 121.961002 114.64) (thickness 1.6) (drawings 0) (tracks 108) @@ -64,7 +64,7 @@ (aux_axis_origin 0 0) (visible_elements FFFFFF7F) (pcbplotparams - (layerselection 0x00030_80000001) + (layerselection 0x00000_00000001) (usegerberextensions false) (excludeedgelayer true) (linewidth 0.100000) @@ -83,8 +83,8 @@ (plotinvisibletext false) (padsonsilk false) (subtractmaskfromsilk false) - (outputformat 1) - (mirror false) + (outputformat 4) + (mirror true) (drillshape 1) (scaleselection 1) (outputdirectory "")) @@ -678,4 +678,278 @@ (segment (start 95.326839 88.9) (end 95.1001 88.9) (width 0.25) (layer F.Cu) (net 6)) (segment (start 99.06 86.36) (end 101.6 86.36) (width 0.25) (layer F.Cu) (net 6)) + (zone (net 0) (net_name "") (layer F.Cu) (tstamp 0) (hatch edge 0.508) + (connect_pads (clearance 0.508)) + (min_thickness 0.254) + (fill yes (arc_segments 16) (thermal_gap 0.508) (thermal_bridge_width 0.508)) + (polygon + (pts + (xy 86.36 58.42) (xy 123.19 58.42) (xy 123.19 114.3) (xy 86.36 114.3) + ) + ) + (filled_polygon + (pts + (xy 123.063 114.173) (xy 86.487 114.173) (xy 86.487 87.14994) (xy 86.70316 87.14994) (xy 86.70316 90.65006) + (xy 86.747438 90.885377) (xy 86.88651 91.101501) (xy 87.09871 91.246491) (xy 87.3506 91.2975) (xy 88.625622 91.2975) + (xy 88.625622 92.5684) (xy 88.683474 92.859239) (xy 88.848221 93.105801) (xy 89.094783 93.270548) (xy 89.385622 93.3284) + (xy 97.7115 93.3284) (xy 97.7115 94.071798) (xy 95.771799 96.011499) (xy 95.607052 96.258061) (xy 95.5492 96.5489) + (xy 95.5492 100.15246) (xy 94.50959 100.15246) (xy 94.274273 100.196738) (xy 94.058149 100.33581) (xy 93.913159 100.54801) + (xy 93.86215 100.7999) (xy 93.86215 102.4001) (xy 93.906428 102.635417) (xy 94.0455 102.851541) (xy 94.2577 102.996531) + (xy 94.50959 103.04754) (xy 95.5492 103.04754) (xy 95.5492 107.77246) (xy 94.29879 107.77246) (xy 94.063473 107.816738) + (xy 93.847349 107.95581) (xy 93.702359 108.16801) (xy 93.65135 108.4199) (xy 93.65135 110.0201) (xy 93.695628 110.255417) + (xy 93.8347 110.471541) (xy 94.0469 110.616531) (xy 94.29879 110.66754) (xy 95.3384 110.66754) (xy 95.3384 111.76) + (xy 95.396252 112.050839) (xy 95.560999 112.297401) (xy 95.807561 112.462148) (xy 96.0984 112.52) (xy 107.70896 112.52) + (xy 107.70896 112.6236) (xy 107.753238 112.858917) (xy 107.89231 113.075041) (xy 108.10451 113.220031) (xy 108.3564 113.27104) + (xy 110.0836 113.27104) (xy 110.318917 113.226762) (xy 110.535041 113.08769) (xy 110.680031 112.87549) (xy 110.73104 112.6236) + (xy 110.73104 112.52) (xy 117.86896 112.52) (xy 117.86896 112.6236) (xy 117.913238 112.858917) (xy 118.05231 113.075041) + (xy 118.26451 113.220031) (xy 118.5164 113.27104) (xy 120.2436 113.27104) (xy 120.478917 113.226762) (xy 120.695041 113.08769) + (xy 120.840031 112.87549) (xy 120.89104 112.6236) (xy 120.89104 110.8964) (xy 120.846762 110.661083) (xy 120.70769 110.444959) + (xy 120.49549 110.299969) (xy 120.451655 110.291092) (xy 120.764526 109.822848) (xy 120.8786 109.249359) (xy 120.8786 109.190641) + (xy 120.764526 108.617152) (xy 120.43967 108.130971) (xy 120.388938 108.097073) (xy 122.173282 106.31352) (xy 122.17333 106.313449) + (xy 122.173401 106.313401) (xy 122.254909 106.191415) (xy 122.338084 106.066995) (xy 122.338101 106.066909) (xy 122.338148 106.066839) + (xy 122.366846 105.922563) (xy 122.396 105.776168) (xy 122.395983 105.776084) (xy 122.396 105.776) (xy 122.396 80.3146) + (xy 122.395984 80.314519) (xy 122.396 80.314438) (xy 122.367015 80.168886) (xy 122.338148 80.023761) (xy 122.338102 80.023692) + (xy 122.338086 80.023611) (xy 122.255255 79.899702) (xy 122.173401 79.777199) (xy 122.173333 79.777153) (xy 122.173287 79.777085) + (xy 121.770852 79.374821) (xy 122.071465 79.074137) (xy 122.153395 78.951488) (xy 122.236148 78.827639) (xy 122.236157 78.827593) + (xy 122.236182 78.827556) (xy 122.265149 78.681841) (xy 122.294 78.5368) (xy 122.294 63.4802) (xy 122.236148 63.189361) + (xy 122.071401 62.942799) (xy 121.824839 62.778052) (xy 121.534 62.7202) (xy 120.64629 62.7202) (xy 120.43967 62.410971) + (xy 119.953489 62.086115) (xy 119.38 61.972041) (xy 118.806511 62.086115) (xy 118.32033 62.410971) (xy 118.10048 62.74) + (xy 110.49952 62.74) (xy 110.27967 62.410971) (xy 109.793489 62.086115) (xy 109.22 61.972041) (xy 108.646511 62.086115) + (xy 108.16033 62.410971) (xy 107.94048 62.74) (xy 99.790102 62.74) (xy 98.632701 61.582599) (xy 98.41744 61.438767) + (xy 98.41744 60.12) (xy 98.373162 59.884683) (xy 98.23409 59.668559) (xy 98.02189 59.523569) (xy 97.77 59.47256) + (xy 95.27 59.47256) (xy 95.034683 59.516838) (xy 94.818559 59.65591) (xy 94.673569 59.86811) (xy 94.62256 60.12) + (xy 94.62256 64.12) (xy 94.666838 64.355317) (xy 94.80591 64.571441) (xy 95.01811 64.716431) (xy 95.27 64.76744) + (xy 97.77 64.76744) (xy 98.005317 64.723162) (xy 98.221441 64.58409) (xy 98.366431 64.37189) (xy 98.41744 64.12) + (xy 98.41744 63.516942) (xy 98.937899 64.037401) (xy 99.184461 64.202148) (xy 99.4753 64.26) (xy 107.94048 64.26) + (xy 108.146574 64.568442) (xy 108.121083 64.573238) (xy 107.904959 64.71231) (xy 107.759969 64.92451) (xy 107.70896 65.1764) + (xy 107.70896 65.28) (xy 100.595 65.28) (xy 100.594992 65.280002) (xy 100.594984 65.28) (xy 100.445663 65.309705) + (xy 100.304161 65.337852) (xy 100.304155 65.337856) (xy 100.304146 65.337858) (xy 100.17488 65.424234) (xy 100.057599 65.502599) + (xy 100.057595 65.502606) (xy 100.057588 65.50261) (xy 93.004787 72.55571) (xy 93.004785 72.555713) (xy 91.562999 73.997499) + (xy 91.398252 74.244061) (xy 91.3404 74.5349) (xy 91.3404 81.8035) (xy 90.35034 81.8035) (xy 90.115023 81.847778) + (xy 89.898899 81.98685) (xy 89.753909 82.19905) (xy 89.7029 82.45094) (xy 89.7029 85.95106) (xy 89.747178 86.186377) + (xy 89.88625 86.402501) (xy 90.032603 86.5025) (xy 87.3506 86.5025) (xy 87.115283 86.546778) (xy 86.899159 86.68585) + (xy 86.754169 86.89805) (xy 86.70316 87.14994) (xy 86.487 87.14994) (xy 86.487 58.547) (xy 123.063 58.547) + ) + ) + (filled_polygon + (pts + (xy 120.876 105.461099) (xy 118.842718 107.49348) (xy 118.84267 107.493551) (xy 118.842599 107.493599) (xy 118.760054 107.617136) + (xy 118.677917 107.740005) (xy 118.6779 107.740089) (xy 118.677852 107.740161) (xy 118.648721 107.886609) (xy 118.642993 107.915374) + (xy 118.32033 108.130971) (xy 118.10048 108.46) (xy 110.527462 108.46) (xy 110.491192 108.37222) (xy 110.069997 107.95029) + (xy 109.519398 107.721661) (xy 108.923218 107.721141) (xy 108.37222 107.948808) (xy 107.95029 108.370003) (xy 107.91292 108.46) + (xy 104.04705 108.46) (xy 104.04705 108.4199) (xy 104.002772 108.184583) (xy 103.8637 107.968459) (xy 103.6515 107.823469) + (xy 103.39961 107.77246) (xy 99.80043 107.77246) (xy 99.565113 107.816738) (xy 99.348989 107.95581) (xy 99.203999 108.16801) + (xy 99.15299 108.4199) (xy 99.15299 110.0201) (xy 99.197268 110.255417) (xy 99.33634 110.471541) (xy 99.54854 110.616531) + (xy 99.80043 110.66754) (xy 103.39961 110.66754) (xy 103.634927 110.623262) (xy 103.851051 110.48419) (xy 103.996041 110.27199) + (xy 104.04705 110.0201) (xy 104.04705 109.98) (xy 107.912538 109.98) (xy 107.948808 110.06778) (xy 108.165525 110.284876) + (xy 108.121083 110.293238) (xy 107.904959 110.43231) (xy 107.759969 110.64451) (xy 107.70896 110.8964) (xy 107.70896 111) + (xy 96.8584 111) (xy 96.8584 110.66754) (xy 97.89797 110.66754) (xy 98.133287 110.623262) (xy 98.349411 110.48419) + (xy 98.494401 110.27199) (xy 98.54541 110.0201) (xy 98.54541 108.4199) (xy 98.501132 108.184583) (xy 98.36206 107.968459) + (xy 98.14986 107.823469) (xy 97.89797 107.77246) (xy 97.0692 107.77246) (xy 97.0692 104.603) (xy 104.674 104.603) + (xy 104.67402 104.602996) (xy 104.67404 104.603) (xy 104.822408 104.57348) (xy 104.964839 104.545148) (xy 104.964855 104.545137) + (xy 104.964876 104.545133) (xy 105.09095 104.460883) (xy 105.211401 104.380401) (xy 105.211412 104.380384) (xy 105.211429 104.380373) + (xy 109.796825 99.7945) (xy 113.54 99.7945) (xy 113.54 100.532666) (xy 113.464683 100.546838) (xy 113.248559 100.68591) + (xy 113.200866 100.755711) (xy 113.16409 100.698559) (xy 112.95189 100.553569) (xy 112.7 100.50256) (xy 111.5 100.50256) + (xy 111.264683 100.546838) (xy 111.048559 100.68591) (xy 110.903569 100.89811) (xy 110.85256 101.15) (xy 110.85256 102.05) + (xy 110.896838 102.285317) (xy 111.03591 102.501441) (xy 111.24811 102.646431) (xy 111.34 102.665039) (xy 111.34 102.971) + (xy 111.397852 103.261839) (xy 111.562599 103.508401) (xy 111.809161 103.673148) (xy 112.1 103.731) (xy 116.137 103.731) + (xy 116.427839 103.673148) (xy 116.674401 103.508401) (xy 120.876 99.306802) + ) + ) + (filled_polygon + (pts + (xy 118.306574 110.288442) (xy 118.281083 110.293238) (xy 118.064959 110.43231) (xy 117.919969 110.64451) (xy 117.86896 110.8964) + (xy 117.86896 111) (xy 110.73104 111) (xy 110.73104 110.8964) (xy 110.686762 110.661083) (xy 110.54769 110.444959) + (xy 110.33549 110.299969) (xy 110.27218 110.287148) (xy 110.48971 110.069997) (xy 110.52708 109.98) (xy 118.10048 109.98) + ) + ) + (filled_polygon + (pts + (xy 105.910603 87.789705) (xy 106.057653 87.887959) (xy 106.157161 87.954448) (xy 106.157162 87.954448) (xy 106.157165 87.95445) + (xy 106.303 87.983458) (xy 106.303 90.6486) (xy 106.303009 90.648644) (xy 106.303 90.648688) (xy 106.331791 90.793342) + (xy 106.360852 90.939439) (xy 106.360877 90.939477) (xy 106.360886 90.939521) (xy 106.443707 91.06344) (xy 106.525599 91.186001) + (xy 106.525636 91.186026) (xy 106.525661 91.186063) (xy 107.971826 92.631893) (xy 107.918449 92.66624) (xy 107.773459 92.87844) + (xy 107.72245 93.13033) (xy 107.72245 94.82959) (xy 107.766728 95.064907) (xy 107.9058 95.281031) (xy 108.118 95.426021) + (xy 108.36989 95.47703) (xy 109.692256 95.47703) (xy 104.329201 100.84) (xy 104.25785 100.84) (xy 104.25785 100.7999) + (xy 104.213572 100.564583) (xy 104.0745 100.348459) (xy 103.8623 100.203469) (xy 103.61041 100.15246) (xy 100.01123 100.15246) + (xy 99.775913 100.196738) (xy 99.559789 100.33581) (xy 99.414799 100.54801) (xy 99.36379 100.7999) (xy 99.36379 102.4001) + (xy 99.408068 102.635417) (xy 99.54714 102.851541) (xy 99.75934 102.996531) (xy 100.01123 103.04754) (xy 103.61041 103.04754) + (xy 103.845727 103.003262) (xy 104.061851 102.86419) (xy 104.206841 102.65199) (xy 104.25785 102.4001) (xy 104.25785 102.36) + (xy 104.644 102.36) (xy 104.801851 102.328601) (xy 104.934834 102.30215) (xy 104.934836 102.302149) (xy 104.934839 102.302148) + (xy 105.104778 102.188599) (xy 105.181397 102.137405) (xy 111.561397 95.757505) (xy 111.561401 95.757501) (xy 111.626939 95.659417) + (xy 111.726146 95.510945) (xy 111.726147 95.510941) (xy 111.726148 95.510939) (xy 111.749476 95.393662) (xy 111.784 95.220106) + (xy 111.783999 95.220103) (xy 111.784 95.2201) (xy 111.784 89.5297) (xy 111.783982 89.529607) (xy 111.783999 89.529519) + (xy 111.755677 89.387313) (xy 111.726148 89.238861) (xy 111.726096 89.238783) (xy 111.726078 89.238693) (xy 111.643889 89.115752) + (xy 111.561401 88.992299) (xy 111.561324 88.992248) (xy 111.561273 88.992171) (xy 111.468935 88.899877) (xy 116.114 84.254894) + (xy 116.114 91.4741) (xy 116.171852 91.764939) (xy 116.336599 92.011501) (xy 117.928392 93.603294) (xy 117.895148 93.683353) + (xy 117.894632 94.273976) (xy 117.928695 94.356413) (xy 114.010221 98.2745) (xy 109.482 98.2745) (xy 109.48198 98.274504) + (xy 109.48196 98.2745) (xy 109.342532 98.302242) (xy 109.191161 98.332352) (xy 109.191143 98.332364) (xy 109.191124 98.332368) + (xy 109.071738 98.412148) (xy 108.944599 98.497099) (xy 108.944588 98.497116) (xy 108.944571 98.497127) (xy 104.359175 103.083) + (xy 97.0692 103.083) (xy 97.0692 103.04754) (xy 98.10877 103.04754) (xy 98.344087 103.003262) (xy 98.560211 102.86419) + (xy 98.705201 102.65199) (xy 98.75621 102.4001) (xy 98.75621 100.7999) (xy 98.711932 100.564583) (xy 98.57286 100.348459) + (xy 98.36066 100.203469) (xy 98.10877 100.15246) (xy 97.0692 100.15246) (xy 97.0692 96.863702) (xy 99.008901 94.924001) + (xy 99.173648 94.677439) (xy 99.2315 94.3866) (xy 99.2315 90.41104) (xy 99.9236 90.41104) (xy 100.158917 90.366762) + (xy 100.331669 90.255599) (xy 100.48451 90.360031) (xy 100.7364 90.41104) (xy 102.4636 90.41104) (xy 102.698917 90.366762) + (xy 102.915041 90.22769) (xy 103.060031 90.01549) (xy 103.11104 89.7636) (xy 103.11104 88.0364) (xy 103.066762 87.801083) + (xy 102.92769 87.584959) (xy 102.71549 87.439969) (xy 102.671655 87.431092) (xy 102.984526 86.962848) (xy 103.0986 86.389359) + (xy 103.0986 86.330641) (xy 102.984526 85.757152) (xy 102.65967 85.270971) (xy 102.173489 84.946115) (xy 101.6 84.832041) + (xy 101.026511 84.946115) (xy 100.54033 85.270971) (xy 100.34951 85.556553) (xy 100.331192 85.51222) (xy 99.909997 85.09029) + (xy 99.359398 84.861661) (xy 98.763218 84.861141) (xy 98.21222 85.088808) (xy 97.79029 85.510003) (xy 97.694787 85.74) + (xy 95.641641 85.74) (xy 95.322413 85.420772) (xy 95.322413 82.76744) (xy 97.77 82.76744) (xy 98.005317 82.723162) + (xy 98.221441 82.58409) (xy 98.366431 82.37189) (xy 98.41744 82.12) (xy 98.41744 80.88) (xy 99.000801 80.88) + ) + ) + (filled_polygon + (pts + (xy 120.125 97.908198) (xy 115.822198 102.211) (xy 115.514837 102.211) (xy 115.54744 102.05) (xy 115.54744 101.15) + (xy 115.503162 100.914683) (xy 115.36409 100.698559) (xy 115.15189 100.553569) (xy 115.06 100.534961) (xy 115.06 99.374325) + (xy 119.003398 95.431314) (xy 119.082913 95.464332) (xy 119.673536 95.464848) (xy 120.125 95.278306) + ) + ) + (filled_polygon + (pts + (xy 117.928216 88.523717) (xy 117.895148 88.603353) (xy 117.894632 89.193976) (xy 118.120178 89.739837) (xy 118.537446 90.157834) + (xy 119.082913 90.384332) (xy 119.673536 90.384848) (xy 119.755711 90.350894) (xy 120.125 90.720133) (xy 120.125 92.681977) + (xy 119.676127 92.495588) (xy 119.085504 92.495072) (xy 119.003611 92.528909) (xy 117.634 91.159298) (xy 117.634 88.229563) + ) + ) + (filled_polygon + (pts + (xy 107.9058 90.201031) (xy 108.118 90.346021) (xy 108.36989 90.39703) (xy 110.06915 90.39703) (xy 110.264 90.360366) + (xy 110.264 92.522348) (xy 110.06915 92.48289) (xy 109.901202 92.48289) (xy 109.837934 92.388225) (xy 109.757401 92.267699) + (xy 109.757365 92.267675) (xy 109.757339 92.267636) (xy 107.823 90.333746) (xy 107.823 90.072356) + ) + ) + (filled_polygon + (pts + (xy 92.898639 86.68585) (xy 92.753649 86.89805) (xy 92.70264 87.14994) (xy 92.70264 90.65006) (xy 92.746918 90.885377) + (xy 92.88599 91.101501) (xy 93.09819 91.246491) (xy 93.35008 91.2975) (xy 96.8502 91.2975) (xy 97.085517 91.253222) + (xy 97.301641 91.11415) (xy 97.446631 90.90195) (xy 97.49764 90.65006) (xy 97.49764 87.26) (xy 97.840937 87.26) + (xy 98.005525 87.424876) (xy 97.961083 87.433238) (xy 97.744959 87.57231) (xy 97.599969 87.78451) (xy 97.54896 88.0364) + (xy 97.54896 89.7636) (xy 97.593238 89.998917) (xy 97.7115 90.182701) (xy 97.7115 91.8084) (xy 90.145622 91.8084) + (xy 90.145622 91.2975) (xy 90.85072 91.2975) (xy 91.086037 91.253222) (xy 91.302161 91.11415) (xy 91.447151 90.90195) + (xy 91.49816 90.65006) (xy 91.49816 87.374043) (xy 92.273703 86.5985) (xy 93.034385 86.5985) + ) + ) + (filled_polygon + (pts + (xy 120.876 89.321573) (xy 120.830765 89.276345) (xy 120.863892 89.196567) (xy 120.864408 88.605944) (xy 120.638862 88.060083) + (xy 120.221594 87.642086) (xy 119.676127 87.415588) (xy 119.085504 87.415072) (xy 119.003188 87.449084) (xy 118.736 87.181951) + (xy 118.736 84.00002) (xy 118.815683 84.053262) (xy 119.175329 84.1248) (xy 120.092671 84.1248) (xy 120.452317 84.053262) + (xy 120.75721 83.849539) (xy 120.876 83.671757) + ) + ) + (filled_polygon + (pts + (xy 113.227683 84.053262) (xy 113.587329 84.1248) (xy 114.094472 84.1248) (xy 110.567336 87.651875) (xy 110.53324 87.598889) + (xy 110.32104 87.453899) (xy 110.06915 87.40289) (xy 108.745183 87.40289) (xy 112.202818 83.945) (xy 113.065657 83.945) + ) + ) + (filled_polygon + (pts + (xy 100.526574 87.428442) (xy 100.501083 87.433238) (xy 100.328331 87.544401) (xy 100.17549 87.439969) (xy 100.11218 87.427148) + (xy 100.32971 87.209997) (xy 100.34922 87.163012) + ) + ) + (filled_polygon + (pts + (xy 94.254537 86.5025) (xy 94.166155 86.5025) (xy 94.219932 86.467895) + ) + ) + (filled_polygon + (pts + (xy 116.08 69.96456) (xy 113.792 69.96456) (xy 113.556683 70.008838) (xy 113.340559 70.14791) (xy 113.195569 70.36011) + (xy 113.14456 70.612) (xy 113.14456 74.104809) (xy 111.88684 72.84694) (xy 112.014 72.84694) (xy 112.080113 72.8345) + (xy 112.14031 72.8345) (xy 112.190418 72.813745) (xy 112.249317 72.802662) (xy 112.30739 72.765293) (xy 112.373699 72.737827) + (xy 112.41634 72.695185) (xy 112.465441 72.66359) (xy 112.503206 72.60832) (xy 112.552327 72.559198) (xy 112.576279 72.501374) + (xy 112.610431 72.45139) (xy 112.623295 72.387867) (xy 112.649 72.325809) (xy 112.649 72.260931) (xy 112.66144 72.1995) + (xy 112.66144 70.5485) (xy 112.649 70.482387) (xy 112.649 70.422191) (xy 112.628245 70.372084) (xy 112.617162 70.313183) + (xy 112.579792 70.255109) (xy 112.552327 70.188802) (xy 112.509686 70.146161) (xy 112.47809 70.097059) (xy 112.422821 70.059295) + (xy 112.373699 70.010173) (xy 112.315872 69.98622) (xy 112.26589 69.952069) (xy 112.202369 69.939206) (xy 112.14031 69.9135) + (xy 112.075431 69.9135) (xy 112.014 69.90106) (xy 108.966 69.90106) (xy 108.899887 69.9135) (xy 108.83969 69.9135) + (xy 108.789582 69.934255) (xy 108.730683 69.945338) (xy 108.67261 69.982707) (xy 108.606301 70.010173) (xy 108.56366 70.052815) + (xy 108.514559 70.08441) (xy 108.476794 70.13968) (xy 108.427673 70.188802) (xy 108.403721 70.246626) (xy 108.369569 70.29661) + (xy 108.356705 70.360133) (xy 108.331 70.422191) (xy 108.331 70.487069) (xy 108.31856 70.5485) (xy 108.31856 72.1995) + (xy 108.331 72.265613) (xy 108.331 72.325809) (xy 108.351755 72.375916) (xy 108.362838 72.434817) (xy 108.400208 72.492891) + (xy 108.427673 72.559198) (xy 108.470314 72.601839) (xy 108.50191 72.650941) (xy 108.557179 72.688705) (xy 108.606301 72.737827) + (xy 108.664128 72.76178) (xy 108.71411 72.795931) (xy 108.777631 72.808794) (xy 108.83969 72.8345) (xy 108.904569 72.8345) + (xy 108.966 72.84694) (xy 109.808767 72.84694) (xy 109.869327 72.937575) (xy 109.952567 73.062169) (xy 111.36329 74.47306) + (xy 108.966 74.47306) (xy 108.899887 74.4855) (xy 108.83969 74.4855) (xy 108.789582 74.506255) (xy 108.730683 74.517338) + (xy 108.67261 74.554707) (xy 108.606301 74.582173) (xy 108.56366 74.624815) (xy 108.514559 74.65641) (xy 108.476794 74.71168) + (xy 108.427673 74.760802) (xy 108.403721 74.818626) (xy 108.369569 74.86861) (xy 108.356705 74.932133) (xy 108.331 74.994191) + (xy 108.331 75.059069) (xy 108.31856 75.1205) (xy 108.31856 76.7715) (xy 108.331 76.837613) (xy 108.331 76.897809) + (xy 108.351755 76.947916) (xy 108.362838 77.006817) (xy 108.400208 77.064891) (xy 108.427673 77.131198) (xy 108.470314 77.173839) + (xy 108.50191 77.222941) (xy 108.557179 77.260705) (xy 108.606301 77.309827) (xy 108.664128 77.33378) (xy 108.71411 77.367931) + (xy 108.777631 77.380794) (xy 108.83969 77.4065) (xy 108.904569 77.4065) (xy 108.966 77.41894) (xy 109.73 77.41894) + (xy 109.73 81.915) (xy 109.787852 82.205839) (xy 109.952599 82.452401) (xy 110.199161 82.617148) (xy 110.49 82.675) + (xy 111.323199 82.675) (xy 107.506182 86.4923) (xy 106.762799 86.4923) (xy 99.852997 79.582595) (xy 99.730343 79.500642) + (xy 99.606439 79.417852) (xy 99.606436 79.417851) (xy 99.606434 79.41785) (xy 99.460225 79.388768) (xy 99.3156 79.36) + (xy 98.41744 79.36) (xy 98.41744 78.12) (xy 98.373162 77.884683) (xy 98.23409 77.668559) (xy 98.02189 77.523569) + (xy 97.77 77.47256) (xy 95.322413 77.47256) (xy 95.322413 76.133572) (xy 101.556323 69.899662) (xy 116.08 69.899662) + ) + ) + (filled_polygon + (pts + (xy 115.335 82.768583) (xy 115.27247 82.675) (xy 115.335 82.675) + ) + ) + (filled_polygon + (pts + (xy 120.876 82.698243) (xy 120.776947 82.55) (xy 120.876 82.401757) + ) + ) + (filled_polygon + (pts + (xy 107.70896 66.9036) (xy 107.753238 67.138917) (xy 107.89231 67.355041) (xy 108.10451 67.500031) (xy 108.3564 67.55104) + (xy 110.0836 67.55104) (xy 110.318917 67.506762) (xy 110.535041 67.36769) (xy 110.680031 67.15549) (xy 110.73104 66.9036) + (xy 110.73104 66.8) (xy 117.86896 66.8) (xy 117.86896 66.9036) (xy 117.913238 67.138917) (xy 118.05231 67.355041) + (xy 118.26451 67.500031) (xy 118.5164 67.55104) (xy 120.2436 67.55104) (xy 120.478917 67.506762) (xy 120.695041 67.36769) + (xy 120.774 67.25213) (xy 120.774 78.22205) (xy 120.474537 78.521585) (xy 120.452317 78.506738) (xy 120.092671 78.4352) + (xy 119.175329 78.4352) (xy 118.815683 78.506738) (xy 118.736 78.55998) (xy 118.736 77.9225) (xy 118.678148 77.631661) + (xy 118.513401 77.385099) (xy 118.469013 77.35544) (xy 119.888 77.35544) (xy 120.123317 77.311162) (xy 120.339441 77.17209) + (xy 120.484431 76.95989) (xy 120.53544 76.708) (xy 120.53544 70.612) (xy 120.491162 70.376683) (xy 120.35209 70.160559) + (xy 120.13989 70.015569) (xy 119.888 69.96456) (xy 117.6 69.96456) (xy 117.6 69.139662) (xy 117.542148 68.848823) + (xy 117.377401 68.602261) (xy 117.130839 68.437514) (xy 116.84 68.379662) (xy 101.241521 68.379662) (xy 100.950682 68.437514) + (xy 100.70412 68.602261) (xy 94.025012 75.281369) (xy 93.860265 75.527931) (xy 93.802413 75.81877) (xy 93.802413 81.8035) + (xy 92.8604 81.8035) (xy 92.8604 74.849702) (xy 94.079601 73.630501) (xy 94.079605 73.630496) (xy 94.079613 73.63049) + (xy 100.909812 66.8) (xy 107.70896 66.8) + ) + ) + (filled_polygon + (pts + (xy 120.876 81.428243) (xy 120.776947 81.28) (xy 120.876 81.131757) + ) + ) + (filled_polygon + (pts + (xy 112.256 77.9179) (xy 112.259135 77.933661) (xy 112.256659 77.949539) (xy 112.287953 78.078538) (xy 112.313852 78.208739) + (xy 112.322781 78.222102) (xy 112.326569 78.237718) (xy 112.40485 78.344928) (xy 112.478599 78.455301) (xy 112.482079 78.457626) + (xy 112.483599 78.459901) (xy 112.493755 78.466687) (xy 112.501437 78.477208) (xy 112.506437 78.481807) (xy 112.619788 78.550899) + (xy 112.730161 78.624648) (xy 112.745921 78.627783) (xy 112.759643 78.636147) (xy 112.890803 78.656602) (xy 112.977567 78.67386) + (xy 112.92279 78.710461) (xy 112.719067 79.015354) (xy 112.647529 79.375) (xy 112.719067 79.734646) (xy 112.903053 80.01) + (xy 112.719067 80.285354) (xy 112.647529 80.645) (xy 112.719067 81.004646) (xy 112.81953 81.155) (xy 111.25 81.155) + (xy 111.25 77.41894) (xy 112.014 77.41894) (xy 112.080113 77.4065) (xy 112.14031 77.4065) (xy 112.190418 77.385745) + (xy 112.249317 77.374662) (xy 112.256 77.370362) + ) + ) + (filled_polygon + (pts + (xy 117.216 79.977037) (xy 117.164839 79.942852) (xy 116.874 79.885) (xy 115.27247 79.885) (xy 115.372933 79.734646) + (xy 115.444471 79.375) (xy 115.372933 79.015354) (xy 115.16921 78.710461) (xy 115.127363 78.6825) (xy 117.216 78.6825) + ) + ) + (filled_polygon + (pts + (xy 118.306574 64.568442) (xy 118.281083 64.573238) (xy 118.064959 64.71231) (xy 117.919969 64.92451) (xy 117.86896 65.1764) + (xy 117.86896 65.28) (xy 110.73104 65.28) (xy 110.73104 65.1764) (xy 110.686762 64.941083) (xy 110.54769 64.724959) + (xy 110.33549 64.579969) (xy 110.291655 64.571092) (xy 110.49952 64.26) (xy 118.10048 64.26) + ) + ) + (filled_polygon + (pts + (xy 120.774 64.828008) (xy 120.70769 64.724959) (xy 120.49549 64.579969) (xy 120.451655 64.571092) (xy 120.67275 64.2402) + (xy 120.774 64.2402) + ) + ) + ) ) diff --git a/documents/Oszillator_20MHz.pdf b/documents/Oszillator_20MHz.pdf new file mode 100644 index 0000000..1c413e7 Binary files /dev/null and b/documents/Oszillator_20MHz.pdf differ diff --git a/documents/Spannungsversorgung-F.Cu.pdf b/documents/Spannungsversorgung-F.Cu.pdf new file mode 100644 index 0000000..644eda7 Binary files /dev/null and b/documents/Spannungsversorgung-F.Cu.pdf differ diff --git a/sketches/ArduinoISP/ArduinoISP.ino b/sketches/ArduinoISP/ArduinoISP.ino new file mode 100644 index 0000000..eda62f1 --- /dev/null +++ b/sketches/ArduinoISP/ArduinoISP.ino @@ -0,0 +1,725 @@ +// ArduinoISP +// Copyright (c) 2008-2011 Randall Bohn +// If you require a license, see +// http://www.opensource.org/licenses/bsd-license.php +// +// This sketch turns the Arduino into a AVRISP +// using the following arduino pins: +// +// Pin 10 is used to reset the target microcontroller. +// +// By default, the hardware SPI pins MISO, MOSI and SCK pins are used +// to communicate with the target. On all Arduinos, these pins can be found +// on the ICSP/SPI header: +// +// MISO °. . 5V (!) Avoid this pin on Due, Zero... +// SCK . . MOSI +// . . GND +// +// On some Arduinos (Uno,...), pins MOSI, MISO and SCK are the same pins +// as digital pin 11, 12 and 13, respectively. That is why many tutorials +// instruct you to hook up the target to these pins. If you find this wiring +// more practical, have a define USE_OLD_STYLE_WIRING. This will work even +// even when not using an Uno. (On an Uno this is not needed). +// +// Alternatively you can use any other digital pin by configuring software ('BitBanged') +// SPI and having appropriate defines for PIN_MOSI, PIN_MISO and PIN_SCK. +// +// IMPORTANT: When using an Arduino that is not 5V tolerant (Due, Zero, ...) +// as the programmer, make sure to not expose any of the programmer's pins to 5V. +// A simple way to accomplish this is to power the complete system (programmer +// and target) at 3V3. +// +// Put an LED (with resistor) on the following pins: +// 9: Heartbeat - shows the programmer is running +// 8: Error - Lights up if something goes wrong (use red if that makes sense) +// 7: Programming - In communication with the slave +// + +#include "Arduino.h" +#undef SERIAL + + +#define PROG_FLICKER true + +// Configure SPI clock (in Hz). +// E.g. for an attiny @128 kHz: the datasheet states that both the high +// and low spi clock pulse must be > 2 cpu cycles, so take 3 cycles i.e. +// divide target f_cpu by 6: +// #define SPI_CLOCK (128000/6) +// +// A clock slow enough for an attiny85 @ 1MHz, is a reasonable default: + +#define SPI_CLOCK (20000000/6) + + +// Select hardware or software SPI, depending on SPI clock. +// Currently only for AVR, for other archs (Due, Zero,...), +// hardware SPI is probably too fast anyway. + +#if defined(ARDUINO_ARCH_AVR) + +#if SPI_CLOCK > (F_CPU / 128) +#define USE_HARDWARE_SPI +#endif + +#endif + +// Configure which pins to use: + +// The standard pin configuration. +#ifndef ARDUINO_HOODLOADER2 + +#define RESET 10 // Use pin 10 to reset the target rather than SS +#define LED_HB 9 +#define LED_ERR 8 +#define LED_PMODE 7 + +// Uncomment following line to use the old Uno style wiring +// (using pin 11, 12 and 13 instead of the SPI header) on Leonardo, Due... + +// #define USE_OLD_STYLE_WIRING + +#ifdef USE_OLD_STYLE_WIRING + +#define PIN_MOSI 11 +#define PIN_MISO 12 +#define PIN_SCK 13 + +#endif + +// HOODLOADER2 means running sketches on the atmega16u2 +// serial converter chips on Uno or Mega boards. +// We must use pins that are broken out: +#else + +#define RESET 4 +#define LED_HB 7 +#define LED_ERR 6 +#define LED_PMODE 5 + +#endif + +// By default, use hardware SPI pins: +#ifndef PIN_MOSI +#define PIN_MOSI MOSI +#endif + +#ifndef PIN_MISO +#define PIN_MISO MISO +#endif + +#ifndef PIN_SCK +#define PIN_SCK SCK +#endif + +// Force bitbanged SPI if not using the hardware SPI pins: +#if (PIN_MISO != MISO) || (PIN_MOSI != MOSI) || (PIN_SCK != SCK) +#undef USE_HARDWARE_SPI +#endif + + +// Configure the serial port to use. +// +// Prefer the USB virtual serial port (aka. native USB port), if the Arduino has one: +// - it does not autoreset (except for the magic baud rate of 1200). +// - it is more reliable because of USB handshaking. +// +// Leonardo and similar have an USB virtual serial port: 'Serial'. +// Due and Zero have an USB virtual serial port: 'SerialUSB'. +// +// On the Due and Zero, 'Serial' can be used too, provided you disable autoreset. +// To use 'Serial': #define SERIAL Serial + +#ifdef SERIAL_PORT_USBVIRTUAL +#define SERIAL SERIAL_PORT_USBVIRTUAL +#else +#define SERIAL Serial +#endif + + +// Configure the baud rate: + +// #define BAUDRATE 19200 +#define BAUDRATE 115200 +// #define BAUDRATE 1000000 + + +#define HWVER 2 +#define SWMAJ 1 +#define SWMIN 18 + +// STK Definitions +#define STK_OK 0x10 +#define STK_FAILED 0x11 +#define STK_UNKNOWN 0x12 +#define STK_INSYNC 0x14 +#define STK_NOSYNC 0x15 +#define CRC_EOP 0x20 //ok it is a space... + +void pulse(int pin, int times); + +#ifdef USE_HARDWARE_SPI +#include "SPI.h" +#else + +#define SPI_MODE0 0x00 + +class SPISettings { +public: + // clock is in Hz + SPISettings(uint32_t clock, uint8_t bitOrder, uint8_t dataMode) : clock(clock){ + (void) bitOrder; + (void) dataMode; + }; + +private: + uint32_t clock; + +friend class BitBangedSPI; +}; + +class BitBangedSPI { +public: + void begin() { + digitalWrite(PIN_SCK, LOW); + digitalWrite(PIN_MOSI, LOW); + pinMode(PIN_SCK, OUTPUT); + pinMode(PIN_MOSI, OUTPUT); + pinMode(PIN_MISO, INPUT); + } + + void beginTransaction(SPISettings settings) { + pulseWidth = (500000 + settings.clock - 1) / settings.clock; + if (pulseWidth == 0) + pulseWidth = 1; + } + + void end() {} + + uint8_t transfer (uint8_t b) { + for (unsigned int i = 0; i < 8; ++i) { + digitalWrite(PIN_MOSI, (b & 0x80) ? HIGH : LOW); + digitalWrite(PIN_SCK, HIGH); + delayMicroseconds(pulseWidth); + b = (b << 1) | digitalRead(PIN_MISO); + digitalWrite(PIN_SCK, LOW); // slow pulse + delayMicroseconds(pulseWidth); + } + return b; + } + +private: + unsigned long pulseWidth; // in microseconds +}; + +static BitBangedSPI SPI; + +#endif + +void setup() { + SERIAL.begin(BAUDRATE); + + pinMode(LED_PMODE, OUTPUT); + pulse(LED_PMODE, 2); + pinMode(LED_ERR, OUTPUT); + pulse(LED_ERR, 2); + pinMode(LED_HB, OUTPUT); + pulse(LED_HB, 2); + +} + +int error = 0; +int pmode = 0; +// address for reading and writing, set by 'U' command +unsigned int here; +uint8_t buff[256]; // global block storage + +#define beget16(addr) (*addr * 256 + *(addr+1) ) +typedef struct param { + uint8_t devicecode; + uint8_t revision; + uint8_t progtype; + uint8_t parmode; + uint8_t polling; + uint8_t selftimed; + uint8_t lockbytes; + uint8_t fusebytes; + uint8_t flashpoll; + uint16_t eeprompoll; + uint16_t pagesize; + uint16_t eepromsize; + uint32_t flashsize; +} +parameter; + +parameter param; + +// this provides a heartbeat on pin 9, so you can tell the software is running. +uint8_t hbval = 128; +int8_t hbdelta = 8; +void heartbeat() { + static unsigned long last_time = 0; + unsigned long now = millis(); + if ((now - last_time) < 40) + return; + last_time = now; + if (hbval > 192) hbdelta = -hbdelta; + if (hbval < 32) hbdelta = -hbdelta; + hbval += hbdelta; + analogWrite(LED_HB, hbval); +} + +static bool rst_active_high; + +void reset_target(bool reset) { + digitalWrite(RESET, ((reset && rst_active_high) || (!reset && !rst_active_high)) ? HIGH : LOW); +} + +void loop(void) { + // is pmode active? + if (pmode) { + digitalWrite(LED_PMODE, HIGH); + } else { + digitalWrite(LED_PMODE, LOW); + } + // is there an error? + if (error) { + digitalWrite(LED_ERR, HIGH); + } else { + digitalWrite(LED_ERR, LOW); + } + + // light the heartbeat LED + heartbeat(); + if (SERIAL.available()) { + avrisp(); + } +} + +uint8_t getch() { + while (!SERIAL.available()); + return SERIAL.read(); +} +void fill(int n) { + for (int x = 0; x < n; x++) { + buff[x] = getch(); + } +} + +#define PTIME 30 +void pulse(int pin, int times) { + do { + digitalWrite(pin, HIGH); + delay(PTIME); + digitalWrite(pin, LOW); + delay(PTIME); + } while (times--); +} + +void prog_lamp(int state) { + if (PROG_FLICKER) { + digitalWrite(LED_PMODE, state); + } +} + +uint8_t spi_transaction(uint8_t a, uint8_t b, uint8_t c, uint8_t d) { + SPI.transfer(a); + SPI.transfer(b); + SPI.transfer(c); + return SPI.transfer(d); +} + +void empty_reply() { + if (CRC_EOP == getch()) { + SERIAL.print((char)STK_INSYNC); + SERIAL.print((char)STK_OK); + } else { + error++; + SERIAL.print((char)STK_NOSYNC); + } +} + +void breply(uint8_t b) { + if (CRC_EOP == getch()) { + SERIAL.print((char)STK_INSYNC); + SERIAL.print((char)b); + SERIAL.print((char)STK_OK); + } else { + error++; + SERIAL.print((char)STK_NOSYNC); + } +} + +void get_version(uint8_t c) { + switch (c) { + case 0x80: + breply(HWVER); + break; + case 0x81: + breply(SWMAJ); + break; + case 0x82: + breply(SWMIN); + break; + case 0x93: + breply('S'); // serial programmer + break; + default: + breply(0); + } +} + +void set_parameters() { + // call this after reading paramter packet into buff[] + param.devicecode = buff[0]; + param.revision = buff[1]; + param.progtype = buff[2]; + param.parmode = buff[3]; + param.polling = buff[4]; + param.selftimed = buff[5]; + param.lockbytes = buff[6]; + param.fusebytes = buff[7]; + param.flashpoll = buff[8]; + // ignore buff[9] (= buff[8]) + // following are 16 bits (big endian) + param.eeprompoll = beget16(&buff[10]); + param.pagesize = beget16(&buff[12]); + param.eepromsize = beget16(&buff[14]); + + // 32 bits flashsize (big endian) + param.flashsize = buff[16] * 0x01000000 + + buff[17] * 0x00010000 + + buff[18] * 0x00000100 + + buff[19]; + + // avr devices have active low reset, at89sx are active high + rst_active_high = (param.devicecode >= 0xe0); +} + +void start_pmode() { + + // Reset target before driving PIN_SCK or PIN_MOSI + + // SPI.begin() will configure SS as output, + // so SPI master mode is selected. + // We have defined RESET as pin 10, + // which for many arduino's is not the SS pin. + // So we have to configure RESET as output here, + // (reset_target() first sets the correct level) + reset_target(true); + pinMode(RESET, OUTPUT); + SPI.begin(); + SPI.beginTransaction(SPISettings(SPI_CLOCK, MSBFIRST, SPI_MODE0)); + + // See avr datasheets, chapter "SERIAL_PRG Programming Algorithm": + + // Pulse RESET after PIN_SCK is low: + digitalWrite(PIN_SCK, LOW); + delay(20); // discharge PIN_SCK, value arbitrally chosen + reset_target(false); + // Pulse must be minimum 2 target CPU clock cycles + // so 100 usec is ok for CPU speeds above 20KHz + delayMicroseconds(100); + reset_target(true); + + // Send the enable programming command: + delay(50); // datasheet: must be > 20 msec + spi_transaction(0xAC, 0x53, 0x00, 0x00); + pmode = 1; +} + +void end_pmode() { + SPI.end(); + // We're about to take the target out of reset + // so configure SPI pins as input + pinMode(PIN_MOSI, INPUT); + pinMode(PIN_SCK, INPUT); + reset_target(false); + pinMode(RESET, INPUT); + pmode = 0; +} + +void universal() { + uint8_t ch; + + fill(4); + ch = spi_transaction(buff[0], buff[1], buff[2], buff[3]); + breply(ch); +} + +void flash(uint8_t hilo, unsigned int addr, uint8_t data) { + spi_transaction(0x40 + 8 * hilo, + addr >> 8 & 0xFF, + addr & 0xFF, + data); +} +void commit(unsigned int addr) { + if (PROG_FLICKER) { + prog_lamp(LOW); + } + spi_transaction(0x4C, (addr >> 8) & 0xFF, addr & 0xFF, 0); + if (PROG_FLICKER) { + delay(PTIME); + prog_lamp(HIGH); + } +} + +unsigned int current_page() { + if (param.pagesize == 32) { + return here & 0xFFFFFFF0; + } + if (param.pagesize == 64) { + return here & 0xFFFFFFE0; + } + if (param.pagesize == 128) { + return here & 0xFFFFFFC0; + } + if (param.pagesize == 256) { + return here & 0xFFFFFF80; + } + return here; +} + + +void write_flash(int length) { + fill(length); + if (CRC_EOP == getch()) { + SERIAL.print((char) STK_INSYNC); + SERIAL.print((char) write_flash_pages(length)); + } else { + error++; + SERIAL.print((char) STK_NOSYNC); + } +} + +uint8_t write_flash_pages(int length) { + int x = 0; + unsigned int page = current_page(); + while (x < length) { + if (page != current_page()) { + commit(page); + page = current_page(); + } + flash(LOW, here, buff[x++]); + flash(HIGH, here, buff[x++]); + here++; + } + + commit(page); + + return STK_OK; +} + +#define EECHUNK (32) +uint8_t write_eeprom(unsigned int length) { + // here is a word address, get the byte address + unsigned int start = here * 2; + unsigned int remaining = length; + if (length > param.eepromsize) { + error++; + return STK_FAILED; + } + while (remaining > EECHUNK) { + write_eeprom_chunk(start, EECHUNK); + start += EECHUNK; + remaining -= EECHUNK; + } + write_eeprom_chunk(start, remaining); + return STK_OK; +} +// write (length) bytes, (start) is a byte address +uint8_t write_eeprom_chunk(unsigned int start, unsigned int length) { + // this writes byte-by-byte, + // page writing may be faster (4 bytes at a time) + fill(length); + prog_lamp(LOW); + for (unsigned int x = 0; x < length; x++) { + unsigned int addr = start + x; + spi_transaction(0xC0, (addr >> 8) & 0xFF, addr & 0xFF, buff[x]); + delay(45); + } + prog_lamp(HIGH); + return STK_OK; +} + +void program_page() { + char result = (char) STK_FAILED; + unsigned int length = 256 * getch(); + length += getch(); + char memtype = getch(); + // flash memory @here, (length) bytes + if (memtype == 'F') { + write_flash(length); + return; + } + if (memtype == 'E') { + result = (char)write_eeprom(length); + if (CRC_EOP == getch()) { + SERIAL.print((char) STK_INSYNC); + SERIAL.print(result); + } else { + error++; + SERIAL.print((char) STK_NOSYNC); + } + return; + } + SERIAL.print((char)STK_FAILED); + return; +} + +uint8_t flash_read(uint8_t hilo, unsigned int addr) { + return spi_transaction(0x20 + hilo * 8, + (addr >> 8) & 0xFF, + addr & 0xFF, + 0); +} + +char flash_read_page(int length) { + for (int x = 0; x < length; x += 2) { + uint8_t low = flash_read(LOW, here); + SERIAL.print((char) low); + uint8_t high = flash_read(HIGH, here); + SERIAL.print((char) high); + here++; + } + return STK_OK; +} + +char eeprom_read_page(int length) { + // here again we have a word address + int start = here * 2; + for (int x = 0; x < length; x++) { + int addr = start + x; + uint8_t ee = spi_transaction(0xA0, (addr >> 8) & 0xFF, addr & 0xFF, 0xFF); + SERIAL.print((char) ee); + } + return STK_OK; +} + +void read_page() { + char result = (char)STK_FAILED; + int length = 256 * getch(); + length += getch(); + char memtype = getch(); + if (CRC_EOP != getch()) { + error++; + SERIAL.print((char) STK_NOSYNC); + return; + } + SERIAL.print((char) STK_INSYNC); + if (memtype == 'F') result = flash_read_page(length); + if (memtype == 'E') result = eeprom_read_page(length); + SERIAL.print(result); +} + +void read_signature() { + if (CRC_EOP != getch()) { + error++; + SERIAL.print((char) STK_NOSYNC); + return; + } + SERIAL.print((char) STK_INSYNC); + uint8_t high = spi_transaction(0x30, 0x00, 0x00, 0x00); + SERIAL.print((char) high); + uint8_t middle = spi_transaction(0x30, 0x00, 0x01, 0x00); + SERIAL.print((char) middle); + uint8_t low = spi_transaction(0x30, 0x00, 0x02, 0x00); + SERIAL.print((char) low); + SERIAL.print((char) STK_OK); +} +////////////////////////////////////////// +////////////////////////////////////////// + + +//////////////////////////////////// +//////////////////////////////////// +void avrisp() { + uint8_t ch = getch(); + switch (ch) { + case '0': // signon + error = 0; + empty_reply(); + break; + case '1': + if (getch() == CRC_EOP) { + SERIAL.print((char) STK_INSYNC); + SERIAL.print("AVR ISP"); + SERIAL.print((char) STK_OK); + } + else { + error++; + SERIAL.print((char) STK_NOSYNC); + } + break; + case 'A': + get_version(getch()); + break; + case 'B': + fill(20); + set_parameters(); + empty_reply(); + break; + case 'E': // extended parameters - ignore for now + fill(5); + empty_reply(); + break; + case 'P': + if (!pmode) + start_pmode(); + empty_reply(); + break; + case 'U': // set address (word) + here = getch(); + here += 256 * getch(); + empty_reply(); + break; + + case 0x60: //STK_PROG_FLASH + getch(); // low addr + getch(); // high addr + empty_reply(); + break; + case 0x61: //STK_PROG_DATA + getch(); // data + empty_reply(); + break; + + case 0x64: //STK_PROG_PAGE + program_page(); + break; + + case 0x74: //STK_READ_PAGE 't' + read_page(); + break; + + case 'V': //0x56 + universal(); + break; + case 'Q': //0x51 + error = 0; + end_pmode(); + empty_reply(); + break; + + case 0x75: //STK_READ_SIGN 'u' + read_signature(); + break; + + // expecting a command, not CRC_EOP + // this is how we can get back in sync + case CRC_EOP: + error++; + SERIAL.print((char) STK_NOSYNC); + break; + + // anything else we will return STK_UNKNOWN + default: + error++; + if (CRC_EOP == getch()) + SERIAL.print((char)STK_UNKNOWN); + else + SERIAL.print((char)STK_NOSYNC); + } +} + diff --git a/sketches/led-driver/Makefile b/sketches/led-driver/Makefile new file mode 100644 index 0000000..32937ce --- /dev/null +++ b/sketches/led-driver/Makefile @@ -0,0 +1,23 @@ +CFLAGS = -O3 -Wall --std=c11 +CHIP = 328p +SOURCE_FILES = $(wildcard *.c) +OBJ_FILES = $(SOURCE_FILES:%.c=%.o) +BIN = led-driver.bin +HEX = led-driver.hex + +default: $(HEX) + +%.o: %.c + avr-gcc $(CFLAGS) -mmcu=atmega$(CHIP) -o $@ $< + +$(BIN): $(OBJ_FILES) + avr-gcc $(CFLAGS) -o $@ $^ + +$(HEX): $(BIN) + avr-objcopy -O ihex -j .text -j .data $^ $@ + +flash: $(HEX) + avrdude -p m$(CHIP) -c arduino -B 115200 -P /dev/ttyACM0 -v -v -e flash:w:$(HEX):a + +clean: + $(RM) $(OBJ_FILES) $(BIN) $(HEX) diff --git a/sketches/led-driver/a.hex b/sketches/led-driver/a.hex new file mode 100644 index 0000000..c640561 --- /dev/null +++ b/sketches/led-driver/a.hex @@ -0,0 +1,81 @@ +:100000000C9434000C943E000C943E000C943E0082 +:100010000C943E000C943E000C943E000C943E0068 +:100020000C943E000C943E000C943E000C943E0058 +:100030000C943E000C943E000C943E000C943E0048 +:100040000C943E000C943E000C943E000C943E0038 +:100050000C943E000C943E000C943E000C943E0028 +:100060000C943E000C943E0011241FBECFEFD8E04C +:10007000DEBFCDBF0E9440000C9477020C940000BC +:1000800081E087B988B9000000000000000000008E +:10009000000018B800000000000000000000000090 +:1000A0000000000000000000000000000000000050 +:1000B000000088B9000000000000000000000000FF +:1000C00018B8000000000000000000000000000060 +:1000D0000000000000000000000000000000000020 +:1000E00088B900000000000000000000000018B8FF +:1000F0000000000000000000000000000000000000 +:10010000000000000000000000000000000088B9AE +:1001100000000000000000000000000018B800000F +:1001200000000000000000000000000000000000CF +:1001300000000000000000000000000088B900007E +:100140000000000000000000000018B800000000DF +:10015000000000000000000000000000000000009F +:100160000000000000000000000088B9000000004E +:10017000000000000000000018B8000000000000AF +:10018000000000000000000000000000000000006F +:10019000000000000000000088B90000000000001E +:1001A00000000000000018B800000000000000007F +:1001B000000000000000000000000000000000003F +:1001C00000000000000088B90000000000000000EE +:1001D0000000000018B8000000000000000000004F +:1001E000000000000000000000000000000000000F +:1001F0000000000088B900000000000000000000BE +:10020000000018B80000000000000000000000001E +:1002100000000000000000000000000000000000DE +:10022000000088B90000000000000000000000008D +:1002300018B80000000000000000000000000000EE +:1002400000000000000000000000000000000000AE +:1002500088B900000000000000000000000018B88D +:10026000000000000000000000000000000000008E +:10027000000000000000000000000000000088B93D +:1002800000000000000000000000000018B800009E +:10029000000000000000000000000000000000005E +:1002A00000000000000000000000000088B900000D +:1002B0000000000000000000000018B8000000006E +:1002C000000000000000000000000000000000002E +:1002D0000000000000000000000088B900000000DD +:1002E000000000000000000018B80000000000003E +:1002F00000000000000000000000000000000000FE +:10030000000000000000000088B9000000000000AC +:1003100000000000000018B800000000000000000D +:1003200000000000000000000000000000000000CD +:1003300000000000000088B900000000000000007C +:100340000000000018B800000000000000000000DD +:10035000000000000000000000000000000000009D +:100360000000000088B9000000000000000000004C +:10037000000000000000000000000000000000007D +:10038000000018B80000000000000000000000009D +:100390000000000088B9000000000000000000001C +:1003A000000000000000000000000000000000004D +:1003B000000018B80000000000000000000000006D +:1003C0000000000088B900000000000000000000EC +:1003D000000000000000000000000000000000001D +:1003E000000018B80000000000000000000000003D +:1003F0000000000088B900000000000000000000BC +:1004000000000000000000000000000000000000EC +:10041000000018B80000000000000000000000000C +:100420000000000088B9000000000000000000008B +:1004300000000000000000000000000000000000BC +:10044000000018B8000000000000000000000000DC +:100450000000000088B9000000000000000000005B +:10046000000000000000000000000000000000008C +:10047000000018B8000000000000000000000000AC +:100480000000000088B9000000000000000000002B +:10049000000000000000000000000000000000005C +:1004A000000018B80000000000000000000000007C +:1004B0000000000088B900000000000000000000FB +:1004C000000000000000000000000000000000002C +:1004D000000018B80000000000000000000000004C +:1004E0000000000090E19A95F1F700C0CBCDF894A0 +:0204F000FFCF3C +:00000001FF diff --git a/sketches/led-driver/a.out b/sketches/led-driver/a.out new file mode 100755 index 0000000..c04cebb Binary files /dev/null and b/sketches/led-driver/a.out differ diff --git a/sketches/led-driver/led-driver.bin b/sketches/led-driver/led-driver.bin new file mode 100755 index 0000000..5a6243e Binary files /dev/null and b/sketches/led-driver/led-driver.bin differ diff --git a/sketches/led-driver/led-driver.c b/sketches/led-driver/led-driver.c new file mode 100644 index 0000000..f4870d1 --- /dev/null +++ b/sketches/led-driver/led-driver.c @@ -0,0 +1,54 @@ +#define F_CPU 1000000UL +#include +#include +#include + +/* +// f=20MHz -> T=0,05 µs +uint8_t T0H = 6; // == 0.3 µs ~ 0.4 µs (+- 150ns) == [0.25, 0.55] µs +uint8_t T1H = 14; // == 0.7 µs ~ 0.8 µs (+- 150ns) == [0.65, 0.95] µs +uint8_t T0L = 15; // == 0.75 µs ~ 0.85µs (+- 150ns) == [0.70, 1.00] µs +uint8_t T1L = 8; // == 0.35 µs ~ 0.45µs (+- 150ns) == [0.30, 0.60] µs +uint8_t RES = 51; // > 50 µs +*/ + +#define wait6 __asm__("nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t") +#define wait8 __asm__("nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t") +#define wait14 __asm__("nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t") +#define wait15 __asm__("nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t") + +inline void writeZero() { + PORTB = 1; + wait6; + PORTB = 0; + wait15; +} + +inline void writeOne() { + PORTB = 1; + wait14; + PORTB = 0; + wait8; +} + +int main2() { + DDRB = 1; // PORT C0 output + + do{ + writeZero();writeZero();writeZero();writeZero();writeZero();writeZero();writeZero();writeZero(); + writeZero();writeZero();writeZero();writeZero();writeZero();writeZero();writeZero();writeZero(); + writeOne();writeOne();writeOne();writeOne();writeOne();writeOne();writeOne();writeOne(); + _delay_ms(1); + }while(1); +} + +int main( void ) +{ + DDRC |= (1 << PC0); + + while(1) { + PORTC ^= (1 << PC0); + _delay_ms(1000); + } + return 0; +} diff --git a/sketches/led-driver/led-driver.hex b/sketches/led-driver/led-driver.hex new file mode 100644 index 0000000..e165fdb --- /dev/null +++ b/sketches/led-driver/led-driver.hex @@ -0,0 +1,83 @@ +:100000000C9434000C943E000C943E000C943E0082 +:100010000C943E000C943E000C943E000C943E0068 +:100020000C943E000C943E000C943E000C943E0058 +:100030000C943E000C943E000C943E000C943E0048 +:100040000C943E000C943E000C943E000C943E0038 +:100050000C943E000C943E000C943E000C943E0028 +:100060000C943E000C943E0011241FBECFEFD8E04C +:10007000DEBFCDBF0E9479020C9488020C94000070 +:1000800081E084B985B90000000000000000000094 +:10009000000015B800000000000000000000000093 +:1000A0000000000000000000000000000000000050 +:1000B000000085B900000000000000000000000002 +:1000C00015B8000000000000000000000000000063 +:1000D0000000000000000000000000000000000020 +:1000E00085B900000000000000000000000015B805 +:1000F0000000000000000000000000000000000000 +:10010000000000000000000000000000000085B9B1 +:1001100000000000000000000000000015B8000012 +:1001200000000000000000000000000000000000CF +:1001300000000000000000000000000085B9000081 +:100140000000000000000000000015B800000000E2 +:10015000000000000000000000000000000000009F +:100160000000000000000000000085B90000000051 +:10017000000000000000000015B8000000000000B2 +:10018000000000000000000000000000000000006F +:10019000000000000000000085B900000000000021 +:1001A00000000000000015B8000000000000000082 +:1001B000000000000000000000000000000000003F +:1001C00000000000000085B90000000000000000F1 +:1001D0000000000015B80000000000000000000052 +:1001E000000000000000000000000000000000000F +:1001F0000000000085B900000000000000000000C1 +:10020000000015B800000000000000000000000021 +:1002100000000000000000000000000000000000DE +:10022000000085B900000000000000000000000090 +:1002300015B80000000000000000000000000000F1 +:1002400000000000000000000000000000000000AE +:1002500085B900000000000000000000000015B893 +:10026000000000000000000000000000000000008E +:10027000000000000000000000000000000085B940 +:1002800000000000000000000000000015B80000A1 +:10029000000000000000000000000000000000005E +:1002A00000000000000000000000000085B9000010 +:1002B0000000000000000000000015B80000000071 +:1002C000000000000000000000000000000000002E +:1002D0000000000000000000000085B900000000E0 +:1002E000000000000000000015B800000000000041 +:1002F00000000000000000000000000000000000FE +:10030000000000000000000085B9000000000000AF +:1003100000000000000015B8000000000000000010 +:1003200000000000000000000000000000000000CD +:1003300000000000000085B900000000000000007F +:100340000000000015B800000000000000000000E0 +:10035000000000000000000000000000000000009D +:100360000000000085B9000000000000000000004F +:10037000000000000000000000000000000000007D +:10038000000015B8000000000000000000000000A0 +:100390000000000085B9000000000000000000001F +:1003A000000000000000000000000000000000004D +:1003B000000015B800000000000000000000000070 +:1003C0000000000085B900000000000000000000EF +:1003D000000000000000000000000000000000001D +:1003E000000015B800000000000000000000000040 +:1003F0000000000085B900000000000000000000BF +:1004000000000000000000000000000000000000EC +:10041000000015B80000000000000000000000000F +:100420000000000085B9000000000000000000008E +:1004300000000000000000000000000000000000BC +:10044000000015B8000000000000000000000000DF +:100450000000000085B9000000000000000000005E +:10046000000000000000000000000000000000008C +:10047000000015B8000000000000000000000000AF +:100480000000000085B9000000000000000000002E +:10049000000000000000000000000000000000005C +:1004A000000015B80000000000000000000000007F +:1004B0000000000085B900000000000000000000FE +:1004C000000000000000000000000000000000002C +:1004D000000015B80000000000000000000000004F +:1004E00000000000E9EFF0E03197F1F700C00000F4 +:1004F000C9CD389A91E088B1892788B92FE33DE0CA +:1005000083E0215030408040E1F700C00000F3CF8D +:04051000F894FFCF8D +:00000001FF diff --git a/sketches/led-driver/led-driver.o b/sketches/led-driver/led-driver.o new file mode 100755 index 0000000..d73471e Binary files /dev/null and b/sketches/led-driver/led-driver.o differ