Code: Select all
uint16_t set_bits = 0b0011001100110011;
uint16_t reset_bits = 0b1100110011001100;
GPIOx->regs->BSRR |= set_bits | ( reset_bits << 16 );
https://gist.github.com/iwalpola/6c36c9 ... 0a118571ca
oh ok that's the same port, but you have got 16 bits / pins
anything more complicated, e.g. latching a large address bus, it may take the addressable peripheral to have chip select functions to latch the bits or a shift register.
I've got a harder problem to solve, if you use a non-usb chip and add
https://www.onsemi.com/pdf/datasheet/usb1t11a-d.pdf
and that the data to usb is transmitting via SPI and DMA to usbb1t11amx, how to toggle /SE0 (pull both D+ / D- to 0) at exactly the right bit / time synchronized to SPI and DMA so that that bit will land and lift exactly where the EOP (end of packet) /SE0 chip/bit is required to end a USB packet at 12 Mhz, clocked to the slot like hardware timing. the specs for that /SE0 chip is 160 ns - 175 ns exactly (5.7 mhz - 6.2 mhz signalling speeds and exactness) and need to start exactly after the last data bit.
(^ for this I think it may be possible to cheat a bit using a hw timer, but that then it requires the timer to sync against DMA and SPI)
i.e. how to make a usb state machine engine with just a none-usb chip, and also at the receive end as well and at 12 Mhz full speed in pure firmware. -
I think the *receive* part may be harder to do, e.g how to sync with the SYNC field from SPI and DMA, and 'auto lock' to sync pattern
(0b01010100) 0x54 and 'automatically' buffer that data frame after SYNC with SPI and DMA. i.e. detect that SYNC byte, and after that all data belongs to the USB PDU (protocol data unit) up to EOP (/SE0 chip/bit) of 160 ns - 175 ns exactly
the *sync* is possibly very hard as we are trying to do *clock recovery* by achieving sync to (0b01010100) 0x54 and make the clock sync to a 12 mhz clock at the source, and to 'auto sync' SYNC patterns i.e. software PLL
this is deemed *impossible* by some
if that is possible, then it is possible to do usb Full speed (12 mbps) with any stm32 *without usb*
full usb specs there
https://www.usb.org/document-library/us ... cification