Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 8093

MicroPython • Re: Can't read data from UART data register

$
0
0
I had also a duplicate published on the assembly forum. I don't know if the discussion should be moved there?viewtopic.php?p=2321714
I can assume that I am setting up the clocks incorrectly. The led toggle works, the inbuilt led lights up. This is the code that comes after the write to atomic reset registers:

Code:

// set GPIO0 and GPIO1 to use uart0ldr r0, =io_bankmov r1, #2str r1, [r0, #0x4]str r1, [r0, #0xc]// Action list 4.2.7. Programmer's Model// enable Peripheral clock 2.15.3ldr r0, =clocks_basemov r1, #1lsl r1, r1, #11str r1, [r0, #0x48]// enable FIFOs bit 4// Set format bit 6:5// b11 = 8 bits;b10 = 7;bits b01 = 6 bits;b00 = 5 bits// Table 432. UARTLCR_H Registerldr r0, =uart0_basemov r1, #0b1110000str r1, [r0, #0x2c]// Set the baud rate divisors 4.2.3.2// UARTCLK/(16 x Baud Rate)ldr r1, =813//ldr r1, =312// these are the values of the registers that I got from micropythonstr r1, [r0, #0x24]mov r1, #52//mov r1, #32// these are the values of the registers that I got from micropythonstr r1, [r0, #0x28]// Enable UART 4.2.8 Table 433 UARTCR Registerldr r1, =0b1100000001str r1, [r0, #0x30]ldr r7, =0xf000delay:sub r7, r7, #1cmp r7, #0bne delaybl status_led_togglesend_message:ldr r0, =uart0_baseldr r1, =messagemov r2, #01:ldrb r3, [r1, r2]cmp r3, #0beq 1fstrb r3, [r0, #0]add r2, r2, #1b 1b1:mov r2, #0b10000ldr r1, [r0, #0x18] // 4.2.8 UARTFR Registerand r1, r1, r2cmp r1, #0bne 1fbl status_led_toggle1:ldr r7, =0xf0001:sub r7, r7, #1cmp r7, #0bne 1bb send_message

Statistics: Posted by virus.exe — Sun Jun 22, 2025 9:46 am



Viewing all articles
Browse latest Browse all 8093

Trending Articles