Skip to content
Snippets Groups Projects
Commit 494d30a9 authored by schneider's avatar schneider Committed by rahix
Browse files

fix(display): Re-init SPI before every transaction

parent 3fb21e97
No related branches found
No related tags found
No related merge requests found
......@@ -24,11 +24,7 @@
#include <stdint.h>
#include <string.h>
/* XXX: The display supports max 15 Mhz, but we have stability issues at that rate.
* Current suspicion is that the SDK is buggy.
*
* At 12 MHz things seem stable*/
#define SPI_SPEED (12 * 1000 * 1000) // Bit Rate. Display has 15 MHz limit
#define SPI_SPEED (15 * 1000 * 1000) // Bit Rate
const gpio_cfg_t bhi_interrupt_pin = {
PORT_0, PIN_13, GPIO_FUNC_IN, GPIO_PAD_PULL_UP
......@@ -82,19 +78,12 @@ void card10_init(void)
spi17y_master_cfg.ss0 = Enable;
spi17y_master_cfg.ss1 = Disable;
spi17y_master_cfg.ss2 = Disable;
if (SPI_Init(SPI0, 0, SPI_SPEED, spi17y_master_cfg) != 0) {
printf("Error configuring SPI\n");
while (1)
;
}
if (SPI_Init(SPI2, 0, SPI_SPEED, spi17y_master_cfg) != 0) {
printf("Error configuring SPI\n");
while (1)
;
}
display_init();
leds_init();
......
/*****************************************************************************
* | File : DEV_Config.c
* | File : DEV_Config.c
* | Author : Waveshare team
* | Function : Hardware underlying interface
* | Info :
* Used to shield the underlying layers of each master
* and enhance portability
*----------------
* | This version: V1.0
* | This version: V1.0
* | Date : 2018-11-22
* | Info :
......@@ -37,10 +37,22 @@
//const gpio_cfg_t DEV_CS_PIN = {PORT_0, PIN_8, GPIO_FUNC_OUT, GPIO_PAD_NONE};
//const gpio_cfg_t DEV_BL_PIN = {PORT_0, PIN_8, GPIO_FUNC_OUT, GPIO_PAD_NONE};
static spi_req_t req = {.rx_data = NULL, .bits=8, .width = SPI17Y_WIDTH_1, .ssel = 0, .deass = 1, .ssel_pol = SPI17Y_POL_LOW, .tx_num = 0, .rx_num = 0};
#define SPI_SPEED (15 * 1000 * 1000) // Bit Rate. Display has 15 MHz limit
/********************************************************************************/
void lcd_write(uint8_t *data, int size)
{
sys_cfg_spi_t spi17y_master_cfg;
spi17y_master_cfg.map = MAP_A;
spi17y_master_cfg.ss0 = Enable;
spi17y_master_cfg.ss1 = Disable;
spi17y_master_cfg.ss2 = Disable;
if (SPI_Init(SPI2, 0, SPI_SPEED, spi17y_master_cfg) != 0) {
printf("Error configuring SPI\n");
while (1)
;
}
req.tx_data = data;
req.len = size;
SPI_MasterTrans(SPI, &req);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment