реклама на сайте
подробности

 
 
> Прошивка ПЛИС Cyclone IV с микроконтроллера
Sprite
сообщение Apr 12 2018, 11:55
Сообщение #1


Частый гость
**

Группа: Участник
Сообщений: 173
Регистрация: 11-05-08
Пользователь №: 37 414



Добрый день!

Есть МК stm32f4VET6 с готовым бутлоадером. Требуется организовать загрузку прошивки в ПЛИС Cyclone IV. Пару лет назад я поднимал подобную тему, но речь шла о CPLD MAXII и один добрый человек (bugdesigner) посоветовал мне использовать FPGA и производить загрузку программы через passive serial. Подскажите, где можно посмотреть более подробную инфу по данному вопросу? В идеале хотелось бы передавать данные с МК по какому-нибудь стандартному интерфейсу (например SPI), пусть даже используя внешнюю микросхему памяти. Как лучше организовать?
Заранее спасибо.

Сообщение отредактировал Sprite - Apr 12 2018, 11:56
Go to the top of the page
 
+Quote Post
 
Start new topic
Ответов
Genadi Zawidowsk...
сообщение Apr 13 2018, 08:55
Сообщение #2


Профессионал
*****

Группа: Участник
Сообщений: 1 620
Регистрация: 22-06-07
Из: Санкт-Петербург, Россия
Пользователь №: 28 634



