Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[board] Add basic support for STM32_F32VE board and [driver] ILI9341 via #464 #437

Merged
merged 4 commits into from
Sep 19, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ jobs:
name: Examples STM32F4 Series
command: |
(cd examples && ../tools/scripts/examples_compile.py stm32f4_discovery)
(cd examples && ../tools/scripts/examples_compile.py stm32f429_discovery stm32f469_discovery nucleo_f401re nucleo_f411re nucleo_f429zi nucleo_f446re stm32f411ccu_mini_f401 stm32f411ceu_mini_f411 stm32f407vet6_devebox)
(cd examples && ../tools/scripts/examples_compile.py stm32f429_discovery stm32f469_discovery nucleo_f401re nucleo_f411re nucleo_f429zi nucleo_f446re stm32f411ccu_mini_f401 stm32f411ceu_mini_f411 stm32f407vet6_devebox stm32_f4ve)

avr-examples:
docker:
Expand Down
16 changes: 9 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -160,8 +160,9 @@ documentation.
<td align="center">OLIMEXINO-STM32</td>
<td align="center">RASPBERRYPI</td>
<td align="center">SAMD21-MINI</td>
<td align="center">STM32F030F4P6-DEMO</td>
<td align="center">STM32-F4VE</td>
</tr><tr>
<td align="center">STM32F030F4P6-DEMO</td>
</tr>
</table>
<!--/bsptable-->
Expand Down Expand Up @@ -209,46 +210,47 @@ can easily configure them for you specific needs.
</tr><tr>
<td align="center">HX711</td>
<td align="center">I2C-EEPROM</td>
<td align="center">ILI9341</td>
<td align="center">IS31FL3733</td>
<td align="center">ITG3200</td>
<td align="center">L3GD20</td>
<td align="center">LAWICEL</td>
</tr><tr>
<td align="center">LAWICEL</td>
<td align="center">LIS302DL</td>
<td align="center">LIS3DSH</td>
<td align="center">LIS3MDL</td>
<td align="center">LM75</td>
<td align="center">LP503X</td>
<td align="center">LSM303A</td>
</tr><tr>
<td align="center">LSM303A</td>
<td align="center">LSM6DS33</td>
<td align="center">LTC2984</td>
<td align="center">MAX6966</td>
<td align="center">MAX7219</td>
<td align="center">MCP23X17</td>
<td align="center">MCP2515</td>
</tr><tr>
<td align="center">MCP2515</td>
<td align="center">NOKIA5110</td>
<td align="center">NRF24</td>
<td align="center">TFT-DISPLAY</td>
<td align="center">PAT9125EL</td>
<td align="center">PCA8574</td>
<td align="center">PCA9535</td>
</tr><tr>
<td align="center">PCA9535</td>
<td align="center">PCA9548A</td>
<td align="center">PCA9685</td>
<td align="center">SIEMENS-S65</td>
<td align="center">SIEMENS-S75</td>
<td align="center">SK6812</td>
<td align="center">SK9822</td>
</tr><tr>
<td align="center">SK9822</td>
<td align="center">SSD1306</td>
<td align="center">SX1276</td>
<td align="center">TCS3414</td>
<td align="center">TCS3472</td>
<td align="center">TLC594X</td>
<td align="center">TMP102</td>
</tr><tr>
<td align="center">TMP102</td>
<td align="center">TMP175</td>
<td align="center">VL53L0</td>
<td align="center">VL6180</td>
Expand Down
130 changes: 130 additions & 0 deletions examples/stm32_f4ve/flash/main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
/*
* Copyright (c) 2018, Raphael Lehmann
* Copyright (c) 2020, Sascha Schade
* Copyright (c) 2020, Pavel Pletenev
*
* This file is part of the modm project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
// ----------------------------------------------------------------------------

#include <modm/board.hpp>
#include <modm/debug/logger.hpp>

#include <modm/driver/storage/block_device_spiflash.hpp>

using namespace Board;


// Set the log level
#undef MODM_LOG_LEVEL
#define MODM_LOG_LEVEL modm::log::DEBUG

Board::w25q16::StorageDevice storageDevice;

void printMemoryContent(const uint8_t* address, std::size_t size) {
for (std::size_t ii = 0; ii < size; ii++) {
MODM_LOG_INFO.printf("%x", address[ii]);
}
}

uint8_t bufferA[Board::w25q16::BlockSize];
uint8_t bufferB[Board::w25q16::BlockSize];
uint8_t bufferC[Board::w25q16::BlockSize];

constexpr uint32_t TestMemorySize = 8*1024;

void doMemoryTest()
{
LedGreen2::set();
MODM_LOG_INFO << "Starting memory test!" << modm::endl;

for (uint16_t iteration = 0; iteration < 4; iteration++) {
uint8_t* pattern = (iteration % 2 == 0) ? bufferA : bufferB;

if (not RF_CALL_BLOCKING(storageDevice.erase(0, TestMemorySize))) {
MODM_LOG_INFO << "Error: Unable to erase device.";
return;
}

for (uint32_t ii = 0; ii < TestMemorySize; ii += Board::w25q16::BlockSize) {
if (not RF_CALL_BLOCKING(storageDevice.program(pattern, ii, Board::w25q16::BlockSize))) {
MODM_LOG_INFO << "Error: Unable to write data.";
return;
}
MODM_LOG_INFO << ".";
}

for (uint32_t ii = 0; ii < TestMemorySize; ii += Board::w25q16::BlockSize) {
if (not RF_CALL_BLOCKING(storageDevice.read(bufferC, ii, Board::w25q16::BlockSize))) {
MODM_LOG_INFO << "Error: Unable to read data.";
return;
}
else if (std::memcmp(pattern, bufferC, Board::w25q16::BlockSize)) {
MODM_LOG_INFO << "ii=" << ii << modm::endl;
MODM_LOG_INFO << "Error: Read '";
printMemoryContent(bufferC, Board::w25q16::BlockSize);
MODM_LOG_INFO << "', expected: '";
printMemoryContent(pattern, Board::w25q16::BlockSize);
MODM_LOG_INFO << "'." << modm::endl;
return;
}
}
MODM_LOG_INFO << "." << modm::endl;
}

MODM_LOG_INFO << modm::endl << "Finished!" << modm::endl;
LedGreen2::reset();
}

int
main()
{
Board::initialize();

Board::initializeW25q16();

Usart1::connect<GpioInputA9::Tx>();
Usart1::initialize<Board::SystemClock, 115200_Bd>();

// Use the logging streams to print some messages.
// Change MODM_LOG_LEVEL above to enable or disable these messages
MODM_LOG_DEBUG << "debug" << modm::endl;
MODM_LOG_INFO << "info" << modm::endl;
MODM_LOG_WARNING << "warning" << modm::endl;
MODM_LOG_ERROR << "error" << modm::endl;

bool initializeSuccess = false;

MODM_LOG_INFO << "Erasing complete flash chip... (This may take a while)" << modm::endl;

if (not RF_CALL_BLOCKING(storageDevice.initialize())) {
MODM_LOG_INFO << "Error: Unable to initialize device.";
}
else if (not RF_CALL_BLOCKING(storageDevice.erase(0, Board::w25q16::MemorySize))) {
MODM_LOG_INFO << "Error: Unable to erase device.";
}
else {
auto id = RF_CALL_BLOCKING(storageDevice.readId());
MODM_LOG_INFO << "deviceId=" << id.deviceId << " manufacturerId=" << id.manufacturerId;
MODM_LOG_INFO << " deviceType=" << id.deviceType << modm::endl;

MODM_LOG_INFO << "status=" << static_cast<uint8_t>(RF_CALL_BLOCKING(storageDevice.readStatus())) << modm::endl;

MODM_LOG_INFO << "Press USER button to start the memory test." << modm::endl;
initializeSuccess = true;
}

while (true)
{
if (initializeSuccess and not ButtonK1::read())
{
doMemoryTest();
}
}

return 0;
}
12 changes: 12 additions & 0 deletions examples/stm32_f4ve/flash/project.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<library>
<extends>modm:stm32_f4ve</extends>
<options>
<option name="modm:build:build.path">../../../build/stm32_f4ve/flash</option>
</options>
<modules>
<module>modm:platform:gpio</module>
<module>modm:platform:uart:2</module>
<module>modm:build:compilation_db</module>
salkinium marked this conversation as resolved.
Show resolved Hide resolved
<module>modm:build:scons</module>
</modules>
</library>
2 changes: 2 additions & 0 deletions examples/stm32_f4ve/gui/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
images/*.hpp
images/*.cpp
16 changes: 16 additions & 0 deletions examples/stm32_f4ve/gui/images/bake.pbm
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
P1
# CREATOR: GIMP PNM Filter Version 1.1
30 30
0000000000000000000000000000000011111111111111111111111111100011111111
1111111111111111111000111111111111111111111111111000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000000000
0000000001110000000111000000000000000001111111111111000000000000000001
1111111111110000000000000000001111111111100000000000000000000011111110
0000000000000000000000011111000000000000000000000000011111000000000000
0000000000000011100000000000000000000000000011100000000000000011111111
1111111111111111111000111111111111111111111111111000111111111111111111
1111111110001110000000000000000000001110001110000000000000000000001110
0011100000000000000000000011100011100000000000000000000011100011100000
0000000000000000111000111000000000000000000000111000111000000000000000
0000001110001111111111111111111111111110001111111111111111111111111110
001111111111111111111111111110000000000000000000000000000000
9 changes: 9 additions & 0 deletions examples/stm32_f4ve/gui/images/battery_empty.pbm
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
P1
# CREATOR: GIMP PNM Filter Version 1.1
25 16
0000000000000000000000000000000000000000000000000000001111111111111111
1110000010000000000000000000100001000000000000000001010001100000000000
0000001010010100000000000000001101001010000000000000000110100101000000
0000000000110100101000000000000000111010001100000000000000011101000010
0000000000000011101000010000000000000000000100000111111111111111111100
00000000000000000000000000000000000000000000000000
9 changes: 9 additions & 0 deletions examples/stm32_f4ve/gui/images/battery_full.pbm
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
P1
# CREATOR: GIMP PNM Filter Version 1.1
25 16
0000000000000000000000000000000000000000000000000000001111111111111111
1110000010000000000000000000100001011111011111011111010001101111101111
1011111010010101111101111101111101001010111110111110111110100101011111
0111110111110100101011111011111011111010001101111101111101111101000010
1111101111101111101000010000000000000000000100000111111111111111111100
00000000000000000000000000000000000000000000000000
9 changes: 9 additions & 0 deletions examples/stm32_f4ve/gui/images/battery_good.pbm
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
P1
# CREATOR: GIMP PNM Filter Version 1.1
25 16
0000000000000000000000000000000000000000000000000000001111111111111111
1110000010000000000000000000100001000001011111011111010001100000101111
1011111010010100001101111101111101001010000110111110111110100101000111
0111110111110100101000111011111011111010001100111101111101111101000010
0111101111101111101000010000000000000000000100000111111111111111111100
00000000000000000000000000000000000000000000000000
9 changes: 9 additions & 0 deletions examples/stm32_f4ve/gui/images/battery_low.pbm
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
P1
# CREATOR: GIMP PNM Filter Version 1.1
25 16
0000000000000000000000000000000000000000000000000000001111111111111111
1110000010000000000000000000100001000000000000011111010001100000000000
0011111010010100000000000001111101001010000000000000111110100101000000
0000000111110100101000000000000011111010001100000000000001111101000010
0000000000001111101000010000000000000000000100000111111111111111111100
00000000000000000000000000000000000000000000000000
9 changes: 9 additions & 0 deletions examples/stm32_f4ve/gui/images/battery_not_connected.pbm
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
P1
# CREATOR: GIMP PNM Filter Version 1.1
25 16
0000000000000000000000000000000000000000000000000000001111111111111111
1110000010000000000000000000100001000000001110000000010001100000001000
1000000010010100000000000100000001001010000000000100000000100101000000
0001000000000100101000000000100000000010001100000000000000000001000010
0000000010000000001000010000000000000000000100000111111111111111111100
00000000000000000000000000000000000000000000000000
6 changes: 6 additions & 0 deletions examples/stm32_f4ve/gui/images/bluetooth_12x16.pbm
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
P1
# CREATOR: GIMP PNM Filter Version 1.1
12 16
0000000000000001111110000011111111000111100111100111101011100110101101
1001110010111001111001111001111001111001110010111001101011011001111010
1110011110011110001111111100000111111000000000000000
14 changes: 14 additions & 0 deletions examples/stm32_f4ve/gui/images/bluetooth_24x32.pbm
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
P1
# CREATOR: GIMP PNM Filter Version 1.1
24 32
0000000000000000000000000000000001111110000000000000001111111111110000
0000000111111111111110000000001111111001111111000000011111111000111111
1000001111111110000111111100001111111110000011111100001111111110010001
1111000111111111100110001111100111100011100111000111100111110001100110
0011111001111110001001000111111001111111000000001111111001111111100000
0111111110011111111100001111111110011111111100001111111110011111111000
0001111111100111111100000000111111100111111000100100011111100111110001
1001100011111001111000111001110001111001111111111001100011111001111111
1110010001111110001111111110000011111100001111111110000111111100000111
1111100011111110000000111111100111111100000000011111111111111000000000
00111111111111000000000000000111111000000000000000000000000000000000
7 changes: 7 additions & 0 deletions examples/stm32_f4ve/gui/images/charge.pbm
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
P1
# CREATOR: GIMP PNM Filter Version 1.1
16 16
0000000000000000000100000000000000010000000000000001000000000000000100
0100000000000100110000000000010111000000000001111111111100000111111111
1100000101110000000000010011000000000001000100000000000100000000000000
0100000000000000010000000000000000000000000000
7 changes: 7 additions & 0 deletions examples/stm32_f4ve/gui/images/discharge.pbm
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
P1
# CREATOR: GIMP PNM Filter Version 1.1
16 16
0000000000000000000100000000000000010000000000000001000000000000000100
0000100000000100000011000000010000001110000001111111111100000111111111
1100000100000011100000010000001100000001000000100000000100000000000000
0100000000000000010000000000000000000000000000
7 changes: 7 additions & 0 deletions examples/stm32_f4ve/gui/images/plug.pbm
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
P1
# CREATOR: GIMP PNM Filter Version 1.1
16 16
0000000000000000000011100000000000001111111000000000111111110000011111
1111111000011111111111100000001111111110000000111111111111000011111111
1111000011111111100001111111111110000111111111111000000011111111000000
0011111110000000001110000000000000000000000000
Loading