The Raspberry Pi is deceptively simple. Plug it in, boot it up, and use it as a personal computer, or attach a million gizmos and modules and invent something new and amazing. Either way, what it can actually do is not simple, and you should know exactly what the Raspberry Pi hardware is all about.Raspberry Pi Hardware Reference, fromMastering the Raspberry Pi, is the hardware guide you need on your desk or workbench.Every detail is covered: from power to memory, from the CPU to working with USB. You'll find all the details about working with both wired and wireless Ethernet, SD cards, and the UART interface. The GPIO chapter is invaluable, covering power budgeting, access, and even small but important details like the correct usage of sudo when working with GPIO pins. You'll also find details about the 1-Wire driver, the I2C bus, and the SPI bus. If you need to know anything about your Raspberry Pi's hardware, you will find it here, inRaspberry Pi Hardware Reference.What you’ll learn How to work with Raspberry Pi power, including adapters and battery requirements Working with header strips and LEDs Working with SDRAM and memory mapping Understanding the CPU Interface details, including USB, UART, and GPIO Who this book is for Raspberry Pi hobbyists who need know all of the details about Raspberry Pi hardware and what Linux files and commands control that hardware. Contents at a Glance......Page 3 Contents......Page 221 About the Author......Page 232 About the Technical Reviewer......Page 233 Acknowledgments......Page 234 Introduction......Page 5 Models......Page 7 Hardware in Common......Page 9 Which Model?......Page 10 Calculating Power......Page 11 Current Requirement......Page 12 Model B Input Power......Page 13 Powered USB Hubs......Page 14 An Unsuitable Supply......Page 15 Voltage Test......Page 16 LM7805 Regulation......Page 18 DC-DC Buck Converter......Page 20 Signs of Insufficient Power......Page 22 No Power......Page 23 OK or ACT LED......Page 24 Header P1......Page 25 Safe Mode......Page 27 GPIO Configuration at Reset......Page 28 Header P5......Page 29 Reset......Page 30 PdftkEmptyString......Page 31 MemTotal......Page 33 SwapCached......Page 34 Inactive(anon)......Page 35 SwapTotal......Page 36 Mapped......Page 37 KernelStack......Page 38 WritebackTmp......Page 39 CommitLimit......Page 40 Committed_AS......Page 41 Physical Memory......Page 42 Memory Mapping......Page 44 Length......Page 45 Return Value......Page 46 Final Thoughts on SDRAM......Page 47 Identification......Page 49 Overclocking......Page 50 Execution......Page 52 pthread Error Handling......Page 53 pthread_create(3)......Page 54 pthread_attr_t......Page 56 pthread_detach(3)......Page 58 pthread_kill(3)......Page 59 pthread_mutex_create(3)......Page 60 pthread_mutex_destroy(3)......Page 61 pthread_mutex_unlock(3)......Page 62 Condition Variables......Page 63 pthread_cond_init(3)......Page 64 pthread_cond_wait(3)......Page 65 pthread_cond_signal(3)......Page 66 pthread_cond_broadcast(3)......Page 67 Chapter 6: USB......Page 68 Powered Hubs......Page 69 libusb......Page 70 Include Files......Page 71 Wired Ethernet......Page 74 Changing to Static IP......Page 75 Test Static IP Address......Page 76 Wireless Ethernet......Page 77 Configuration......Page 79 SD Card Interface......Page 83 SD Card Basics......Page 84 Raspbian Block Size......Page 85 Capacities and Performance......Page 86 SPI Bus Mode......Page 87 1-bit SD Mode......Page 88 Wear Leveling......Page 89 RS-232 Converter......Page 91 DTE or DCE......Page 92 RS-232......Page 93 Parity Bit......Page 94 Baud Rate......Page 95 Hardware Flow Control......Page 97 Software Flow Control......Page 98 ARM PL011 UART......Page 99 RTS/CTS Access......Page 100 PL011 UART Features......Page 101 Procedure......Page 102 Serial API......Page 103 struct termios......Page 104 tcgetattr(3)......Page 107 tcsetattr(3)......Page 108 tcdrain(3)......Page 109 tcflow(3)......Page 110 cfmakeraw(3)......Page 111 cfgetospeed(3)......Page 114 cfsetospeed(3)......Page 115 read(2)......Page 116 write(2)......Page 117 readv(2) and writev(2)......Page 118 Error EINTR......Page 120 Pins and Designations......Page 122 Configuration After Reset......Page 123 Configuring Pull-up Resistors......Page 125 Testing Pull-up State......Page 129 Drive Strength......Page 130 Output Pins......Page 132 Driving LEDs......Page 133 Driving Bi-color LEDs......Page 135 Testing Drive Strength......Page 136 GPIO Current Budget......Page 138 Alternate Function Select......Page 139 Alternate Function......Page 140 Sysfs GPIO Access......Page 141 gpioX......Page 142 Chip Level......Page 144 GPIO Tester......Page 145 GPIO Input Test......Page 146 Reading Events......Page 148 Test Run......Page 149 gpio_init()......Page 154 gpio_read()......Page 155 gpio_io.c......Page 156 GPIO Transistor Driver......Page 158 Driver Design......Page 159 Inductive Loads......Page 161 Driver Summary......Page 162 Utility gpio......Page 163 Reading GPIO......Page 164 Modify Drive Levels......Page 165 Line Driving......Page 166 Master and Slave......Page 167 Data I/O......Page 168 Slave Support......Page 169 Reading Temperature......Page 170 Bus Master......Page 172 Slave Devices......Page 173 1-Wire GPIO Pin......Page 175 I2C Overview......Page 176 SDA and SCL......Page 177 Bus Signaling......Page 178 Message Formats......Page 179 Which I2C Bus?......Page 180 Tools......Page 181 Kernel Module Support......Page 182 open(2)......Page 183 ioctl(2,I2C_FUNC)......Page 184 ioctl(2,I2C_RDWR)......Page 185 SPI Basics......Page 188 SPI Mode......Page 189 Signaling......Page 190 Slave Selection......Page 191 Driver Support......Page 192 SPI API......Page 193 SPI Mode Macros......Page 194 Clock Rate......Page 196 Data I/O......Page 197 SPI Testing......Page 200 Appendix A: Glossary......Page 203 Appendix B: Power Standards......Page 209 Power......Page 210 Units......Page 211 Index......Page 212 The Raspberry Pi is deceptively simple. Plug it in, boot it up, and use it as a personal computer, or attach a million gizmos and modules and invent something new and amazing. Either way, what it can actually do is not simple, and you should know exactly what the Raspberry Pi hardware is all about. Raspberry Pi Hardware Reference, from Mastering the Raspberry Pi, is the hardware guide you need on your desk or workbench. Every detail is covered: from power to memory, from the CPU to working with USB. You'll find all the details about working with both wired and wireless Ethernet, SD cards, and the UART interface. The GPIO chapter is invaluable, covering power budgeting, access, and even small but important details like the correct usage of sudo when working with GPIO pins. You'll also find details about the 1-Wire driver, the I2C bus, and the SPI bus. If you need to know anything about your Raspberry Pi's hardware, you will find it here, in Raspberry Pi Hardware Reference.