Skip to content
Snippets Groups Projects
Commit 8c3a0e5e authored by Alberto Nidasio's avatar Alberto Nidasio
Browse files

[Groundstation] Updated hwmappings

parent 20eda7cf
Branches
Tags
1 merge request!39Draft: Compute unit v2
Pipeline #4042 passed
......@@ -30,26 +30,30 @@
* Board support package, this file initializes hardware.
************************************************************************/
#include <cstdlib>
#include "interfaces/bsp.h"
#include <inttypes.h>
#include <sys/ioctl.h>
#include "interfaces/bsp.h"
#include "kernel/kernel.h"
#include "kernel/sync.h"
#include "interfaces/delays.h"
#include "interfaces/portability.h"
#include "interfaces/arch_registers.h"
#include <cstdlib>
#include "board_settings.h"
#include "config/miosix_settings.h"
#include "kernel/logging.h"
#include "filesystem/file_access.h"
#include "filesystem/console/console_device.h"
#include "drivers/serial.h"
#include "drivers/sd_stm32f2_f4.h"
#include "board_settings.h"
#include "drivers/serial.h"
#include "filesystem/console/console_device.h"
#include "filesystem/file_access.h"
#include "hwmapping.h"
#include "interfaces/arch_registers.h"
#include "interfaces/delays.h"
#include "interfaces/portability.h"
#include "kernel/kernel.h"
#include "kernel/logging.h"
#include "kernel/sync.h"
// #include "kernel/IRQDisplayPrint.h"
namespace miosix {
namespace miosix
{
//
// Initialization
......@@ -62,7 +66,8 @@ namespace miosix {
static void sdramCommandWait()
{
for (int i = 0; i < 0xffff; i++)
if((FMC_Bank5_6->SDSR & FMC_SDSR_BUSY)==0) return;
if ((FMC_Bank5_6->SDSR & FMC_SDSR_BUSY) == 0)
return;
}
void configureSdram()
......@@ -94,7 +99,8 @@ void configureSdram()
GPIOG->MODER = 0x80020a0a;
GPIOA->OSPEEDR = 0xaaaaaaaa; // Default to 50MHz speed for all GPIOs...
GPIOB->OSPEEDR=0xaaaaaaaa | 0x00003c00; //...but 100MHz for the SDRAM pins
GPIOB->OSPEEDR =
0xaaaaaaaa | 0x00003c00; //...but 100MHz for the SDRAM pins
GPIOC->OSPEEDR = 0xaaaaaaaa | 0x00000003;
GPIOD->OSPEEDR = 0xaaaaaaaa | 0xf03f000f;
GPIOE->OSPEEDR = 0xaaaaaaaa | 0xffffc00f;
......@@ -120,7 +126,8 @@ void configureSdram()
| FMC_SDCR1_NR_0 // 12 bit row address
| FMC_SDCR1_MWID_0 // 16 bit data bus
| FMC_SDCR1_NB // 4 banks
| FMC_SDCR1_CAS_1; // 2 cycle CAS latency (F<133MHz)
|
FMC_SDCR1_CAS_1; // 2 cycle CAS latency (F<133MHz)
#ifdef SYSCLK_FREQ_180MHz
// One SDRAM clock cycle is 11.1ns
......@@ -199,13 +206,6 @@ void IRQbspInit()
RCC_SYNC();
interfaces::spi1::sck::mode(Mode::ALTERNATE);
interfaces::spi1::sck::alternateFunction(5);
interfaces::spi1::miso::mode(Mode::ALTERNATE);
interfaces::spi1::miso::alternateFunction(5);
interfaces::spi1::mosi::mode(Mode::ALTERNATE);
interfaces::spi1::mosi::alternateFunction(5);
interfaces::spi4::sck::mode(Mode::ALTERNATE);
interfaces::spi4::sck::alternateFunction(5);
interfaces::spi4::miso::mode(Mode::ALTERNATE);
......@@ -213,43 +213,20 @@ void IRQbspInit()
interfaces::spi4::mosi::mode(Mode::ALTERNATE);
interfaces::spi4::mosi::alternateFunction(5);
interfaces::uart5::tx::mode(Mode::ALTERNATE);
interfaces::uart5::tx::alternateFunction(8);
interfaces::uart5::rx::mode(Mode::ALTERNATE);
interfaces::uart5::rx::alternateFunction(8);
peripherals::ra01::cs::mode(Mode::OUTPUT);
peripherals::ra01::dio0::mode(Mode::INPUT);
peripherals::ra01::nrst::mode(Mode::OUTPUT);
peripherals::ra01::cs::high();
peripherals::ra01::nrst::high();
peripherals::sx127x::cs::mode(Mode::OUTPUT);
peripherals::sx127x::dio0::mode(Mode::INPUT);
peripherals::sx127x::nrst::mode(Mode::OUTPUT);
peripherals::sx127x::cs::high();
peripherals::sx127x::nrst::high();
peripherals::cc3135::cs::mode(Mode::OUTPUT);
peripherals::cc3135::hib::mode(Mode::OUTPUT);
peripherals::cc3135::intr::mode(Mode::INPUT);
peripherals::cc3135::nrst::mode(Mode::OUTPUT);
peripherals::cc3135::cs::high();
peripherals::cc3135::hib::high();
peripherals::cc3135::nrst::high();
peripherals::gps::cs::mode(Mode::OUTPUT);
peripherals::gps::nrst::mode(Mode::OUTPUT);
peripherals::gps::cs::high();
peripherals::gps::nrst::high();
_led::mode(Mode::OUTPUT);
peripherals::sx127x::dio0::mode(Mode::INPUT);
peripherals::user_led::mode(Mode::OUTPUT);
ledOn();
delayMs(100);
ledOff();
DefaultConsole::instance().IRQset(intrusive_ref_ptr<Device>(
new STM32Serial(defaultSerial, defaultSerialSpeed,
defaultSerialFlowctrl ? STM32Serial::RTSCTS : STM32Serial::NOFLOWCTRL)));
defaultSerialFlowctrl ? STM32Serial::RTSCTS
: STM32Serial::NOFLOWCTRL)));
// irq_display = new IRQDisplayPrint();
// DefaultConsole::instance().IRQset(intrusive_ref_ptr<Device>(irq_display));
}
......@@ -282,9 +259,9 @@ WARNING: close all files before using this function, since it unmounts the
filesystem.<br>
When in shutdown mode, power consumption of the miosix board is reduced to ~
5uA??, however, true power consumption depends on what is connected to the GPIO
pins. The user is responsible to put the devices connected to the GPIO pin in the
minimal power consumption mode before calling shutdown(). Please note that to
minimize power consumption all unused GPIO must not be left floating.
pins. The user is responsible to put the devices connected to the GPIO pin in
the minimal power consumption mode before calling shutdown(). Please note that
to minimize power consumption all unused GPIO must not be left floating.
*/
void shutdown()
{
......@@ -296,7 +273,8 @@ void shutdown()
disableInterrupts();
for(;;) ;
for (;;)
;
}
void reboot()
......
......@@ -34,10 +34,12 @@
#define BSP_IMPL_H
#include "config/miosix_settings.h"
#include "interfaces/gpio.h"
#include "drivers/stm32_hardware_rng.h"
#include "hwmapping.h"
#include "interfaces/gpio.h"
namespace miosix {
namespace miosix
{
/**
\addtogroup Hardware
......@@ -51,21 +53,9 @@ namespace miosix {
*/
void configureSdram();
/**
* \internal
* used by the ledOn() and ledOff() implementation
*/
typedef Gpio<GPIOG_BASE,14> _led;
inline void ledOn()
{
_led::high();
}
inline void ledOn() { peripherals::user_led::high(); }
inline void ledOff()
{
_led::low();
}
inline void ledOff() { peripherals::user_led::low(); }
/**
\}
......
......@@ -36,15 +36,7 @@ namespace miosix
namespace interfaces
{
// GPS - CC3135
namespace spi1
{
using sck = Gpio<GPIOA_BASE, 5>;
using miso = Gpio<GPIOB_BASE, 4>;
using mosi = Gpio<GPIOA_BASE, 7>;
} // namespace spi1
// RA-01 - SX127x
// SX127x
namespace spi4
{
using sck = Gpio<GPIOE_BASE, 2>;
......@@ -52,47 +44,27 @@ using miso = Gpio<GPIOE_BASE, 5>;
using mosi = Gpio<GPIOE_BASE, 6>;
} // namespace spi4
namespace uart5
namespace usart1
{
using tx = Gpio<GPIOC_BASE, 12>;
using rx = Gpio<GPIOD_BASE, 2>;
} // namespace uart5
using tx = miosix::Gpio<GPIOA_BASE, 9>;
using rx = miosix::Gpio<GPIOA_BASE, 10>;
} // namespace usart1
} // namespace interfaces
namespace peripherals
{
namespace ra01
{
using cs = Gpio<GPIOC_BASE, 13>;
using dio0 = Gpio<GPIOF_BASE, 6>;
using nrst = Gpio<GPIOC_BASE, 14>;
} // namespace ra01
namespace sx127x
{
using cs = Gpio<GPIOE_BASE, 4>;
using dio0 = Gpio<GPIOE_BASE, 3>;
using nrst = Gpio<GPIOG_BASE, 2>;
using cs = Gpio<GPIOC_BASE, 1>;
using dio0 = Gpio<GPIOF_BASE, 10>;
} // namespace sx127x
namespace cc3135
{
using cs = Gpio<GPIOD_BASE, 4>;
using hib = Gpio<GPIOG_BASE, 3>;
using intr = Gpio<GPIOD_BASE, 5>;
using nrst = Gpio<GPIOB_BASE, 7>;
} // namespace cc3135
namespace gps
{
using cs = Gpio<GPIOD_BASE, 7>;
using nrst = Gpio<GPIOB_BASE, 2>;
} // namespace gps
using user_led = Gpio<GPIOG_BASE, 14>;
} // namespace peripherals
}
} // namespace miosix
#endif // HWMAPPING_H
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment