da-nie / SimplyAmigaFloppyEmulator

Простой эмулятор дисковода для Amiga. Используется голубая плата на stm32f103c8t6, два буфера К561ПУ4 и дисплей от Nokia5110. Видео работы: https://youtu.be/d2U4HMiD_A0 ВНИМАНИЕ! Пока что не всегда с первого раза получается загрузка программ через "синий экран DOS".
1 stars 0 forks source link

I have trouble programming the STM32F103C8T6 Blue Pill board #2

Open Rezamjj opened 1 year ago

Rezamjj commented 1 year ago

Hey dear Danie After a week of working on the project, I finally made it this far. I think it's not bad for me, who doesn't have much expertise in electronic science. I have trouble programming the STM32F103C8T6 Blue Pill board I opened the .ioc file with the STM32cubeMX software, then Generate Code and I selected Open Project, then the codes were opened in Keil. in the Target Option\Debug, I set the target to ST-link Debugger and Rebuilt all target files. But during the rebuild, I received this report that gave two errors and was unable to continue working and transfer the codes to the board:

Rebuild started: Project: STM32F103C8T6AmigaFloppyEmulator Using Compiler 'V5.06 update 7 (build 960)', folder: 'C:\Keil_v5.34\ARM\ARMCC\Bin' Warning: You are compiling one or more files of source type C++ and have selected 'use MicroLIB'. MicroLIB does not support C++!

Rebuild target 'STM32F103C8T6AmigaFloppyEmulator' assembling startup_stm32f103xb.s... compiling ffsystem.c... compiling cdisplaybased.cpp... compiling diskio.c... ..\Src\diskio.c(232): warning: #111-D: statement is unreachable return RES_PARERR; ..\Src\diskio.c(279): warning: #111-D: statement is unreachable return RES_PARERR; ..\Src\diskio.c: 2 warnings, 0 errors compiling cdisplaystandardlibrary.cpp... compiling ffunicode.c... compiling idisplay.cpp... compiling ff.c... compiling system_stm32f1xx.c... compiling stm32f1xx_hal_gpio_ex.c... compiling stm32f1xx_it.c... compiling stm32f1xx_hal_msp.c... compiling main.c... compiling cdisplaynokia5110.cpp... compiling sd.c... ..\Src\sd.c(271): warning: #177-D: variable "size" was declared but never referenced uint16_t size=(uint16_t)(SD_Size>>20); ..\Src\sd.c(398): warning: #177-D: variable "block_size" was declared but never referenced uint32_t block_size=(1UL<<read_bl_len); ..\Src\sd.c: 2 warnings, 0 errors compiling stm32f1xx_hal_spi_ex.c... compiling stm32f1xx_hal.c... compiling stm32f1xx_hal_rcc_ex.c... compiling stm32f1xx_hal_gpio.c... compiling stm32f1xx_hal_dma.c... compiling stm32f1xx_hal_rcc.c... compiling stm32f1xx_hal_spi.c... compiling stm32f1xx_hal_tim.c... compiling stm32f1xx_hal_tim_ex.c... compiling stm32f1xx_hal_cortex.c... compiling stm32f1xx_hal_pwr.c... compiling stm32f1xx_hal_flash_ex.c... compiling stm32f1xx_hal_flash.c... linking... STM32F103C8T6AmigaFloppyEmulator\STM32F103C8T6AmigaFloppyEmulator.axf: Error: L6218E: Undefined symbol get_fattime (referred from ff.o). STM32F103C8T6AmigaFloppyEmulator\STM32F103C8T6AmigaFloppyEmulator.axf: Error: L6218E: Undefined symbol _Error_Handler (referred from stm32f1xx_hal_msp.o). Not enough information to list image symbols. Not enough information to list load addresses in the image map. Finished: 2 information, 0 warning and 2 error messages. "STM32F103C8T6AmigaFloppyEmulator\STM32F103C8T6AmigaFloppyEmulator.axf" - 2 Error(s), 4 Warning(s). Target not created. Build Time Elapsed: 00:00:05

Please help ... Thanks

da-nie commented 1 year ago

Hello.

After researching, I realized that the Data pin should be connected to pin number 2 (Read Data) of the Amiga floppy external port, I got it right?

Yes.

define DRIVE_OUTPUT_GPIO_PIN_DIR GPIO_PIN_3 -> pin number 2.

I opened the .ioc file with the STM32cubeMX software, then Generate Code

Generate Code -> generate new main.c! Verify your main.c file!

Rezamjj commented 1 year ago

Generate Code -> generate new main.c! Verify your main.c file!

Can you please explain more, I don't understand I even installed the STM32CubeIDE software and made a HEX output file and then programmed it with the STM32 ST-LINK Utility software using ST-Link V2, but it didn't work! Shouldn't it work with this method? Do you have a step-by-step video of Blue Pill Board programming? I really tried ALL the methods. And I'm tired, but I don't want to give up!

da-nie commented 1 year ago

Your main.c file has changed after you created the code in CubeMX (using Generate Code). Replace the file main.c with mine.

Rezamjj commented 1 year ago

