According to Wikipedia The MODBUS uses the CRC-16-ANSI also known as CRC-16-IBM. The normal hexadecimal algebraic polynomial being 8005 and reversed A001Initial value: 65,535.Example of frame in hexadecimal: 01 04 02 FF FF B8 80(CRC-16-ANSI calcul...
I am trying to trigger every millisecond, or 1000 microseconds, but my counters in the interrupt are seeing 167 interrupts per second as opposed to the expected 1000 interrupts per second.I am reading 6 channels with a sample rate of 92.5 clocks per ...
Here is the code snippet. HAL_Delay(5000);
if (HAL_ADCEx_Calibration_Start(&hadc1,ADC_SINGLE_ENDED) != HAL_OK)
{
print_debug_str("Did not calibrate right!");
}
else
{
char buf[32];
sprintf(buf,"Calibration Factor: %lu\r\n",ADC1->CA...
Say we have a STM32 project called Foo. When it is compiled, it generates an intel hex file called Foo.hex that we can use to upgrade the file in the field. That is easy. What we would like to do as add the version say 10.1 or 10_1 and the last 8 di...
For example: 1000: is Combined PWM Mode, 1111: is Asymmetric PWM Mode 2. How do you fit 4 bits into 3 bit spaces? Bit 7 is used for OC1CE, and Bit 3 is used for OC1PE so there is no space on either end for the extra bit.
If I write my interrupts correctly I never have an issue. The secret is to get in and out of the interrupt as quickly as possible. Always do the minimum necessary to move the important data out of the interrupt and set a flag to tell the main proces...
I always use a 10K pullup, a 0.1 uF capacitor and a 1K resistor for my systems, without an issue. It is because I do it with other processors. Looking at the datasheet. for the STM32F401 Paragraph 6.3.17 NRST pin characteristics Figure 32 shows just ...
Even better. I found your code that did this:uint32_t CRC_HardwareBlock(uint16_t Size, const uint8_t *Buffer)
{
CRC->INIT = 0xFFFF;
CRC->POL = 0x8005;
CRC->CR = 0xE9;
while(Size >= 4) // Do as much as we can at 32-bits
{
CRC->DR = *((uint32_...
I saw that it worked for different sizes, but thought if you gave it a byte it would write a byte, I will try that. It is always the little things. That worked! It was the case where CRC->CR was 0xE9 to start!I owe you one for that!
In RM0394 I found a reference to crc_hclk AHB Clock, in paaragraph 14.3.2 but there was no mention of it anywhere else in the document using a text search.