Not applicable
Sep 08, 2017
01:12 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Sep 08, 2017
01:12 AM
I have DAVE-4.3 with the Update Site Pack 2017-08-07.
I tried to set the MSB first setting in the DAVE App, but when I checked the signal with an oscilloscope the bits still came in LSB. The generated code shows this addition to UART_0_init() in uart_conf.c:
This function is in xmc_usic.h and seems correct:
But the XMC_USIC_CH_SHIFT_DIRECTION_MSB_FIRST setting is defined as:
when it should be defined as:
This is in the xmc_usic.h file. I'm a little wary of correcting the code in that file because I don't want to mess anything up (and it hurts the portability of the code when the standard include files are changed), and the Dave code gets regenerated automatically.
Any recommendations on the best way to set that bit without messing around with the include files?
I tried to set the MSB first setting in the DAVE App, but when I checked the signal with an oscilloscope the bits still came in LSB. The generated code shows this addition to UART_0_init() in uart_conf.c:
/* MSB first */
XMC_USIC_CH_SetShiftDirection(XMC_UART0_CH1, XMC_USIC_CH_SHIFT_DIRECTION_MSB_FIRST);
This function is in xmc_usic.h and seems correct:
__STATIC_INLINE void XMC_USIC_CH_SetShiftDirection(XMC_USIC_CH_t *const channel, const XMC_USIC_CH_SHIFT_DIRECTION_t shift_direction)
{
channel->SCTR = (uint32_t)(channel->SCTR & (~USIC_CH_SCTR_SDIR_Msk)) | (uint32_t)shift_direction;
}
But the XMC_USIC_CH_SHIFT_DIRECTION_MSB_FIRST setting is defined as:
XMC_USIC_CH_SHIFT_DIRECTION_MSB_FIRST = 0x1UL << USIC_CH_SCTR_SDIR_Msk /**< Shift MSB first. The first data bit of a data word is located at the bit position given by the configured word length. */
when it should be defined as:
XMC_USIC_CH_SHIFT_DIRECTION_MSB_FIRST = 0x1UL << USIC_CH_SCTR_SDIR_Pos /**< Shift MSB first. The first data bit of a data word is located at the bit position given by the configured word length. */
This is in the xmc_usic.h file. I'm a little wary of correcting the code in that file because I don't want to mess anything up (and it hurts the portability of the code when the standard include files are changed), and the Dave code gets regenerated automatically.
Any recommendations on the best way to set that bit without messing around with the include files?
2 Replies
Sep 08, 2017
04:55 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Sep 08, 2017
04:55 AM
Hi,
Thanks for the feedback. The value of the enum value is definitively wrong as you mention. It will be corrected in the next release.
In the meantime you can apply the patch in your current project.
If you want to have it fixed for all projects created from now on, you can apply the patch at\DeviceFeatures\pack\2.1.22\Libraries\XMCLib\XMC4\inc and \DeviceFeatures\pack\2.1.22\Libraries\XMCLib\XMC1\inc.
Regards,
Jesus
Thanks for the feedback. The value of the enum value is definitively wrong as you mention. It will be corrected in the next release.
In the meantime you can apply the patch in your current project.
If you want to have it fixed for all projects created from now on, you can apply the patch at
Regards,
Jesus
Jun 21, 2023
01:23 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Jun 21, 2023
01:23 AM
Hi,
Can you also check the documentation of this function? The second parameter is shift direction, not the word_length. The description is for setting frame length, not for setting shift direction. Also the related API is wrong I guess.