Advanced Raspberry Pi : Raspbian Linux and GPIO Integration
معرفی کتاب «Advanced Raspberry Pi : Raspbian Linux and GPIO Integration» نوشتهٔ Gay, Warren، منتشرشده توسط نشر Apress L.P در سال 2018. این کتاب در فرمت pdf، زبان انگلیسی ارائه شده است.
Jump right into the pro-level guts of the Raspberry Pi with complete schematics and detailed hardware explanations as your guide. You'll tinker with runlevels, reporting voltages and temperatures, and work on a variety of project examples that you can tune for your own project ideas.. This book is fully updated for the latest Pi boards with three chapters dedicated to GPIO to help you master key aspects of the Raspberry Pi. You'll work with Linux driver information and explore the different Raspberry Pi models, including the Pi Zero, Pi Zero W, Pi 2, Pi3 B and Pi3 B . You'll also review a variety of project examples that you can tune for your own project ideas. Other topics covered include the 1-Wire driver interface, how to configure a serial Linux console, and cross-compile code, including the Linux kernel. You'll find yourself turning to Advanced Raspberry Pi over and over again for both inspiration and reference. Whether you're an electronics professional, an entrepreneurial maker, or just looking for more detailed information on the Raspberry Pi, this is exactly the book for you. What You'll Learn Master I2C and SPI communications from Raspbian Linux in C Program USB peripherals, such as a 5-inch LCD panel with touch control and the Pi camera Study GPIO hardware, the sysfs driver interface and direct access from C programs Use and program the UART serial device. Who This Book Is For Advanced Raspberry Pi users who have experience doing basic projects and want to take their projects further. Table of Contents......Page 5 About the Author......Page 24 About the Technical Reviewer......Page 25 SBC Inventory......Page 26 Models......Page 27 Raspberry Pi Model B......Page 28 Raspberry Pi 2 Model B......Page 30 Raspberry Pi 3 Model B......Page 32 Raspberry Pi 3 Model B+......Page 34 Raspberry Pi Zero......Page 35 Raspberry Pi Zero W......Page 37 Which Model?......Page 38 Static IP Address......Page 39 Using SSH......Page 40 VNC......Page 43 VNC Viewers......Page 45 Black VNC Screen......Page 47 Summary......Page 49 Chapter 3: Power......Page 50 Calculating Power......Page 51 Current Requirement......Page 52 3.3 Volt Power......Page 53 An Unsuitable Supply......Page 54 Power Source Quality......Page 56 Voltage Test......Page 57 Headroom......Page 59 LM7805 Regulation......Page 60 DC-DC Buck Converter......Page 62 Signs of Insufficient Power......Page 65 Summary......Page 66 Status LEDs......Page 67 Original Header P1......Page 68 Revised GPIO Header P1......Page 69 Revision 2.0 GPIO Header P1......Page 71 Safe Mode......Page 72 GPIO Configuration at Reset......Page 73 Summary......Page 74 /proc/meminfo......Page 75 MemTotal......Page 77 Active......Page 78 Unevictable......Page 79 Mapped......Page 80 NFS_Unstable......Page 81 CommitLimit......Page 82 Committed_AS......Page 83 Physical Memory......Page 84 Memory Mapping......Page 86 Address......Page 88 Flags......Page 89 Return Value......Page 90 Virtual Memory......Page 91 Summary......Page 92 /proc/cpuinfo......Page 93 ARM Architecture......Page 94 Architecture Suffix......Page 95 Features......Page 96 Execution Environment......Page 97 pthread Headers......Page 98 pthread_create(3)......Page 99 pthread_attr_t......Page 102 pthread_join(3)......Page 104 pthread_detach(3)......Page 105 pthread_self(3)......Page 106 pthread_kill(3)......Page 107 pthread_mutex_create(3)......Page 108 pthread_mutex_destroy(3)......Page 109 pthread_mutex_lock(3)......Page 110 pthread_mutex_unlock(3)......Page 111 Condition Variables......Page 112 pthread_cond_destroy(3)......Page 114 pthread_cond_wait(3)......Page 115 pthread_cond_signal(3)......Page 116 pthread_cond_broadcast(3)......Page 117 Summary......Page 118 Power......Page 119 Powered Hubs......Page 120 EZ-USB FX2LP......Page 121 Device Introduction......Page 123 ReNumerationTM......Page 124 Install sdcc......Page 125 Install libusb-1.0-0-dev......Page 128 Obtain Software from github.com......Page 129 Test EZ-USB FX2LP Device......Page 130 Compile blink......Page 131 EZ-USB Program Execution......Page 132 USB Demonstration......Page 134 FX2LP Source Code......Page 135 Function accept_cmd......Page 136 Function send_state......Page 137 EZ-USB Initialization......Page 138 Raspberry Pi Source Code......Page 140 USB I/O Loop......Page 144 Function bulk_read......Page 145 Function bulk_write......Page 147 The Demonstration......Page 148 Summary......Page 151 Wired Ethernet......Page 152 Static Wired Address......Page 154 Wireless Configuration......Page 156 WIFI Country......Page 157 Test Static IP Addresses......Page 158 USB Adapters......Page 160 Pi Direct......Page 161 Remote Pi Configuration......Page 163 WIFI Pi (B+)......Page 166 Enable IP Forwarding......Page 168 Configure IP Forwarding......Page 169 Second Remote Pi Test......Page 170 Persistent iptables......Page 171 Rule Checking......Page 172 Security......Page 173 Summary......Page 174 SD Card Media......Page 175 SD Card Basics......Page 176 Raspbian Block Size......Page 177 Disk Cache......Page 178 SPI Bus Mode......Page 179 Wear Leveling......Page 181 Direct File System Mounts......Page 182 Read-Only Problem......Page 183 Software Protection......Page 184 Image Files......Page 185 Summary......Page 186 RS-232 Converter......Page 187 TTL Adapters......Page 188 DTE or DCE......Page 189 RS-232......Page 190 Parity Bit......Page 191 Stop Bits......Page 192 Baud Rate......Page 193 Break......Page 194 Flow Control......Page 195 Hardware Flow Control......Page 196 Software Flow Control......Page 197 Raspberry Pi UARTs......Page 198 Which Is in Use?......Page 199 Disabling the Serial Console......Page 200 Raspberry Zero Serial Console......Page 202 PL011 and Mini UART Differences......Page 203 PL011 UART Features......Page 204 RTS/CTS Access......Page 206 Summary......Page 207 Pins and Designations......Page 208 Pull-Up Resistors......Page 211 Configuring Pull-Up Resistors......Page 212 Drive Strength......Page 214 Logic Levels......Page 216 Output Pins......Page 217 Sourcing Current......Page 218 Driving LEDs......Page 219 Other LED Colors......Page 222 Driving Logic Interfaces......Page 223 Driving Bi-color LEDs......Page 224 Alternate Function......Page 225 Output Pins......Page 226 Floating Potentials......Page 227 Summary......Page 228 /sys/class/gpio......Page 229 Exporting a GPIO......Page 230 gpioX/direction:......Page 231 gpioX/value......Page 232 gpioX/edge and gpioX/uevent......Page 234 GPIO Test Script......Page 236 GPIO Input Test......Page 237 Summary......Page 240 Edge Events......Page 241 EINTR Error......Page 244 Reading uevent......Page 245 Demonstration......Page 246 Multiple GPIO......Page 247 Direct Register Access......Page 248 Peripheral Base Address......Page 249 Mapping Memory......Page 250 Register Access......Page 252 Demonstration Program......Page 255 GPIO Input......Page 256 Drive, Hysteresis, and Slew......Page 257 Transistor Driver......Page 258 Inductive Loads......Page 260 Summary......Page 261 1-Wire Line and Power......Page 262 Line Driving......Page 263 Reset......Page 264 Data I/O......Page 265 Configuration......Page 267 Reading Temperature......Page 269 Slave Devices......Page 272 Reading the Temperature......Page 274 Summary......Page 275 I2C Overview......Page 276 SDA and SCL......Page 277 Bus Signaling......Page 278 Message Formats......Page 279 I2C Bus Speed......Page 281 I2C Tools......Page 282 Driver Setup......Page 283 Wiring......Page 285 Testing GPIO Output......Page 286 Test GPIO Input Interrupt......Page 288 Limitations......Page 290 Header Files......Page 291 open(2)......Page 292 ioctl(2,I2C_FUNC)......Page 293 ioctl(2,I2C_RDWR)......Page 294 Summary......Page 298 SPI Basics......Page 299 SPI Mode......Page 300 Signaling......Page 301 Slave Selection......Page 303 Driver Support......Page 304 Header Files......Page 305 SPI Mode Macros......Page 307 Bits per Word......Page 309 Data I/O......Page 310 Close......Page 314 SPI Testing......Page 315 Summary......Page 318 Booting ARM Linux......Page 319 Boot Files......Page 321 config.txt......Page 322 High-Definition Video......Page 324 HDMI Force Hot-Plug......Page 325 HDMI Ignore EDID......Page 326 Avoid EDID Fuzzy Match......Page 327 HDMI Mode......Page 328 HDMI Ignore CEC Init......Page 333 Disable Overscan......Page 334 Frame Buffer Width......Page 335 Frame Buffer Ignore Alpha......Page 336 Licensed Codecs......Page 337 Boot Options......Page 338 RAM File System File......Page 339 Init UART Baud......Page 340 Boot Delay......Page 341 cmdline.txt......Page 342 Virtual console=......Page 344 root=......Page 345 rootfstype=......Page 346 elevator=......Page 347 nfsroot=......Page 348 ip=......Page 350 vcgencmd Commands......Page 352 Option measure_clock......Page 356 Option measure_volts......Page 358 Option codec_enabled......Page 359 otp_dump......Page 360 Pi Zero / Zero W......Page 363 Adapters Needed......Page 364 Enabling ssh and VNC Access......Page 366 Serial Console......Page 368 Summary......Page 370 Terminology......Page 371 Host, Guest, Build, and Target......Page 373 Platform Limitations......Page 374 Using VirtualBox (Debian/Linux)......Page 375 Planning Your Cross-Development Environment......Page 376 Download crosstool-NG......Page 377 Unpack the Tarball......Page 378 Install Package Dependencies......Page 379 Patch inputbox.c......Page 380 make crosstool-ng......Page 381 make install......Page 382 PATH......Page 383 Cross-Compiler Configuration......Page 384 Paths and Misc Options......Page 385 Target Options......Page 388 Operating System......Page 390 Binary Utilities......Page 392 C Compiler......Page 394 Save Configuration......Page 396 Build Cross-Compiler......Page 397 Troubleshooting......Page 399 Summary......Page 401 Chapter 21: Cross-Compiling the Kernel......Page 402 Fix inputbox.c......Page 403 Makefile for Pi 1/Zero/Zero W......Page 404 Config for Pi 1/Zero/Zero W......Page 405 zImage modules dtbs......Page 406 Native Install Kernel Image......Page 407 Cross Install......Page 408 Cross Kernel Files Install......Page 409 Boot Failure......Page 410 Summary......Page 411 Characteristics......Page 412 Circuit......Page 414 Overall Protocol......Page 415 Data Bits......Page 416 Data Format......Page 417 Source Code......Page 419 Timing......Page 420 Main Loop......Page 421 wait_ms()......Page 422 wait_ready()......Page 423 Reading DHT11......Page 424 wait_change()......Page 426 Timout Handling......Page 428 Demonstration......Page 430 Summary......Page 431 Project Overview......Page 432 Connector Pin-Out......Page 433 Enable I2C......Page 435 Testing the Connection......Page 436 Nunchuk I2C Protocol......Page 437 Read Sensor Data......Page 438 Working with Header Files......Page 440 Configuring Events......Page 441 Mouse Buttons......Page 443 Configure EV_REL......Page 444 Configure EV_ABS......Page 445 Creating the Node......Page 446 Posting EV_KEY Events......Page 449 Posting EV_REL Events......Page 450 Closing uinput......Page 451 X-Window......Page 452 Testing the Nunchuk......Page 453 Testing ./nunchuk......Page 455 Utility lsinputs......Page 456 The Program......Page 457 Summary......Page 462 The Display Unit......Page 463 Installation......Page 465 Install Script......Page 466 Backup......Page 467 Edit /boot/config.txt......Page 468 File 99-fbturbo.conf......Page 469 Driver Install......Page 470 Shutdown......Page 472 Plugging In......Page 473 Power......Page 474 Connections......Page 475 Summary......Page 476 DS3231 Overview......Page 477 Hookup......Page 479 Register Map......Page 481 Register 0x00 (Seconds)......Page 485 Register 0x01 (Minutes)......Page 486 Register 0x02 (Hours)......Page 487 Register 0x04 (Day of Month)......Page 488 Register 0x07 (Alarm1 Seconds)......Page 489 Register 0x09 (Alarm 1 Hours)......Page 490 Register 0x0A (Alarm 1 Date)......Page 491 Register 0x0E (Control)......Page 492 Register 0x0F (Control/Status)......Page 493 Register 0x11 and 0x12 (Temperature)......Page 494 Reading from DS3231......Page 495 Writing to DS3231......Page 496 Reading Temperature......Page 497 Read Temperature......Page 499 1 Hz Square Wave......Page 500 Kernel Support......Page 501 Summary......Page 502 Hookup......Page 504 Camera......Page 507 Commands......Page 508 Summary......Page 510 Appendix A: Power Standards......Page 511 Ohm’s Law......Page 512 Units......Page 513 Bibliography......Page 514 Index......Page 517
دانلود کتاب Advanced Raspberry Pi : Raspbian Linux and GPIO Integration