CODE
/* FPGA загружается процессором с помощью SPI */
static void board_fpga_loader_PS(void)
{
#if (WITHSPIHW && WITHSPI16BIT) // for skip in test configurations

#if (CTLSTYLE_RAVENDSP_V3 && ! WITHUSEDUALWATCH) && (DDS1_CLK_MUL == 10)
#include "rbf/rbfimage_v3_pll.h"
#elif (CTLSTYLE_RAVENDSP_V3 && ! WITHUSEDUALWATCH) && (DDS1_CLK_MUL == 1)
#include "rbf/rbfimage_v3.h"
#elif (CTLSTYLE_RAVENDSP_V4 && ! WITHUSEDUALWATCH) && (DDS1_CLK_MUL == 10)
#include "rbf/rbfimage_v4_pll.h"
#elif (CTLSTYLE_RAVENDSP_V4 && ! WITHUSEDUALWATCH) && (DDS1_CLK_MUL == 1)
#include "rbf/rbfimage_v4.h"
#elif CTLSTYLE_RAVENDSP_V5 && (DDS1_CLK_MUL == 10)
#include "rbf/rbfimage_v5_2ch_pll.h" // CTLSTYLE_RAVENDSP_V5 with 12.288 osc
#elif CTLSTYLE_RAVENDSP_V5 && (DDS1_CLK_MUL == 1) && WITHOPERA4BEACON
#include "rbf/rbfimage_v5_2ch_opera4.h" // CTLSTYLE_RAVENDSP_V5
#elif CTLSTYLE_RAVENDSP_V5 && (DDS1_CLK_MUL == 1)
#include "rbf/rbfimage_v5_2ch.h" // CTLSTYLE_RAVENDSP_V5
#elif CTLSTYLE_RAVENDSP_V6 && (DDS1_CLK_MUL == 1)
#include "rbf/rbfimage_v6_2ch.h" // CTLSTYLE_RAVENDSP_V6
#elif CTLSTYLE_RAVENDSP_V7 && (DDS1_CLK_MUL == 1)
#include "rbf/rbfimage_v7_2ch.h" // CTLSTYLE_RAVENDSP_V7
#elif CTLSTYLE_RAVENDSP_V8 && (DDS1_CLK_MUL == 1)
#include "rbf/rbfimage_v8.h"
#elif CTLSTYLE_RAVENDSP_V9 && (DDS1_CLK_MUL == 1)
#include "rbf/rbfimage_v7renesas_2ch.h"
#elif CTLSTYLE_RAVENDSP_V2 && (DDS1_CLK_MUL == 1) && WITHRTS192
#include "rbf/rbfimage_v8renesas_2ch.h"
#elif CTLSTYLE_RAVENDSP_V2 && (DDS1_CLK_MUL == 1)
#include "rbf/rbfimage_v8renesas96k_2ch.h"
#elif CTLSTYLE_STORCH_V1 && ! WITHUSEDUALWATCH && (DDS1_CLK_MUL == 1)
#include "rbf/rbfimage_v7_1ch.h" //
#elif CTLSTYLE_STORCH_V1 && (DDS1_CLK_MUL == 1)
#include "rbf/rbfimage_v7_2ch.h" // same as CTLSTYLE_RAVENDSP_V7
#elif CTLSTYLE_STORCH_V2 && ! WITHUSEDUALWATCH && (DDS1_CLK_MUL == 1)
#include "rbf/rbfimage_v7_1ch.h" //
#elif CTLSTYLE_STORCH_V2 && (DDS1_CLK_MUL == 1)
#include "rbf/rbfimage_v7_2ch.h" // same as CTLSTYLE_RAVENDSP_V7
#elif CTLSTYLE_STORCH_V3 && ! WITHUSEDUALWATCH && (DDS1_CLK_MUL == 1)
#include "rbf/rbfimage_v7_1ch.h" //
#elif CTLSTYLE_STORCH_V3 && (DDS1_CLK_MUL == 1)
#include "rbf/rbfimage_v7_2ch.h" // same as CTLSTYLE_RAVENDSP_V7
#elif CTLSTYLE_STORCH_V4 && ! WITHUSEDUALWATCH && (DDS1_CLK_MUL == 1) // modem v2
#include "rbf/rbfimage_v7_1ch.h" //
//#elif CTLSTYLE_STORCH_V4 && (DDS1_CLK_MUL == 1) // modem v2
// #include "rbf/rbfimage_v7_2ch.h" // same as CTLSTYLE_RAVENDSP_V7
#elif CTLSTYLE_STORCH_V5 && ! WITHUSEDUALWATCH && (DDS1_CLK_MUL == 1) // mini
#include "rbf/rbfimage_v7_1ch.h" //
#elif CTLSTYLE_STORCH_V5 && (DDS1_CLK_MUL == 1) // mini
#include "rbf/rbfimage_v7a_2ch.h" // same as CTLSTYLE_RAVENDSP_V7
#elif CTLSTYLE_STORCH_V6 && ! WITHUSEDUALWATCH && (DDS1_CLK_MUL == 1) // mini
#include "rbf/rbfimage_v7_1ch.h" //
#elif CTLSTYLE_STORCH_V6 && (DDS1_CLK_MUL == 1) // mini
#include "rbf/rbfimage_v7a_2ch.h" // same as CTLSTYLE_STORCH_V6
#elif CTLSTYLE_OLEG4Z_V1 && (DDS1_CLK_MUL == 1)
#include "rbf/rbfimage_oleg4z.h" // same as CTLSTYLE_RAVENDSP_V7, 1 RX & WFM
#else
#error Missing FPGA image file
#endif

restart:
;
unsigned long w = 1000;
do {
debug_printf_P(PSTR("fpga: board_fpga_loader_PS start\n"));
const size_t rbflength = sizeof rbfimage / sizeof rbfimage [0];
/* After power up, the Cyclone IV device holds nSTATUS low during POR delay. */

FPGA_NCONFIG_PORT_S(FPGA_NCONFIG_BIT);
local_delay_ms(1);
/* 1) Выставить "1" на nCONFIG */
//debug_printf_P(PSTR("fpga: FPGA_NCONFIG_BIT=1\n"));
FPGA_NCONFIG_PORT_C(FPGA_NCONFIG_BIT);
/* x) Дождаться "0" на nSTATUS */
//debug_printf_P(PSTR("fpga: waiting for FPGA_NSTATUS_BIT==0\n"));
while (board_fpga_get_NSTATUS() != 0)
{
local_delay_ms(1);
if (-- w == 0)
goto restart;
}
FPGA_NCONFIG_PORT_S(FPGA_NCONFIG_BIT);
/* 2) Дождаться "1" на nSTATUS */
//debug_printf_P(PSTR("fpga: waiting for FPGA_NSTATUS_BIT==1\n"));
while (board_fpga_get_NSTATUS() == 0)
{
local_delay_ms(1);
if (-- w == 0)
goto restart;
}
/* 3) Выдать байты (бладший бит .rbf файла первым) */
//debug_printf_P(PSTR("fpga: start sending RBF image (%lu of 16-bit words)\n"), rbflength);
if (rbflength != 0)
{
unsigned wcd = 0;
size_t n = rbflength - 1;
const uint16_t * p = rbfimage;
//

hardware_spi_connect_b16(SPIC_SPEEDUFAST, SPIC_MODE3);

hardware_spi_b16_p1(* p ++);
while (n --)
{
if (board_fpga_get_CONF_DONE() != 0)
{
//debug_printf_P(PSTR("fpga: Unexpected state of CONF_DONE==1\n"));
break;
}
hardware_spi_b16_p2(* p ++);
}

//debug_printf_P(PSTR("fpga: done sending RBF image, waiting for CONF_DONE==1\n"));
/* 4) Дождаться "1" на CONF_DONE */
while (board_fpga_get_CONF_DONE() == 0)
{
++ wcd;
hardware_spi_b16_p2(0xffff);
}

hardware_spi_complete_b16();

hardware_spi_disconnect();

//debug_printf_P(PSTR("fpga: CONF_DONE asserted, wcd=%u\n"), wcd);
/*
After the configuration data is accepted and CONF_DONE goes
high, Cyclone IV devices require 3,192 clock cycles to initialize properly and enter
user mode.
*/
}
} while (board_fpga_get_NSTATUS() == 0); // если ошибка - повторяем
//debug_printf_P(PSTR("fpga: board_fpga_loader_PS done\n"));
/* проверяем, проинициализировалась ли FPGA (вошла в user mode). */
while (HARDWARE_FPGA_IS_USER_MODE() == 0)
{
local_delay_ms(1);
if (-- w == 0)
goto restart;
}
debug_printf_P(PSTR("fpga: board_fpga_loader_PS: usermode okay\n"));
#endif /* (WITHSPIHW && WITHSPI16BIT) */ // for skip in test configurations
}



