BCM2835 UART HAL
Timo Hartong (2813) 204 posts |
In the HAL sources in UART on line 216 ( HAL_UARTFeatures ) is stated that the MiniUART doesn’t have Hardware RTS / CTS available on page 16 of the datasheet could deducted otherwise ( AUX_MU_CNTL_REG where bit 6 and 7 give the possibility off auto flow). Also indicated at page 14 of the datasheet which states the possibility of auto-flow control. |
Julie Stamp (8365) 474 posts |
That’s here
|
Steve Pampling (1551) 8170 posts |
The sources probably refer to the fact that the Pi doesn’t have a physical link into anything to provide hardware flow control, so I would assume all handshake is xon/xoff |
Timo Hartong (2813) 204 posts |
On the header RTS and CTS are available on GPIO 16 and GPIO 17 just as for the PL11 UART. |
Steve Pampling (1551) 8170 posts |
Ah, I hadn’t looked at newer boards. What board revision did they start bringing the handshake out to available pins? |
Timo Hartong (2813) 204 posts |
I would say starting at the Pi B+ when the Pi foundation moved to a 40 pins header. Basicly the second generation. |
Timo Hartong (2813) 204 posts |
I have setup a build enviroment for the Pi again on a Pi-400 so perhaps I can have look at. Is int port starting at 0 for serial0 or at 1 |
Timo Hartong (2813) 204 posts |
Another question should the HAL be agnostic about UART clk rate and board type or should this be in the HAL ? |
Timo Hartong (2813) 204 posts |
Hi, I made the first change in the Risc-OS code base it is for the HALL. I changed HAL_UARTPorts to: |
Jeffrey Lee (213) 6048 posts |
Shortly after the Pi 4 was released I did start work on adding support for the extra UARTs. I can’t remember exactly what needs doing to finish up the code, but I think the main thing that needs sorting out is the GPIO pin mux settings – with multiple peripherals sharing the same pins, we need a way of letting the user/software control which peripherals are enabled. I’ve now rebased it onto the latest HAL and pushed it here: https://gitlab.riscosopen.org/jlee/HAL_BCM2835/-/tree/ExtraUARTs. I haven’t tested this new version, but for the original one I think I did at least confirm that basic RX/TX functionality worked for each of the UARTs. |
Timo Hartong (2813) 204 posts |
Hi Jeffrey, First of all thanks. I’m also working on the UART HAL because of my work on the Bluetooth stack by using the onboard rpi chip. For that I need: |
Jeffrey Lee (213) 6048 posts |
That sounds good to me. |
Timo Hartong (2813) 204 posts |
Nice I start coding ;-) |
Andrew Conroy (370) 740 posts |
Wasn’t that what GPIO_WriteMode is supposed to do, but doesn’t on the Pi4, or has that been fixed now? |
Timo Hartong (2813) 204 posts |
@Andrew |
Timo Hartong (2813) 204 posts |
Update on my work done 8 Jan 2021 |
Timo Hartong (2813) 204 posts |
It turned out that UartClock was only given a 0 value. A bit odd because other values were given a value and when I used BCMSupport_SendTempPropertyBuffer for the UARTClock it gave a sensible value. To solve this problem I had to edit s.Top as well. And an two lines around line 880. |
Timo Hartong (2813) 204 posts |
Update 10 Jan 2021 |
Timo Hartong (2813) 204 posts |
Update 12 Jan 2021. The code from Jeffrey when apllied on one place crashes the boot of RISCOS. It happens in UARTRate in all other functions the new macro for calculating the register base address works. |
Timo Hartong (2813) 204 posts |
I have placed the sources here : |
Timo Hartong (2813) 204 posts |
So a bit of progress update. Still the pesky crash at setting the baudrate. But I think I have now found the cause of it. For the rest full support for the MiniUART gets shape. Next to that I’m writing unit. ( In BBC Basic because I’m too lazy to write them in C ) |