CuVoodoo STM32F1 firmware template
Functions
microwire_master.h File Reference

library to communicate using microwore as master (API) More...

Go to the source code of this file.

Functions

void microwire_master_setup (uint32_t frequency, bool organization_x16, uint8_t address_size)
 setup microwire peripheral More...
 
void microwire_master_read (uint32_t address, uint16_t *data, size_t length)
 read data from slave memory More...
 
void microwire_master_write_enable (void)
 enable write and erase operations More...
 
void microwire_master_write_disable (void)
 disable write and erase operations More...
 
void microwire_master_write (uint32_t address, uint16_t data)
 write data to slave memory More...
 
void microwire_master_wait_ready (void)
 wait until slave is ready after a write or erase
 
void microwire_master_erase (uint32_t address)
 erase memory More...
 
void microwire_master_erase_all (void)
 erase all memory More...
 
void microwire_master_write_all (uint16_t data)
 write data to all slave memory More...
 

Detailed Description

library to communicate using microwore as master (API)

Author
King Kévin kingk.nosp@m.evin.nosp@m.@cuvo.nosp@m.odoo.nosp@m..info
Date
2017
Note
peripherals used: GPIO GPIO peripheral used to communicate, timer timer peripheral used to generate timing for the signal microwire is a 3-Wire half-duplex synchronous bus. It is very similar to SPI without fixed length messages (bit-wised).
the user has to handle the slave select pin (high during operations) so to be able to handle multiple slaves.
Warning
this library implements the M93Cx8 EEPROM operation codes. Other microwire-based ICs might use different ones.

Definition in file microwire_master.h.

Function Documentation

◆ microwire_master_erase()

void microwire_master_erase ( uint32_t  address)

erase memory

Parameters
[in]addressmemory address of data to read
Note
after each erase and before the next operation user should wait for the slave to be ready

Definition at line 275 of file microwire_master.c.

◆ microwire_master_erase_all()

void microwire_master_erase_all ( void  )

erase all memory

Note
after each erase and before the next operation user should wait for the slave to be ready

Definition at line 286 of file microwire_master.c.

◆ microwire_master_read()

void microwire_master_read ( uint32_t  address,
uint16_t *  data,
size_t  length 
)

read data from slave memory

Parameters
[in]addressmemory address of data to read
[out]dataarray to store read data
[in]lengthnumber of data bytes/words to read

Definition at line 186 of file microwire_master.c.

◆ microwire_master_setup()

void microwire_master_setup ( uint32_t  frequency,
bool  organization_x16,
uint8_t  address_size 
)

setup microwire peripheral

Parameters
[in]frequencyclock frequency in Hz
[in]organization_x16if x16 memory organization (16-bits) is used, or x8 (8-bits)
[in]address_sizeaddress size in bits
Note
frequency practically limited to 500 kHz due to the software implementation nature

Definition at line 60 of file microwire_master.c.

◆ microwire_master_write()

void microwire_master_write ( uint32_t  address,
uint16_t  data 
)

write data to slave memory

Parameters
[in]addressmemory address of data to read
[in]databyte/word to write
Note
after each write and before the next operation user should wait for the slave to be ready

Definition at line 237 of file microwire_master.c.

◆ microwire_master_write_all()

void microwire_master_write_all ( uint16_t  data)

write data to all slave memory

Parameters
[in]databyte/word to write
Note
after each write and before the next operation user should wait for the slave to be ready

Definition at line 297 of file microwire_master.c.

◆ microwire_master_write_disable()

void microwire_master_write_disable ( void  )

disable write and erase operations

Note
this should be done after every complete write operation to protect against corruption

Definition at line 226 of file microwire_master.c.

◆ microwire_master_write_enable()

void microwire_master_write_enable ( void  )

enable write and erase operations

Note
on slave boot write is disable to prevent corruption

Definition at line 215 of file microwire_master.c.