Проект целиком тут https://188.134.5.254/browser/trunk - данная функция в файле board.c
Go to the top of the page
 
+Quote Post

Сообщений в этой теме
- Sprite   Прошивка ПЛИС Cyclone IV с микроконтроллера   Apr 12 2018, 11:55
- - serj1979   Цитата(Sprite @ Apr 12 2018, 14:55) Добры...   Apr 12 2018, 13:14
|- - Sprite   Цитата(serj1979 @ Apr 12 2018, 20:14) Нем...   Apr 12 2018, 13:27
- - Realking   Цитата(Sprite @ Apr 12 2018, 14:55) Добры...   Apr 12 2018, 13:19
- - Genadi Zawidowski   Вот вам пример дизайна, где грузится циклон четвер...   Apr 12 2018, 20:34
|- - Sprite   Цитата(Genadi Zawidowski @ Apr 13 2018, 03...   Apr 13 2018, 08:11
|- - Realking   Цитата(Sprite @ Apr 13 2018, 11:11) Если ...   Apr 13 2018, 08:53
- - ViKo   Ничего не перетрахиваю, записываю rbf файл байтами...   Apr 13 2018, 08:47
|- - Sprite   Цитата(Genadi Zawidowski @ Apr 13 2018, 15...   Apr 13 2018, 15:46
- - Sprite   Еще один маленький вопрос касательно получения rbf...   Apr 14 2018, 11:05
- - ViKo   Там где-то установка "compressed" задает...   Apr 14 2018, 12:37
|- - Sprite   Цитата(ViKo @ Apr 14 2018, 19:37) Там где...   Apr 15 2018, 12:13
- - Sprite   Большое всем спасибо в помощи решения данного вопр...   Apr 20 2018, 12:33
|- - Enthusiast   Цитата(Sprite @ Apr 20 2018, 15:33) Единс...   Apr 21 2018, 10:00
|- - Sprite   Цитата(Enthusiast @ Apr 21 2018, 17:00) Ч...   Apr 23 2018, 04:21
- - rolin   Всем привет. Занимаюсь вот чем-то подобным. Пишу ...   Apr 25 2018, 03:01
- - ViKo   Нужно сигналы CONFIG, STATUS, CONF_DONE использова...   Apr 25 2018, 03:45
|- - rolin   Цитата(ViKo @ Apr 25 2018, 07:45) И, повт...   Apr 25 2018, 16:41
|- - ViKo   Цитата(rolin @ Apr 25 2018, 19:41) И чем ...   Apr 25 2018, 17:22
|- - rolin   Цитата(ViKo @ Apr 25 2018, 21:22) Тем, чт...   Apr 25 2018, 18:04
- - rolin   Разобрался, все работает. Оказалось, что в Верилог...   Apr 28 2018, 20:12
|- - ViKo   Цитата(rolin @ Apr 28 2018, 23:12) Оказал...   May 2 2018, 06:07
|- - rolin   Цитата(ViKo @ May 2 2018, 10:07) А просто...   May 2 2018, 12:03
|- - ViKo   Цитата(rolin @ May 2 2018, 15:03) Ну так ...   May 2 2018, 12:33
|- - rolin   Цитата(ViKo @ May 2 2018, 16:33) Обычно б...   May 2 2018, 15:12
|- - Realking   Цитата(rolin @ May 2 2018, 18:12) В Верил...   May 3 2018, 04:49
- - ViKo   Браво!   Apr 29 2018, 04:25
- - rolin   Исходники проекта бутлоадера https://github.com/Df...   May 2 2018, 05:27
- - dvladim   Цитата(rolin @ May 2 2018, 18:12) Увы, не...   May 3 2018, 16:51


Reply to this topicStart new topic
1 чел. читают эту тему (гостей: 1, скрытых пользователей: 0)
Пользователей: 0

 


RSS Текстовая версия Сейчас: 19th July 2025 - 03:43
Рейтинг@Mail.ru


Страница сгенерированна за 0.03814 секунд с 7
ELECTRONIX ©2004-2016