Your main.c file has changed after you created the code in CubeMX (using Generate Code). Replace the file main.c with mine.

Ooohh, it's finally done. but... After loading, the display screen freezes on these words: Поиск SD SD готова Поиск ФС I tested with different SD memory cards, one is FAT and the other is FAT32, but apparently none of them worked. What is the reason??

da-nie commented 1 year ago

1) Use a memory card smaller than 4 GB. 2) There should be only one partition on the memory card. This partition must be primary and FAT32. 3) The search for the file system is performed by a third-party FatFS module. If it cannot find the file system, then either there is a problem reading from the SD card, or the file system is not created correctly.

Rezamjj commented 1 year ago

Hello, Mr. Danie, thank you very much for being with me from the beginning of this project and helping me in every way. I appreciate you

  1. Use a memory card smaller than 4 GB.

    1. There should be only one partition on the memory card. This partition must be primary and FAT32.

    2. The search for the file system is performed by a third-party FatFS module. If it cannot find the file system, then either there is a problem reading from the SD card, or the file system is not created correctly.

Yess, I got it and now i think everything is done! Спасибо!

Rezamjj commented 1 year ago

In the video you uploaded on YouTube, I saw that you used MFM format, all the images I have from Amiga floppy disks are ADF. Is there a way to convert them to MFM?? Or is there a website that provides images in MFM format for download?? (I don't have an image to test the board! :((

da-nie commented 1 year ago

https://disk.yandex.ru/d/lAWc0YBW3JzwFM

ADF2MFMConverter.

Rezamjj commented 1 year ago

Thanks a lot, Everything worked properly, only the LCD backlight does not turn on, which caused the text on the screen to be unclear. I remember in the product description of the Nokia 5110 LCD (red), it was written: Note: In red displays, the light pin must be connected to GND to turn on the LCD backlight, if you intend to turn it on in coding, connect the digital pin value to LIGHT and set its value to LOW.

I think it is exactly the same as yours. With these descriptions and photos, what should be done to turn on the backlight of the display?

Rezamjj commented 1 year ago

5110-1200x1200h 5110-2-1200x1200w

da-nie commented 1 year ago

Pin 8 to +3.3 V.

da-nie commented 1 year ago

Where did you find the K561PU4 chips? :)

Rezamjj commented 1 year ago

Pin 8 to +3.3 V.

Thanks, it's worked. I replaced it with cd4050 I loaded a number of games, all of them were successful, but when loading the Workbench(or some Tools that based on a workbench and AmigaDos), it gave the error "Please replace volume in any drive". And it was not fixed by repeatedly pressing Retry. What could be the reason?

da-nie commented 1 year ago

Unfortunately, this emulator does not fit into the timing diagram of a real drive (this is written in the description). But he is very simple. Therefore, not all programs can be loaded without problems. And some won't load at all.

Rezamjj commented 1 year ago

Dear Danie, this emulator is really wonderful and practical. It's definitely possible to upgrade it. it's true? I will be very excited to hear that you are working on timing and making it work better. And also If it's possible that the emulator has the ability to write, it will really become a more complete and wonderful project. And a simpler feature such as selecting DFx and using it as internal floppy drive.

da-nie commented 1 year ago

It's definitely possible to upgrade it. it's true?

May be. You can try using stm32f407 or a faster microcontroller.

I will be very excited to hear that you are working on timing and making it work better.

No. This is an experimental prototype project for those who want to improve it. I can't improve it yet.

And also If it's possible that the emulator has the ability to write,

I didn't plan to record.

da-nie commented 1 year ago

My first drive emulator used 2 MB RAM based on 1 MB SIMM modules. Since many pins are used, the emulator uses two atmega 16 microcontrollers and it takes a long time (1 minute) to transfer data between them. But the timing of the drive are accurate.

https://habr.com/ru/articles/330668/

Rezamjj commented 1 year ago

May be. You can try using stm32f407 or a faster microcontroller.

Someone had published his video on YouTube, in which he simulated a floppy for the Amiga with only an Arduino Nano, and used the Workbench image file to test it. Although the processor was relatively weaker! It was surprising.

Rezamjj commented 1 year ago

My first drive emulator used 2 MB RAM based on 1 MB SIMM modules. Since many pins are used, the emulator uses two atmega 16 microcontrollers and it takes a long time (1 minute) to transfer data between them. But the timing of the drive are accurate.

https://habr.com/ru/articles/330668/

Interesting and unique project! I have never seen anyone use this method. Well done

Rezamjj commented 1 year ago

Pin 8 to +3.3 V.

The 2950 transistor gets very hot. is it normal? Is it possible that the cause is the extra current that the Backlight uses?

da-nie commented 1 year ago

Arduino Nano

I don’t know how the drive with arduino nano manages to work. Atmega 16 at a frequency of 16 MHz barely manages to issue drive data from external dynamic RAM. I don’t know how the Arduino nano manages to read the SD card (the card can delay the response for an indefinite time).

The 2950 transistor gets very hot. is it normal?

No. This is not a transistor, but a power stabilizer chip. The backlight needs to be powered by 5 V.