add osmo-gtm900 subproject stub for rpi2040 on osmo gtm500 board

This commit is contained in:
Joachim Steiger 2023-11-23 22:04:37 +01:00
parent 1d5764ec8d
commit 1c80fc10f6
2 changed files with 74 additions and 0 deletions

View File

@ -0,0 +1,11 @@
add_executable(osmo-gtm900)
target_sources(osmo-gtm900 PRIVATE osmo_gtm900.c)
target_link_libraries(osmo-gtm900 PRIVATE
pico_stdlib
)
pico_enable_stdio_usb(osmo-gtm900 1)
pico_add_extra_outputs(osmo-gtm900)

63
osmo-gtm900/osmo_gtm900.c Normal file
View File

@ -0,0 +1,63 @@
#include <stdio.h>
#include "pico/stdlib.h"
#include "hardware/uart.h"
#include "tusb.h"
#define GPIO_nMODEM_LDO_ON 14 /* pico pin 19 */
#define GPIO_nPWON 6 /* pico pin 9 */
#define GPIO_UART1_TX 0 /* pico pin 1 */
#define GPIO_UART1_RX 1 /* pico pin 2 */
#define GPIO_UART1_CTS 2 /* pico pin 4 */
#define GPIO_UART1_RTS 3 /* pico pin 5 */
#define GPIO_UART2_TX 4 /* pico pin 6 */
#define GPIO_UART2_RX 5 /* pico pin 7 */
int main()
{
stdio_usb_init();
while (!tud_cdc_connected()) {
printf(".");
sleep_ms(500);
}
printf("Starting osmoGTM900 playground\n");
/* control lines as outputs */
gpio_init(GPIO_nMODEM_LDO_ON);
gpio_pull_up(GPIO_nMODEM_LDO_ON);
gpio_set_dir(GPIO_nMODEM_LDO_ON, true);
gpio_put(GPIO_nMODEM_LDO_ON, 1); /* Make the GPIO Pin HIGH */
/* no pullup on nPWON (already one in the modem) */
gpio_init(GPIO_nPWON);
gpio_set_dir(GPIO_nPWON, true);
gpio_put(GPIO_nPWON, 1);
/* uarts as uarts */
uart_init(uart0, 115200);
gpio_set_function(GPIO_UART1_TX, GPIO_FUNC_UART);
gpio_set_function(GPIO_UART1_RX, GPIO_FUNC_UART);
gpio_set_function(GPIO_UART1_CTS, GPIO_FUNC_UART);
gpio_set_function(GPIO_UART1_RTS, GPIO_FUNC_UART);
uart_init(uart1, 115200);
gpio_set_function(GPIO_UART2_TX, GPIO_FUNC_UART);
gpio_set_function(GPIO_UART2_RX, GPIO_FUNC_UART);
printf("Entering main loop\n");
sleep_ms(500); /* Delay of 500ms to settle usb */
printf("Enabling modem power\n");
gpio_put(GPIO_nMODEM_LDO_ON, 0); /* LOW */
sleep_ms(500); /* delay to settle modem */
/* power on modem by simulating button press*/
printf("Resetting modem... ");
gpio_put(GPIO_nPWON, 0);
sleep_ms(200);
gpio_put(GPIO_nPWON, 1);
printf("done\n");
while (true) {
// usb-uart handling goes here();
}
}