As for that part. Since there are more GPIO ports than GPIO header pins, you can map the ports to the pins. Therefore you can choose which UART to use without reconnecting the cable. Full comprehensive list can be found here. From that table you can read that ALT0 connects the UART0 to header pins 14/15, while ALT5 maps UART1 to the same pins (which also means you can either use UART0 or UART1 but not both at any given time). So ALT5 won't work, see issue 2. I haven't noticed the copy'n'paste bug because qemu does not emulate pin mapping.sumeet wrote: ↑Tue Jan 30, 2018 10:44 amSecond thing. I connected Pi3 to my laptop using USB to TTL cable and successfully ran this program: https://github.com/bztsrc/raspi3-tutori ... rt0/uart.c.
r|=(4<<12)|(4<<15); // alt0
I understood that above Line 63 in the code selects ALT0 function for pin 14/15. As per page 102 in BCM2835 Peripherals document ALT0 is TXD0/RXD0 (which I guess means transmitter and receiver for serial comms). I also noticed that ALT5 for the pins has the same function. So I modified the code to use ALT5 as below.
r|=(2<<12)|(2<<15); // alt5
I tested is successfully on qemu for raspi3. Next I tried selecting the other ALT functions for the pins and the program still kept working fine in qemu! Either the qemu simulation is not correct or I have misunderstood something.
Yes in theory, if you want to use both UARTs, one of them has to be mapped at those pins. But since those combinations are striked through in the table, I haven't tried.Also I can see pin 32/33 (ALT3 and ALT5), pin 36/37 (ALT2), pin 40/41 (ALT5) say TXD and RXD. So If I connect my UART cable to these pins instead of 14/15 and modify my code to select these pins and appropriate alt functions will the communication work?
Users browsing this forum: No registered users and 2 guests