Hallo Besucher, der Thread wurde 8,2k mal aufgerufen und enthält 32 Antworten

letzter Beitrag von Sgw32NULLchar am

Kung Fu SID (ex UltiSID) - new STM32 SID chip replacement

  • Hi everyone!


    First of all, I am sorry, I can't write in Deutsch since I am from Russia, my native language is Russian :)


    image.png


    image.png

    image.png


    Link to GitHub repository https://github.com/Sgw32/UltiSID/tree/hal_usid


    Schematic: https://github.com/Sgw32/UltiS...ltiSID.pdf


    It is time to release one of my new project UltiSID.

    Open source SID chip replacement 8580/6581 emulator that can be executed on Bluepill boards and STM32F103


    License - GNU General Public License v3 (derived from Bakisha STM32 SID player)


    Introduction


    Project is heavily inspired by SwinSID and ArmSID project. And is maintained as an open-source alternative to them. Now it is even working on a STM32F103C8T6 on an overclocked freq 128 MHz with 8 MHz crystal. With some errors in behavior - some readings/writings from CPU are missing. I'm looking for contributers(I can even pay for the work) who will add some assembler optimization magic into my code. Also I plan releasing Altium Designer PCB hardware files publicly available right after I'll sell 10 copies of UltiSIDs to public.Working in a time-stretched and computation-intensive environment of C64 requires hardcore optimization of code. We have only 500ns for interrupt processing. Project is still in a very early stage of development


    So why UltiSID? Why Ulti? I think that open-source contributions make our planet better, and since, the open-source alternative to SwinSID and ArmSID is still better than closed solutions. In 2021 there are still no any good SID emulators publicly available. 2021, Carl!


    Chip support - it supports STM32F103C8T6 and STM32F405RCT6 both(but not at the same time Very Happy )


    Credits and special thanks

    Future plans


    STM32F103 has a very long delay between CS fall down and interrupt routine begin - about 200ns. With a 500 ns window at all. I plan migrating to STM32F405RCT6(still, very cheap on Aliexpress) my PCB also supports it. Also, I should optimize RW&CS routines to enhance performance.


    Limitations


    We have a 256b buffer for SID data, and it is processed in main cycle. Seems enough, but sometimes I hear that it is not.

    Pitch is not calibrated

    Data readings are not correct at event-intensive tunes(where there are a lot of write-to-SID activities)

    No 6581/8580 switch

    No paddles(sorry, no reads)


    Support us

    PayPal Me:

    https://paypal.me/sgw32

    Or buy something here (3d print models):

    https://www.cgtrader.com/sgw32


    Video(and audio) PoC:

    https://www.youtube.com/watch?v=_ROxem-S0Jo

  • Now it is even working on a STM32F103C8T6 on an overclocked freq 128 MHz

    Wow, that's quite a large overclocking factor. Do you know if your code works on the various STM32F103 clones that seem to have become prevalent on Bluepill boards?

  • In this project I've used such a clone, just resoldered MCU from it using hot air :) It works.
    So it will, but it now works in extreme frequency conditions. I'll even test it on 160 MHz(10 MHz * 16 PLL) in a few days. And I plan testing with 128 MHz&NOR logic for CS&RW (approved read operation) - it will help to optimize the code, save interrupt time for MCU.

    This code is the most difficult part to optimize:

    The first two lines are executed ~20-30ns before the end of 1 data transfer cycle.

  • The first two lines are executed ~20-30ns before the end of 1 data transfer cycle.

    Have you tried running the interrupt handler from RAM instead of flash? It needs a few tweaks in the linker script and some additional code to copy it during startup, but RAM usually has no wait states in these chips and flash only fakes zero waitstates by using a cache. In the STM32F103 that cache is tiny, so chances are high that it must be reloaded on every interrupt, increasing the latency.


    I'm not 100% certain if it will work on this chip though, the block diagrams in the reference manual claim that the instruction bus is only connected to the flash, but not the main bus matrix. IIRC there are newer STM32 ARM chips that are better for this trick because they have some RAM dedicated for code/data that is tightly coupled to the core, guaranteeing low latency by avoiding any stalls in the bus matrix.

  • IMHO "UltiSID" is a rather bad decision, since the emulated SIDs in the Ultimate64-Board are called "UltiSID"s, too.


    I'd go for another fancy name, in this early phase a change doesn't matter.


    STeaMSID?

    IncrediSID?

    HeavySID?

    STorMSID?

    DreamSID?

    OpenSID?

    BlueSID?

    PowerSID?

    ...


    Just my 2 cents.


    [EDIT]


    Oh, sorry, forgot ... really a stunning project - and Open Source! Like it!


    [/EDIT]

    "Wenn du überredet, ermahnt, unter Druck gesetzt, belogen, durch Anreize gelockt, gezwungen, gemobbt, bloßgestellt, beschuldigt, bedroht, bestraft und kriminalisiert werden musst. Wenn all dies als notwendig erachtet wird, um deine Zustimmung zu erlangen, dann kannst du absolut sicher sein, dass das, was angepriesen wird, nicht zu deinem Besten ist." - Quelle unbekannt.


    "Steve Jobs hat User hervorgebracht, Jack Tramiel Experten." - Quelle unbekannt.

    "Mein Herr, ich teile Ihre Meinung nicht, aber ich würde mein Leben dafür einsetzen, dass Sie sie äußern dürfen." - Voltaire.

    "Diskutiere nie mit einem Idioten - er zieht dich auf sein Niveau hinunter und schlägt dich dort mit seiner Erfahrung!" - Volksweisheit.


    Einmal editiert, zuletzt von kinzi ()

  • The first two lines are executed ~20-30ns before the end of 1 data transfer cycle.

    Have you tried running the interrupt handler from RAM instead of flash? It needs a few tweaks in the linker script and some additional code to copy it during startup, but RAM usually has no wait states in these chips and flash only fakes zero waitstates by using a cache. In the STM32F103 that cache is tiny, so chances are high that it must be reloaded on every interrupt, increasing the latency.


    I'm not 100% certain if it will work on this chip though, the block diagrams in the reference manual claim that the instruction bus is only connected to the flash, but not the main bus matrix. IIRC there are newer STM32 ARM chips that are better for this trick because they have some RAM dedicated for code/data that is tightly coupled to the core, guaranteeing low latency by avoiding any stalls in the bus matrix.

    I've heard about it. Definitely worth a try, I'll check for examples in the web.

    I refered Kung Fu Flash for Address/Data routines, however now I see it also uses remap of RAM. Cool thing! However a bit complex at a first glance though :)

  • Thanks for the feedback! Yes, checked out - the name needs to be changed. My first idea is to change to UltiSID32, however I'll try to find some other variants.

  • STMSID would be nice imho. Short name and includes the chip its based on and what it replaces :)

    Thanks!


    Another Teensy-based open source SID in development:

    FREE STEREO SID: Neuentwicklung zum mitmachen

    It is smaller than first revisions, worth a try. Isnt Teensy expensive though? Even 25 EUR is higher than ArmSID price, because Armsid price is its components price+margin :) Still cheaper than real sids though. BTW I'm just tired of SwinSIDs, made ~400-500 pcs of them and sold every unit, still not enough quality of sound.

    Teensy is great because it uses native reSID core.

  • A bit outdated but.. After two years, the project is released for evaulation as open source. (was released in August)

    UltiSID is released publicly and is now tested:

    https://github.com/Sgw32/UltiSID


    You can also order PCBs almost assembled using JLCPCB order files provided in the repository.

    New UltiSID is highly inspired by Kung Fu Flash - and commonly, it is a Kung Fu Flash with a special firmware(Kung Fu SID, included as a submodule)

    Video:

    https://youtube.com/shorts/YMMjhMZqSjQ?feature=share - small video of new hardware and software working on a real C64.


    As it was declared initially, UltiSID is completely free and open-source even for commercial purposes (GPLv3 license)

    I will be happy if someone will improve the project or add some new functions to it. It still lacks paddles, but new hardware supports it.

    As well, there is an OpAmp on output cascade, and output is completely generated by DAC, not PWM as on SwinSID - which ensures smooth and good generation of sound. I still need some optimization of code.



    There are no hard flaws as it was before on the previous revision of the hardware. It processes data and it is possible to read it back, it works stable.

    However I've noticed a small flaw for future improvement:

    - Paddles input is 3.3V max, but it can be up to 5V on C64.

    - You mustn't solder reset pin to a chip replacement PCB


    I would also be happy for any donation:

    PayPal is unfortunately banned in Russia, as Russia resident I am unable to use it, even if I'm not in Russia actually(as it is)

    0xeDc17cb23241eACe19DF3617291aa7d2d92E62DC - USDT/ETH ERC20

    TKSPmVWoCgQky8umDUcR7oivJKNzAXueSB - USDT TRC20

    0x77c411fdedc72b034432571ae9aee10330b72d6c - USDT BSC20

    https://www.cgtrader.com/sgw32 - or buy something here(my 3d models of C64 for 3d printing)

  • PayPal is unfortunately banned in Russia, as Russia resident I am unable to use it, even if I'm not in Russia actually(as it is)

    Whatever the situation is I hope you are fine and can make for a living in Armenia.

  • KungFuSID - yes, that would be a correct naming. The firmware already has this name, but Google refers to previous name too. I'll change the topic name here if it will be possible.

    For the building, probably only ST-Link, 2x2.54 headers and chip header with rounded contacts are needed, other is done by JLCPCB, it is intended to be a sort of fully fabless project in near future.

    It lacks some performance(needs more tuning probably, and more optimizations to make more DAC sample rate) and has troubles on some tunes (Artillery credits, Artillery 100% are one of remarkable)

    Otherwise in most tunes it sounds much better than SwinSID does. I've also tested it on some demos with PWM sounds (C64 which plays mods and so on) - it worked well.

    However the "safe" paddles will be only supported in a new hardware revision probably. I'll make it if project will gain some interest.

    And probably I'll make project even cheaper if I'll use a new STM32 alternative - Artery chips e.g. this one:

    https://www.lcsc.com/product-d…32F415RCT7-7_C528432.html


    If we buy something at CGTrader, how much of the money spent will reach you?

    Probably 40-50% or so. But it is still a huge help :)

    I'm doing 3d modelling projects with my friend, soon we'll update with C64GS case.


    PayPal is unfortunately banned in Russia, as Russia resident I am unable to use it, even if I'm not in Russia actually(as it is)

    Whatever the situation is I hope you are fine and can make for a living in Armenia.


    Thanks! I'm probably moving to Europe soon.

  • Thanks! I'm probably moving to Europe soon.

    Be sure to monitor https://www.euronews.com/ (a pan european TV station) if you can before moving as there could be trouble on some borders for Russians depending on waht's going on in Russia. I could also imagine that intelligence services want to be on the safe side in regard to espionage (but as I have no insight obviously, I don't know).

  • Sgw32NULLchar Awesome! But... could you explain what this is in a bit more detail? I am confused. The original posting clearly talked about a SID chip replacement using an own PCB. Posting #12 now says it's own hardware but also somehow runs on Kung Fu Flash hardware? I guess that'll need passing out some SID lines to the cartridge? What about EN and Audio Out, for example?


    Also, you say paddles/reads are not supported. Are you aware that without $d41b reads a lot of software (Paradroid, Fort Apocalypse) does not work correctly?

  • Just for the record: the name UltiSID was already used by Ultimate-II+, Ultimate 64 etc. for many years. Not the best name to use for another SID replacement.

    Yes, Kung Fu SID is better and I already took this name for firmware(and hardware too) but old links refer to previous name, and I can't change topic name here :)

  • Sgw32NULLchar Awesome! But... could you explain what this is in a bit more detail? I am confused. The original posting clearly talked about a SID chip replacement using an own PCB. Posting #12 now says it's own hardware but also somehow runs on Kung Fu Flash hardware? I guess that'll need passing out some SID lines to the cartridge? What about EN and Audio Out, for example?


    Also, you say paddles/reads are not supported. Are you aware that without $d41b reads a lot of software (Paradroid, Fort Apocalypse) does not work correctly?

    UltiSID/KungFuSID uses its own PCB (see last video). It was tested on Kung Fu Flash to make a working fork before the new PCB. SID lines are already passed to the cartridge(but you need to select d4XX manually from addresses. It uses Kung Fu Flash code for managing C64 bus properly.

    Now it is on a separate PCB.

    Paddles in this revision will support readings below 3V3(so everything 3V3 up to 5V will return 255/0xFF) but it is not coded yet. Reads are not supported, but if you read from paddles address, it will just return random data(as SwinSID does, for example)

    As I've received many new orders for my 3d models I'll make a paddles revision soon, but first I'll do the code part and tell the results. At least it will work as 3rd button :D